/** * Get all the bundle data for a product * * @param Mage_Bundle_Model_Product_Type * @return array */ protected function getBundleParentData(Mage_Bundle_Model_Product_Type $bundleParent) { /** @var Mage_Bundle_Model_Resource_Option_Collection */ $optionCollection = $bundleParent->getOptionsCollection(); /** @var int[] */ $optionIds = $bundleParent->getOptionsIds(); /** @var Mage_Bundle_Model_Resource_Selection_Collection */ $selectionCollection = $bundleParent->getSelectionsCollection($optionIds); /** @var Mage_Bundle_Model_Option[] */ $options = $optionCollection->appendSelections($selectionCollection); /** @var array */ $bundleData = []; /** @var Mage_Bundle_Model_Option $option */ foreach ($options as $option) { /** @var Mage_Catalog_Model_Product[] */ $bundleItems = $option->getSelections(); $bundleData[$option->getDefaultTitle()] = $this->getBundleItemData($bundleItems); } return $bundleData; }