0

I have a module which is modifying how bundled products are displayed for our store. As a part of this, we are removing the ability to display checkboxes. So, I want to change the backend so that it does not allow checkboxes as a valid input type for bundles.

I observe that Mage/Bundle/etc/config.xml defines the options in this section:

<product>
    <options>
        <bundle>
            <types>
                <select translate="label" module="bundle">
                    <label>Drop-down</label>
                </select>
                <radio translate="label" module="bundle">
                    <label>Radio Buttons</label>
                </radio>
                <checkbox translate="label" module="bundle">
                    <label>Checkbox</label>
                </checkbox>
                <multi translate="label" module="bundle">
                    <label>Multiple Select</label>
                </multi>
            </types>

However, I do not want to modify a core config file. Is there any way to have the config.xml for my module, remove the checkbox entry?

I know that blocks can be removed from the layout with a <remove "blockname"/> entry, so is there any equivalent for removing generic config values?

2

Unfortunately you cannot do it in this case because of how this method is built. Mage_Bundle_Model_Source_Option_Type::toOptionArray.
What you can do, is to rewrite that model an modify the method toOptionArray to something like this:

public function toOptionArray()
{
    $types = array();

    foreach (Mage::getConfig()->getNode(self::BUNDLE_OPTIONS_TYPES_PATH)->children() as $type) { 
        if ($type->getName() == 'checkbox'){
            continue;
        }
        $labelPath = self::BUNDLE_OPTIONS_TYPES_PATH . '/' . $type->getName() . '/label';
        $types[] = array(
            'label' => (string) Mage::getConfig()->getNode($labelPath),
            'value' => $type->getName()
        );
    }

    return $types;
}

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.