Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {if $reviews}
- {math equation="floor(x)" x=$snippetData.avarageRating assign=averageAll}
- {assign var="countAll" value=$reviews|@count}
- {assign var="count1" value=0}
- {assign var="count2" value=0}
- {assign var="count3" value=0}
- {assign var="count4" value=0}
- {assign var="count5" value=0}
- {foreach from=$reviews item="review"}
- {if $review.rating eq 1}
- {assign var='count1' value=$count1+1}
- {elseif $review.rating eq 2}
- {assign var='count2' value=$count2+1}
- {elseif $review.rating eq 3}
- {assign var='count3' value=$count3+1}
- {elseif $review.rating eq 4}
- {assign var='count4' value=$count4+1}
- {elseif $review.rating eq 5}
- {assign var='count5' value=$count5+1}
- {/if}
- {/foreach}
- {math equation="floor((count / all) * 100)" count=$count1 all=$countAll assign="starPercent1"}
- {math equation="floor((count / all) * 100)" count=$count2 all=$countAll assign="starPercent2"}
- {math equation="floor((count / all) * 100)" count=$count3 all=$countAll assign="starPercent3"}
- {math equation="floor((count / all) * 100)" count=$count4 all=$countAll assign="starPercent4"}
- {math equation="floor((count / all) * 100)" count=$count5 all=$countAll assign="starPercent5"}
- <h1>starPercent1: {$starPercent1}%</h1>
- <h1>starPercent2: {$starPercent2}%</h1>
- <h1>starPercent3: {$starPercent3}%</h1>
- <h1>starPercent4: {$starPercent4}%</h1>
- <h1>starPercent5: {$starPercent5}%</h1>
- <h1>countAll: {$countAll}</h1>
- <h1>count1: {$count1}</h1>
- <h1>count2: {$count2}</h1>
- <h1>count3: {$count3}</h1>
- <h1>count4: {$count4}</h1>
- <h1>count5: {$count5}</h1>
- <h1>averageAll: {$averageAll}</h1>
- {if $averageAll eq 5 }
- <h1>100% poleca ten produkt</h1>
- {/if}
- {/if}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement