How To Display related products on Product Page in Magento .?

Display related products anywhere in Magento:-

To display the related products on the product detail page in Magento, you must run the below code systematically to display for getting the desired results. This code uses the product resources and then loads them using the product id only. Use this code to show products anywhere on the site with right adjustments.


//Start loading a product resources
$product = Mage::getModel('catalog/product')->load($productId);

//save the product into the registry
Mage::register('product', $product);

//display $product's related products
echo $this->getLayout()->createBlock('catalog/product_list_related')


Clear the cache from backend and refresh the page then your related product will be shown in the front end respectively.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *