2

I am trying to use a custom addtocart.phtml.

Currently magento is using app/design/frontend/default/customtheme/template/catalog/product/view/addtocart.phtml

I want to change it to app/design/frontend/base/default/template/my_module/catalog/product/view/addtocart.phtml

I created a module and this is a part of my config.xml:

<layout>
        <updates>
            <My_Module>
                <file>my_module.xml</file>
            </My_Module>
        </updates>
      </layout>
    </frontend>

The file my_module.xml is located at app/design/frontend/base/default/layout/my_module.xml

Can anybody help?

1

This is how your my_module.xml layout should look like if you want to change the addtocart template:

<?xml version="1.0"?>
<layout version="0.1.0">
    <catalog_product_view> 
        <reference name="product.info.addtocart">
            <action method="setTemplate"><template>my_module/catalog/product/view/addtocart.phtml</template></action>
        </reference>
    </catalog_product_view>
</layout>

if you need to do it for the review page as well, add the following between the layout tags of the code I posted above:

    <review_product_list> 
        <reference name="product.info.addtocart">
            <action method="setTemplate"><template>my_module/catalog/product/view/addtocart.phtml</template></action>
        </reference>
    </review_product_list>

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.