Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5986635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:42:00+00:00 2026-05-22T22:42:00+00:00

I am using Magento 1.5 and am attempting to include a small box in

  • 0

I am using Magento 1.5 and am attempting to include a small box in my sidebar for a random product showing a product image, product name, star rating and part of a review.

I have managed to get Magento displaying a random product in the sidebar, unfortunately I cannot seem to find a way to select the random product based on if it has a review or not, and I also cannot find a way to load a review summary into the sidebar template I’m using.

I found the following piece of example code but it just throws the good old call to non object error.

<?php

$storeId    = Mage::app()->getStore()->getId();

$summaryData = Mage::getModel(‘review/review_summary’)
->setStoreId($storeId)
->load($_product->getId());

/* @var $summaryData Mage_Review_Model_Review_Summary */

/*

array(
['primary_id'] => 147
['entity_pk_value'] => 166
['entity_type'] => 1
['reviews_count'] => 1
['rating_summary'] => 80
['store_id'] => 1
)
*/

?>

if anyone has any ideas how to get this working, it would be greatly appreciated.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:42:00+00:00Added an answer on May 22, 2026 at 10:42 pm

    The reason you are getting that error is because of the quotes you are using. Use ‘ instead.

    In response to your edit, this is how you would go ahead and load 5 random products that have a review:

    $review = Mage::getModel('review/review');
    $collection = $review->getProductCollection();
    $collection
            ->addAttributeToSelect('*')
            ->getSelect()
                    ->limit(5)
                    ->order('rand()');
    $review->appendSummary($collection);
    
    foreach($collection as $product) {
            var_dump($product->debug());
    }
    

    Obviously now you can do something like:

    $product->getRatingSummary()
    

    to extract rating data, etc.

    Of course it is up to you to create a block to put this in (or the bad way -> just put it in some template).

    Have fun 😉

    Third edit in response to your question:

    /* Getting summary title / body. */
    $title = $product->getTitle();
    $body  = $product->getDetail();
    
    /* To get (what I assume is) 'star' rating. */
    $ratingSummary = $product->getRatingSummary();
    $starRating = $ratingSummary['rating_summary'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to load products using the Magento Core API product.create method. Magento
I just discovered on my site using magento 1.3.2.2 that on a bundled product,
I tried importing product images into Magento using an absolute path, but it did
Im using default profile for magento product export when i click the run profile
I am using Magento 1.4.0.1. I am trying to get my product listing pages
Using magento layout files - is it possible to include a block, only if
I using magento 1.6.1 I have only mobile number and name of the customers.
I am using Magento and I'm trying to fix a small issue I have
i'm using magento version 1.3.2.4 I want to change a product shipping as free
I am using magento 1.4 (wamp) . I am facing trouble to save cms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.