We are migrating away from magento 1.9 and as one of the last steps we need to extract bundles data. As an easy approach I found this solution:
$product_id = "TestBundle";
$product = Mage::getModel('catalog/product')->load($product_id);
$selctionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
$product->getTypeInstance(true)->getOptionsIds($product), $product
);
foreach($selctionCollection as $option) {
print_r($option);
}
But strangely I get a fatal error Uncaught Error: Call to undefined method Mage_Catalog_Model_Product_Type_Simple::getSelectionsCollection()
, which assumes the loaded product is a simple product. But it isn't, definitely! I created it newly as a bundle product and get the same behavior with other existing bundle products, too. As far as I know it should be Mage_Bundle
.
Did anybody overcome this error or have any idea how to work around it?