3

I want to overwrite grouped.phtml file located at

app\design\frontend\rwd\default\template\catalog\product\view\type\
path in my own module. My magento version is 1.9.1.0.

Please guide me.

  • are you want override only grouped.phtml? – Amit Bera Apr 7 '15 at 6:22
  • yes, Amit. Exactly. – Milople Inc Apr 7 '15 at 6:22
3

Create New Layout file at Custom Module:

You can do this layout.First need to create a frontend layout file customgrouped.xml from this custom module like this.

<?xml version="1.0" ?>
<config>
    <modules>
        <Amit_Custommodule>
            <version>1.0.0</version>
        </Amit_Custommodule>
    </modules>
    <!-- start of routers 
    -->
    <frontend>
        <layout>
            <updates>
                <custommodule>
                    <file>customgrouped.xml</file>
                </custommodule>
            </updates>
        </layout>
    </frontend>
</config>

Change template file at new layout file

then on customgrouped.xml file using grouped.phtml name and using setTemplate function set template .

<?xml version="1.0"?>
<layout version="0.1.0">
<!--
PRODUCT_TYPE_grouped for only grouped product view page
-->
    <PRODUCT_TYPE_grouped> <!--  grouped.phtml  block name define at catalog.xml -->
        <reference name="product.info.grouped">
              <action method="setTemplate"><template>youpath/customgrouped.phtml</template></action>
        </reference>
    </PRODUCT_TYPE_grouped></layout>
  • Thanks for your quick answer. I tried this one earlier. Unfortunately it is not working for me. – Milople Inc Apr 7 '15 at 6:31
  • can you please show the grouped.phtml file layout code – Amit Bera Apr 7 '15 at 6:35
  • <catalog_product_view> <PRODUCT_TYPE_grouped> <!-- grouped.phtml block name define at catalog.xml --> <reference name="product.info.grouped"> <action method="setTemplate"><template>modulename/catalog/product/view/type/grouped.phtml</template></action> </reference> </PRODUCT_TYPE_grouped> </catalog_product_view> – Milople Inc Apr 7 '15 at 6:37
  • no no... default layout code of grouped.phtml which was defined in your system – Amit Bera Apr 7 '15 at 6:38
  • I have updated my comment. Please check it. – Milople Inc Apr 7 '15 at 6:39
1

you can do this easily by local.xml file. What we are going to do here is, setting another template for the block which uses grouped.phtml. This particular template is only used for grouped products. So here I assume you want to use custom/product/type/grouped.phtml file instead of default catalog/product/type/grouped.phtml.

File : app\design\frentend\rwd\default\layout\local.xml

<layout>
    <PRODUCT_TYPE_grouped>
        <reference name="product.info.grouped"> 
            <action method="setTemplate">
                <template>custom/product/type/grouped.phtml</template>
            </action>
        </reference>
    </PRODUCT_TYPE_grouped>
</layout>

Now make sure you have defined the new phtml file at app\design\frentend\rwd\default\custom/product/type/grouped.phtml

  • Thanks Rajeev. I have already tried this. I want to use "\app\design\frontend\rwd\default\template\my module\catalog\product\view\type\grouped.phtml" file instead of "\app\design\frontend\rwd\default\template\catalog\product\view\type\grouped.phtml". Please check whether I am doing any mistake. – Milople Inc Apr 7 '15 at 6:45
  • show your module activation file and config.xml file. Put them along with the question and ping me – Rajeev K Tomy Apr 7 '15 at 6:47

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.