Magento – Showing Review Summary on Cart Page

cartreview

I'm trying to show review summary on cart page.

I've tried adding these lines in template/checkout/cart/item/default.phtml page

  $_item = $this->getItem();

 <?php echo $this->getReviewsSummaryHtml($_item, "short", true)?>

But it didn't work. Searched the internet but didn't find any solution.

I know it is a simple task, but i'm stuck on it. Please help.

Best Answer

I think the problem here us because reviews are attached to the product and not the cart item. To add the review to the cart you need the product and not the cart item. If you update your code as follows:

$reviewHelper = $this->getLayout()->createBlock('review/helper');
echo $reviewHelper->getSummaryHtml($_item->getProduct(), 'short', true);

Then it should display the summary. Basically you need to load the product from the cart item and then pass this to the review helper function.

Related Topic