Many other situations can be there, when we may not have option, but to write custom code to get related products of currently loaded product.
For such situations, try this code:
For such situations, try this code:
$collection = Mage::getModel('catalog/product_link')
->getCollection()
->addFieldToFilter('product_id',$product_id)
->addFieldToFilter('link_type_id','1');
$related_products = $collection->getData();
This will give you list of all related products of a product.
Note: Here $product_id is the id of currently loaded product.
Thank you.
ReplyDelete