I am developing a module that creates a few custom entities which relate/impact the options available for a particular product. Here's how it works:

When a product loads, a query is performed on my custom entities using two of the product's attributes.

I use the result of the query and present it in a 2-step fashion, like this (the customer's first selection impacts the options available for their second):

intended interface

The Challenge

Here's what I know I need to accomplish on the frontend:

1. Override two pieces of logic in Product view.phtml:

--- First:

<form action="<?php echo $this->getSubmitUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>

... you'll notice enctype="multipart/form-data" only gets added if $_product->getOptions() is true, and my products won't actually have them (so this would return false).

--- Second:

 <?php if ($_product->isSaleable() && $this->hasOptions()):?>
    <?php echo $this->getChildChildHtml('container1', '', true, true) ?>
 <?php endif;?>

... also because my products won't actually have custom options, so $this->hasOptions() would return false and prevent rendering of container1.

2. Replace/overwrite/override 'container1' -- the child block (is it a block?) that "contains" the html for the custom options, as shown here: what needs to be replaced

I've read a few posts that claim that copying view.phtml and editing it directly is not the correct way to do this, but what's the alternative?

Second, I've read I can either remove or unSet the container1 piece -- which method should I use, and then how do I correctly substitute my own container1?

Thank you very much!

  • Have you found a good solution for this? Have you looked at how catalog.xml does it with the PRODUCT_TYPE_xxxxxx handles?
    – pspahn
    May 1, 2015 at 21:43
  • I’m not clear how this differs from a standard Configurable Product. Can you explain that? May 13, 2015 at 20:46
  • @fantasticrice I can't speak for TriggerDan but in my case, none of the default Magento product types were sufficient to model my client's catalog.
    – pspahn
    May 22, 2015 at 22:18
  • @pspahn - In what respects were they unable to be modeled in Magento? May 23, 2015 at 1:52
  • In my case I needed (among many other things) pricing tables that had more than 4 places of precision (think pricing by the square foot).
    – pspahn
    May 23, 2015 at 8:59

3 Answers 3


I've been working on a similar module for some time now, and ran into pretty much the same thing. I have added a custom product type to make this work.

The key is the product_type_data block. This you can override this block without having to modify other template files. In my module's layout XML file, I added:

<PRODUCT_TYPE_myproduct translate="label" module="my_module">
    <reference name="content">
        <reference name="product.info">
            <block type="my_module/product_type_myproduct" name="product.info.myproduct" as="product_type_data" template="my_module/product/type/myproduct.phtml">


From there, I add my form fields in the template. The values will get passed to an observer on the sales_quote_add_item event where I can add the user's selections to additional_options.

Additionally, by using a custom product type, you can use your own _prepareProduct() method where you will be able to set various values that will be passed through to parent::_prepareProduct($buyRequest, $product, $processMode)

(I will probably come back and modify this later with additional details)


I hope I'm not too late to answer this question. You will require custom options associated with the product. The product will only carry custom option values if it has them so add custom options in backend with a custom field by adding that in catalog_product_option table with minor tweaks in adminhtml.
This is the easiest way possible the achieve the output else you have to edit the product rendering, cart and order flow as well.
Now when you will have custom options required with a extra field which will help you in filtering that custom option needs more customization or not in frontend.
According to that field value, write your code in local/mage/catalog/Block/Product or in layout/view
Please let me know if you find this way suitable. I'll figure out the exact files and changes if still necessary.

  • An answer (how late it might be) is always welcomed. Aug 18, 2015 at 13:39

First of all to override any template in Magento you can either create a local.xml file on the layout folder and override the node that corresponds to that section of the template or view you are trying to override; or create your own template folder and override that the layout and template structure from there, there is a good example here. Second have tried using configurable products to do what you are trying to accomplish, because as you have described it, it seems like configurable products already do that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.