package templates import ( "fmt" "git.ma-al.com/goc_marek/ps_shop/internal/viewmodel" ) templ ProductPage(data viewmodel.ProductPageData, cssPath string, jsPath string) { @Layout(data.Product.Name, cssPath, jsPath, data.Menu, data.Locale, layoutCartItems(data.CartSummary)) {
Prestashop Proxy
if data.Customer != nil {

{ fmt.Sprintf("%s %s", data.Customer.FirstName, data.Customer.LastName) }

} else {

Guest session

} if data.CartSummary != nil {

{ fmt.Sprintf("Cart items: %d", data.CartSummary.TotalItems) }

}

Product

if data.Product.ImageURL != "" { } if len(data.Product.GalleryImages) > 1 {
for i, image := range data.Product.GalleryImages { if image.ThumbURL != "" && image.URL != "" { } }
} if data.CategoryURL != "" && data.Product.CategoryName != "" { { data.Product.CategoryName } }

{ data.Product.Name }

if data.Product.ShortDescription != "" {

Summary

At a glance

{ plainTextHTML(data.Product.ShortDescription) }

} if data.Product.Description != "" {

Description

About this product

@templ.Raw(data.Product.Description)
} if len(data.Product.Features) > 0 {

Features

Product details

for _, feature := range data.Product.Features {

{ feature.Name }

{ plainTextHTML(feature.Value) }

}
} if len(data.Product.Accessories) > 0 {

Related products

Accessories

for _, product := range data.Product.Accessories {
if product.ImageURL != "" { { }

Accessory

{ product.Name }

{ truncatedPlainTextHTML(product.ShortDescription, 180) }

{ moneyWithCurrency(product.PriceTaxIncl, product.CurrencySign, product.CurrencyCode) }

{ taxLabel(product.TaxRate) } · { conversionRateLabel(product.ConversionRate, product.CurrencyCode) }

View Product
}
} if len(data.Product.GalleryImages) > 0 { }
} }