i want to get bundled product id made using product ids.
suppose there is bundled product A made using product B and product c
i want to get product A , given ids of Product B and C.
How can i proceed
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
You can use the
Mage_Bundle_Model_Product_Type::getParentIdsByChild method for each of the products B and C and then check the intersection.
Let's say that B id is $idB and C id is $idC.
$typeInstance = Mage::getSingleton('bundle/product_type'); $bParents = $typeInstance->getParentIdsByChild($idB); $cParents = $typeInstance->getParentIdsByChild($idC); $intersection = array_intersect($bParents, $cParents);
All the ids in the
$intersection array represent bundle products that have as child products both B and C.