0

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.

Thanks

1

Try it like this:

$bundleIds = Mage::getResourceSingleton('bundle/selection')->getParentIdsByChild($productId);
| improve this answer | |
0

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)) { 
                            $iCnt++;
                            $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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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