Getting all product information in Magento

Fetching all the product data, custom attributes or ratings information, in Magento can be really easy, you just have to know how.

Whilst working on a Magento webshop I was asked to show the ratings and several custom attributes for the related products. Sadly I found out that the data collection Magento fetches by default for related products is limited to the data they want to show in their default theme so I had to find another way.

As it turns out this is pretty easy but poorly documented. Basically I just added the following within the foreach loop in ‘/app/design/frontend/default/templatename/template/catalog/product/list/related.phtml’.

$model = Mage::getModel('catalog/product');

Now instead of the default fields I can easily get all the other product data too with some simple functions like:

// For the ratings
echo $this->getReviewsSummaryHtml($model);

// For a custom dropdown attribute named 'brand'
echo $model->getAttributeText('brand');

Of course this also works in every other loop, as long as you have the product ID you can fetch all the data you want.

Author: Luc De Brouwer

Mild-mannered software engineer, Nine Inch Nails lover, gin drinker, cat person, and somewhat of a geek. Ron Swanson is my spirit animal.

5 thoughts on “Getting all product information in Magento”

  1. Pingback:
  2. Hi

    I wonder if can help with a Magento question?

    Do you know how to add an image of the product to the order email template and a product link back to its product page on the Magento site? I can’t find any info on this, not sure if can be done, any help would be great.


  3. Hi,

    I need some help for creating new API for magento. The problem is where to store the xml and php file and naming of the php class ? So can you show me sample for this ?

Comments are closed.