Magento – Bundle products – get default title for a bundle item

bundled-productmagento-1.9

I have created a new template for bundle products(instead of standard view.phtml)
How can I display the titles of bundle items? want to get denisa

Best Answer

I'm new to magento and have the same requirement. I was able to solve this with this code snippet.

$bundled_product = new Mage_Catalog_Model_Product();        
$bundled_product->load($prodID);


    $typeInstance = $bundled_product->getTypeInstance(true);

    $selectionCollection = $typeInstance->getSelectionsCollection(
        $typeInstance->getOptionsIds($bundled_product), $bundled_product
    );

    $optionCollection = $typeInstance->getOptionsCollection($bundled_product);

    $_options = $optionCollection->appendSelections($selectionCollection, false, Mage::helper('catalog/product')->getSkipSaleableCheck());

    $bundle_option = array();

    foreach ($_options as $key => $value) {
        $default_title = $value->getData('default_title');
        $option_id = $value->getData('option_id');

        echo 'default_title: '. $default_title .' option_id: '.$option_id;

        foreach ($value['selections'] as $selKey => $selection) {

            // for selection option / products data

        }

    }
Related Topic