Magento

Magento redirect simple product to parent configurable product

Add this code in _initProduct() method in IndexController or ProductController in /app/code/core/Catalog/Product/controllers (Create same file in your local folder), which redirects the simple product to parent configurable product.

if($product->type_id==”simple”)
{
$configurable_product = Mage::getModel(‘catalog/product_type_configurable’);
$parentIdArray = $configurable_product->getParentIdsByChild($product->getId());

if(isset($parentIdArray[0]))
{
$product = Mage::getModel(‘catalog/product’)->load($parentIdArray[0]);
}
}

Note:

Read More...