Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <{assign var="reviews" value=$product->getProductReviews()}>
- <{if $reviews}>
- <{assign var="antalreviews" value=0}>
- <{assign var="reeltantalreviews" value=0}>
- <{assign var="totalscore" value=0}>
- <{section name="p" loop=$reviews}>
- <{math assign="antalreviews" equation=x+1 x=$antalreviews}>
- <{math assign="reeltantalreviews" equation=x+1 x=$reeltantalreviews}>
- <{math assign="totalscore" equation=x+y x=$totalscore y=$reviews[p]->getRating()}>
- <{/section}>
- <{if $product->getSimilarProducts()}>
- <{* Henter anmeldelser fra søskendeprodukter *}>
- <{assign var="soskende" value=$product->getSimilarProducts()}>
- <{if $soskende}>
- <{section name="q" loop=$soskende}>
- <{assign var="tempreviews" value=$soskende[q]->getProductReviews()}>
- <{if $tempreviews}>
- <{section name="w" loop=$tempreviews}>
- <{assign var="thisreview" value=$tempreviews[w]->getRating()}>
- <{math assign="antalreviews" equation=x+1 x=$antalreviews}>
- <{math assign="totalscore" equation=x+y x=$totalscore y=$thisreview}>
- <{/section}>
- <{/if}>
- <{/section}>
- <{/if}>
- <{/if}>
- <{math assign="gennemsnit" equation=x/y x=$totalscore y=$antalreviews}>
- <{/if}>
- <{assign var="tempdato" value=$smarty.now}>
- <{math assign="nextyear" equation=x+1 x=$tempdato|date_format:"%Y"}>
- <script type="application/ld+json">
- {
- "@context": "http://schema.org/",
- "@type": "Product",
- <{if $reviews}>
- "aggregateRating": {
- "@type": "AggregateRating",
- "ratingValue": "<{$gennemsnit|number_format:2:",":"."}>",
- "reviewCount": "<{$antalreviews}>"
- },
- <{/if}>
- "name": "<{$product->getName()}>",
- "url": "<{$product->getRemoteUrl()}>",
- <{if $product->getGtin()}>
- "gtin8": "<{$product->getGtin()}>",
- <{/if}>
- <{if $images}>
- <{section name="j" loop=$images start=0 max=1}>
- "image": "<{$webshop->getUrl()}><{$images[j]->getSrc(400 , 400, 'box')}>",
- <{/section}>
- <{/if}>
- "description": "<{$product->getParsedDescription()|strip_tags:true|replace:'"':'\''}>",
- "sku": "<{$product->getOwnId()}>",
- "brand": {
- "@type": "Thing"
- <{if $supplier}>
- , "name": "<{$supplier->getName()}>"
- <{/if}>
- },
- "offers": {
- "@type": "Offer",
- "priceCurrency": "<{$webshop->getCurrency()}>",
- "price": "<{$product->getRealPrice(1)|number_format:2:".":""}>",
- "itemCondition": "NewCondition",
- "priceValidUntil": "<{$nextyear}>-<{$tempdato|date_format:"%m"}>-<{$tempdato|date_format:"%d"}>",
- "url": "<{$product->getRemoteUrl()}>",
- <{if $product->getIsInStock() || $product->getAllowNegativeStock()}>
- "availability": "InStock"
- <{else}>
- "availability": "OutOfStock"
- <{/if}>
- }<{if $reviews}>,
- "review": [
- <{assign var="tempcounter" value=0}>
- <{section name="p" loop=$reviews}>
- <{math assign="tempcounter" equation=x+1 x=$tempcounter}>
- <{assign var="order" value=$reviews[p]->getOrder()}>
- {
- "@type": "Review",
- "author": "<{$order->getDelName()}>",
- "datePublished": "<{$reviews[p]->getCreated()|escape|truncate:10:""}>",
- "name": "Anmeldelse af <{$product->getName()}>",
- "reviewBody": "<{$reviews[p]->getDescription()|escape}>",
- "reviewRating": {
- "@type": "Rating",
- "bestRating": "5",
- "ratingValue": "<{$reviews[p]->getRating()}>",
- "worstRating": "1"
- }
- }<{if $reeltantalreviews>$tempcounter}>,<{/if}>
- <{/section}>
- ]
- <{/if}>
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement