Skip to content

Instantly share code, notes, and snippets.

@matt-bailey
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matt-bailey/e19cfb4729e73bc2acdd to your computer and use it in GitHub Desktop.
Save matt-bailey/e19cfb4729e73bc2acdd to your computer and use it in GitHub Desktop.
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