Hi,
I created one bundle product, in bundle items I created one checkbox option with three products, ids 5,6 and 7.
In the frontend It have some values assigned to them, 13, 14, 15.
I want to get by ajax the product id selected, but I don't know how to do that with the value.
any idea?
Solved! Go to Solution.
ok, I have the answer:
$product = Mage::getModel('catalog/product')->load($mainProductId); $selections = $product->getTypeInstance(true) ->getSelectionsCollection($product->getTypeInstance(true) ->getOptionsIds($product), $product); foreach ($selections as $selection) { $bundleIds[$selection->getData('selection_id')] = array( 'product_id' => $selection->getId(), 'selection_qty' => $selection->getData('selection_qty') ); }
I put the value of the option in the key of the array to get it easely
ok, I have the answer:
$product = Mage::getModel('catalog/product')->load($mainProductId); $selections = $product->getTypeInstance(true) ->getSelectionsCollection($product->getTypeInstance(true) ->getOptionsIds($product), $product); foreach ($selections as $selection) { $bundleIds[$selection->getData('selection_id')] = array( 'product_id' => $selection->getId(), 'selection_qty' => $selection->getData('selection_qty') ); }
I put the value of the option in the key of the array to get it easely