Friday, October 12, 2012

Enable Custom option in bundle product


As a quick solution to add Custom Options to bundled products with dynamic prices you may try to tweak prepareProductSave method in app/code/core/Mage/Bundle/Model/Observer.php, namely just comment some code out as follows: 
/*
        if ($product->getPriceType() == '0' && !$product->getOptionsReadonly()) {
            $product->setCanSaveCustomOptions(true);
            if ($customOptions = $product->getProductOptions()) {
                foreach (array_keys($customOptions) as $key) {
                    $customOptions[$key]['is_delete'] = 1;
                }
                $product->setProductOptions($customOptions);
            }
        }
*/
To get rid of “Bundle with dynamic pricing cannot include custom defined options. Options will not be saved.” message you should hack app/design/adminhtml/default/default/template/catalog/product/edit/options.phtml template
//show error message
/*
if ($('price_type')) {
    if ($('price_type').value == '0' && $('dynamic-price-warrning')) {
        $('dynamic-price-warrning').show();
    }
}
*/

1 comment:

  1. Hi,

    This works fine for backend and frontend, but not in the checkout. In the checkout the price for the custom option is ignored.

    Any idea how to fix that?

    Cheers,
    Michael.

    ReplyDelete