سؤال

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.

هل كانت مفيدة؟

المحلول

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>

نصائح أخرى

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top