Get IDs of Products in a Bundle Product – Magento 1.9 Guide

bundled-productmagento-1.9

I need to get the id of each product which composes the bundle product.
There is this foreach ($optionsArray as $_option) in
public function getJsonConfig() from \app\code\core\Mage\Bundle\Block\Catalog\Product\View\Type\Bundle.php
I need for each product which is in the bundle I want to get a custom attribute.
I tried some solution but I am not able to get what I need

Best Answer

you get all bundle product ids by using below code

$childrenIdArray = Mage::getResourceSingleton('bundle/selection')
            ->getChildrenIds($parentId, $required=true);
Related Topic