I can get bundle item id, using that id I wants bundle product Id. I have used below code, but it is not working:

   $grouped_product_model = Mage::getModel('catalog/product_type_bundle');
   $groupedParentIds = $grouped_product_model->getParentIdsByChild(#productid); //#productid will be bundle item id.


2 Answers 2


Try it like this:

$bundleIds = Mage::getResourceSingleton('bundle/selection')->getParentIdsByChild($productId);

Below code is working for me, There might be indexing issue, i didn't get value of group ids

  if($_product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE){
                $bundleed_product_model = Mage::getModel('bundle/product_type');
                $bundleedParentIds = $bundleed_product_model->getParentIdsByChild($_product->getId()); 

                if(sizeof($bundleedParentIds) >0){
                    foreach($bundleedParentIds as $bundleedParentId)
                        if(!in_array($bundleedParentId, $bundleProIds)) { 
                            $bundleProIds[]= $bundleedParentId; 
                            $bundleProducts[] = Mage::getModel('catalog/product')->load($bundleedParentId);
                        if($iCnt == 4){break;}

Above code will get bundle products array which have current product as a child.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.