Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Magento & Nosto: How to add Star Ratings to Nosto recommendation templates
<!--
/**
* Add this markup to the recommendation template in your Nosto control panel
*/
-->
<div class="ratings-wrapper">
<div class="ratings">
<div class="rating-box">
<div class="rating" style="width:$!product.tags1.get(0)%"></div>
</div>
</div>
</div>
<!--
/**
* Copy `/app/design/frontend/base/default/template/nostotagging/product.phtml`
* into the same location in your own theme to override the original file.
*
* Add the custom mapping section below to the end of the `nosto_product` div.
*/
-->
<div class="nosto_product" style="display:none">
<!-- Existing Nosto tags should be here... -->
<!-- Custom mapping -->
<span class="tag1"><?php
// Get star rating
$storeId = Mage::app()->getStore()->getId();
$summaryData = Mage::getModel('review/review_summary')->setStoreId($storeId)->load($product->getId());
if ($summaryData['rating_summary']):
echo $summaryData['rating_summary'];
endif;
?></span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment