133 lines
4.5 KiB
Smarty
133 lines
4.5 KiB
Smarty
{if $body.product.title and !$body.product->isold()}
|
|
{$lowestOffer = 999999}
|
|
{$highestOffer = 0}
|
|
{$offerCount = 0}
|
|
|
|
{foreach $body.products as $product}
|
|
{if $product.deliveryTime == 0}
|
|
{$offerCount = $offerCount + 1}
|
|
{if $product.price_array.value_with_vat->printFloatValue(-2) < $lowestOffer}
|
|
{$lowestOffer = $product.price_array.value_with_vat->printFloatValue(-2)}
|
|
{/if}
|
|
{if $product.price_array.value_with_vat->printFloatValue(-2) > $highestOffer}
|
|
{$highestOffer = $product.price_array.value_with_vat->printFloatValue(-2)}
|
|
{/if}
|
|
{/if}
|
|
{/foreach}
|
|
{$tmpCounter = 0}
|
|
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "http://schema.org/",
|
|
"@type": "Product",
|
|
"name": "{$body.product.model_short_title} {$body.product.model_section}",
|
|
"productID": "{$body.product.id}",
|
|
{if $body.product.image or $body.product.photos}
|
|
"image": [
|
|
{if $body.product.image}"{get_photo photo=$body.product.image size='product_detail' absolute=1}"{/if}{if $body.product.photos},{/if}
|
|
{foreach $body.product.photos as $photo}
|
|
"{get_photo photo=$photo size='product_gallery' absolute=1}"{if !$photo@last},{/if}
|
|
{/foreach}
|
|
],
|
|
{/if}
|
|
{if $body.model.descr}
|
|
"description": "{$body.product.descr|markdown2html|strip_tags|escape|strip}",
|
|
{elseif $body.serie.descr}
|
|
"description": "{$body.serie.descr|markdown2html|strip_tags|escape|strip}",
|
|
{elseif $body.product.descr}
|
|
"description": "{$body.product.descr|markdown2html|strip_tags|escape|strip}",
|
|
{/if}
|
|
{block "product-price"}
|
|
{if $body.products|count}
|
|
"offers": {
|
|
"@type": "AggregateOffer",
|
|
"offerCount": {$offerCount},
|
|
"lowPrice": "{$lowestOffer}",
|
|
"highPrice": "{$highestOffer}",
|
|
"priceCurrency": "{$ctrl.currency|default:'CZK'}",
|
|
"offers": [
|
|
{foreach $body.products as $product}
|
|
{if $product.deliveryTime == 0}{$tmpCounter = $tmpCounter + 1}
|
|
{
|
|
"@type": "Offer",
|
|
"price": "{$product.price_array.value_with_vat->printFloatValue(-2)}",
|
|
"name": "{$product.title}",
|
|
"url": "{$ctrl.currUrl.Abs}#{$product.code}",
|
|
"availability": "http://schema.org/InStock"
|
|
}{if $tmpCounter < $offerCount},{/if}
|
|
{/if}
|
|
{/foreach}
|
|
]
|
|
}
|
|
{/if}
|
|
{/block}{if $body.product.producer.id},
|
|
"brand": {
|
|
"@type": "Brand",
|
|
"name": "{$body.product.producer.title|escape:"html"}"{if $body.product.producer.image},
|
|
"logo": "{get_photo photo=$body.product.producer.image size=7 absolute=1}"{/if}
|
|
}{/if}{if $cfg.Modules.reviews}{get_ratings assign=ratings id_product=$body.product.id skip_empty=true}{if $ratings.rating_count > 0},
|
|
"aggregateRating": {
|
|
"@type": "AggregateRating",
|
|
"ratingValue": "{$ratings.rating|round:1}",
|
|
"ratingCount": "{$ratings.rating_count}"
|
|
},
|
|
"review": [
|
|
{foreach $ratings.reviews as $rating}
|
|
{if $rating.user_name || $rating.name}
|
|
{if !$rating@first},{/if}
|
|
{
|
|
"@type": "Review",
|
|
"author": "{$rating.user_name} {$rating.name}",
|
|
"datePublished": "{$rating.date|date_format:"%Y-%m-%d"}",
|
|
"description": "{$rating.summary}",
|
|
"name": "{$rating.user_name} {$rating.name}",
|
|
"reviewRating": {
|
|
"@type": "Rating",
|
|
"ratingValue": "{$rating.rating|round}"
|
|
}
|
|
}
|
|
{/if}
|
|
{/foreach}
|
|
]
|
|
{/if}{/if}
|
|
{if $body.product.ean},
|
|
"gtin13":"{$body.product.ean}"
|
|
{elseif $body.product.variations.variations}
|
|
{foreach $body.product.variations.variations as $variation}
|
|
{if $variation@iteration == 1},
|
|
"gtin13":"{$variation.ean}"
|
|
{break}
|
|
{/if}
|
|
{/foreach}
|
|
{/if}
|
|
{if $body.product.id},
|
|
"sku":"{$body.product.id}"
|
|
{/if}
|
|
}
|
|
|
|
</script>
|
|
{/if}
|
|
|
|
{if $breadcrumbs|count > 1}
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "http://schema.org",
|
|
"@type": "BreadcrumbList",
|
|
"itemListElement": [
|
|
{foreach $breadcrumbs as $item}
|
|
{if !$item@first}
|
|
{$comma}{
|
|
"@type": "ListItem",
|
|
"position": {$item@index},
|
|
"item": {
|
|
"@id": "{if $item.link}{substr($cfg.Addr.full, 0, -1)}{$item.link}{else}{$ctrl.currUrl.Abs}{/if}",
|
|
"name": "{if $body.producer.id and $item@iteration == 2}{$body.producer.name}{else}{$item.text}{/if}"
|
|
}
|
|
}
|
|
{assign var="comma" value=", "}
|
|
{/if}
|
|
{/foreach}
|
|
]}
|
|
</script>
|
|
{/if}
|