1

I have a bundle product that have different options, and each options have different items. How can I get only a list of default items and it's Default Qty of those options, programmatically.

See the screen shot, I only want to get Sku 020524 and Sku 020592

enter image description here

  • Are you trying to get this data in a report format? – Tim Cieplowski Jul 27 '17 at 19:45
  • I got it fixed. But no, not in a report format. I just want to retrieve the information and output it to the browser. – Magento Learner Jul 28 '17 at 7:42
2

You can do this:

$product = Mage::getModel('catalog/product')->load(bundle_pruduct_id);
$selectionCollection = $product->getTypeInstance(true)->getSelectionsCollection(
    $product->getTypeInstance(true)->getOptionsIds($product), $product
);
$bundled_items = array();
foreach($selectionCollection as $option) {
    if ($option->is_default) {
       $bundled_items[] = array(
           'id' => $option->product_id,
           'name' => $option->name,
           'qty'=> $option->selection_qty,
       );
    }

}
print_r($bundled_items);
| 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.