Magento – Override bundle option template

bundled-productlayoutmagento-1template

does anyone know how to change the template of a bundle option for a specific product?

I've tried updating the Bundled Product in Magento (v1.8), and clicking on 'Design' to change the templates for the product. I have the following working:

<reference name="product.info">
     <action method="setTemplate">
           <template>catalog/product/view-custom.phtml</template>
     </action>
</reference>

but if I try the same approach with the Checkbox option nothing changes?

<reference name="product.info.bundle.option.checkbox">
     <action method="setTemplate">
          <template>bundle/catalog/product/view/type/bundle/option/checkbox-custom.phtml</template>
     </action>
</reference>

Looking at bundle.xml I can see that the checkbox block is called by AddRenderer – but I'm not sure how to hijack the template for this block if it's called in this way? (for reference, here's how it's called in bundle.xml):

<reference name="product.info.options.wrapper">
        <block type="bundle/catalog_product_view_type_bundle" name="product.info.bundle.options" as="type_bundle_options" template="bundle/catalog/product/view/type/bundle/options.phtml">
            <action method="addRenderer"><type>select</type><block>bundle/catalog_product_view_type_bundle_option_select</block></action>
            <action method="addRenderer"><type>multi</type><block>bundle/catalog_product_view_type_bundle_option_multi</block></action>
            <action method="addRenderer"><type>radio</type><block>bundle/catalog_product_view_type_bundle_option_radio</block></action>
            <action method="addRenderer"><type>checkbox</type><block>bundle/catalog_product_view_type_bundle_option_checkbox</block></action>
        </block>
        <action method="insert"><block>product.info.bundle.options</block></action>
</reference>

Many thanks for any advice/tips!

Tim

Best Answer

I have a custom product attribute set "prodotti3d", and I change the options.phtml and the reference for the option type file with this code in the local.xml of my theme:

<PRODUCT_ATTRIBUTE_SET_prodotti3d>

    <reference name="product.info.options">
        <action method="setTemplate"><template>catalog/product/view/options3d.phtml</template></action>

        <action method="addOptionRenderer">
            <type>file</type>
            <block>catalog/product_view_options_type_file</block>
            <template>catalog/product/view/options/type/file3d.phtml</template>
        </action>
    </reference>

</PRODUCT_ATTRIBUTE_SET_prodotti3d>

Remember to flush Cache and it works!

Related Topic