I've got a Magento site full of Bundle Products, and I'm now looking to add one single product which pulls a different view.phtml, and then a different radio.phtml, checkbox.phtml, etc. So far I've added the following to the 'Custom Layout Update' section on my new product:

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

And it's loading customview.phtml instead of view.phtml, but this still loads the standard radio.phtml, checkbox.phtml files. I'm not sure how to direct options.phtml to different radio and checkbox files. I did consider creating a different theme with these files, but the problem arises with the mobile version of the site. Normally when viewing on a mobile, packagename/mobile loads, and then it falls back to packagename/default. So if I create a new theme 'customtheme' and apply it as the 'Custom Design' on the new product, then this product won't have a mobile layout.

Does anyone know how to tell options.phtml to find a custom radio.phtml, checkbox.phtml etc (possibly with a custom options.phtml file?) and keep everything within the default theme?


I've found a solution to my problem which I'm posting here in case it can help anyone in the future, but for my solution to make sense I had to edit the question, hopefully this isn't against the site rules.

I created a custom layout (not theme) for my product which requires the custom templates. I then found the four files to edit at app\code\core\Mage\Bundle\Block\Catalog\Product\View\Type\Bundle\Option

Here, you can find the line of code which loads the respective template. I added a simple regex check of the layout name. If the product has the layout 'custom_layout' then it uses a different file.

There may be a better way to do this and I welcome suggestions from more experienced devs, but this seems to be working for me. For each of the four files in the directory, find the line


and swap it for:

if(preg_match('/custom/', Mage::app()->getLayout()->getBlock('root')->getTemplate())){ /** Loads Custom Selections **/ $this->setTemplate('bundle/catalog/product/view/type/bundle/option/custom/radio.phtml'); } else { /** Loads Standard Selections **/ $this->setTemplate('bundle/catalog/product/view/type/bundle/option/radio.phtml'); }

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.