I recently stumbled across a hurdle which stopped some of my code from working. It was code that gets the configurable product associated with a given simple product. Many solutions out there call a “loadParentProductIds()” function within the Mage_Catalog_Model_Product class. However, as of Magento 22.214.171.124, they deprecated this method, simply by setting the data element (and returning) an empty array. So any calls to this function would return/yield no parents. Hm, how to get the parent product now?
Finally, I managed to find a workable solution. Check this out;
$simpleProductId = 465; $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable') ->getParentIdsByChild($simpleProductId); $product = Mage::getModel('catalog/product')->load($parentIds); echo $product->getId(); // ID = 462 (aka, Parent of 465)
There you have it. Short and sweet.