Magento - get list all bundled products

Magento - get list all bundled products

August 20, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - get list all bundled products

Displaying Bundled Products in Magento

As a senior developer and technical blogger, I understand that working with bundled products in Magento requires careful handling of product relationships. In your case, you’re using version 1.7 and want to display all the associated products within a bundle.

Understanding Bundle Products in Magento

In Magento, a bundle product allows customers to choose options for a bundled item before adding it to their cart. These options are typically preconfigured sets of products that can be added or removed from the bundle.

Retrieving the List of Bundled Products

You’re on the right track by using the getChildrenIds method provided by the product type instance. This method returns an array of child product IDs for a specified parent (bundle) product.

Here’s how you can retrieve and display these bundled products in your view.phtml file:

<?php
$product = Mage::getModel('catalog/product')->load($product_id);
$totl = $product->getTypeInstance(true)->getChildrenIds($product->getId(), false);

// Fetch all child bundle items
$childProducts = array();
foreach ($totl as $childId) {
    $childProduct = Mage::getModel('catalog/product')->load($childId);

    // Add relevant product information to the array
    $childProducts[] = array(
        'name' => $childProduct->getName(),
        'sku' => $childProduct->getSku(),
        'image' => $childProduct->getImageUrl()
    );
}

In the code snippet above, we first load the parent bundle product using its ID. We then retrieve the child IDs using getChildrenIds. Next, we iterate through each child ID to fetch the corresponding child product and add relevant information (name, SKU, image URL) to an array.

Displaying the Bundled Products

To display these bundled products in your view.phtml file, you can use a simple foreach loop:

<?php if (!empty($childProducts)): ?>
<div class="bundle-products">
    <h3>Included Products</h3>
    <?php foreach ($childProducts as $product): ?>
        <div class="bundle-product">
            <a href="<?php echo $this->getUrl('catalog/product/view', array('id' => $product['item_id'])) ?>">
                <img src="<?php echo $product['image']; ?>" alt="<?php echo $product['name']; ?>">
            </a>
            <h4><?php echo $product['name']; ?></h4>
            <p>SKU: <?php echo $product['sku']; ?></p>
        </div>
    <?php endforeach; ?>
</div>
<?php endif; ?>

In this code, we first check if the $childProducts array is not empty. If it is, we proceed to display a heading and iterate through each bundled product.

For each product, we create a div containing an image link (pointing to the product view page), the product name as a heading, and its SKU in a paragraph element.

Conclusion

Displaying bundled products in Magento involves retrieving the child IDs of the parent bundle product using the getChildrenIds method and then fetching the corresponding product information. By following the provided code examples and best practices, you can successfully showcase all the associated products within your view.phtml file.

Remember to replace $product_id with the actual ID of the bundle product you want to display.

For more advanced customizations and tips on Magento development, feel free to explore our dedicated Magento resources at https://laravelcompany.com/magento.

Happy coding!

Magento 1 Checkout Catalog Themes

Our network