Monday, 2 November 2015

Getting Configurable Product from Simple Product ID in Magento

$simpleProductId = 465;
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')
                  ->getParentIdsByChild($simpleProductId);

$product = Mage::getModel('catalog/product')->load($parentIds[0]);
echo $product->getId();

No comments:

Post a Comment