I have products added to the cart who have related products. My question: if it's possible to call and display all related products on the end of cart page (not in the cart). thanks


There is no built in way of doing this because the block that renders the related products depends on the 'current product'.
See Mage_Catalog_Block_Product_List_Related::_prepareData().
What I recommend is to create your own block. Here is what you need.
You can get the related products for a product like this

$related = $product->getRelatedProductCollection()

You can get all the products in the cart like this:

$inCartItems = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
$inCartProduct = array();
foreach ($inCartItems as $item){
    $inCartProducts[] = $item->getProduct();

You can add a block to the cart page by adding this in a layout file

        <block type="your/block_type" name="related" as="related" template="path/to/template.phtml" />

Put all these together and you should get your result

  • This is the correct answer; great point about current_product. – philwinkle Aug 21 '13 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.