Magento – How to override template files in a module

magento-1.9moduleoverridestemplate

I have two template files that I need to override in a custom module. Those files are

app/design/frontend/<current-theme>/template/catalogue/category/view.phtml 
app/design/frontend/<your-theme>/template/catalogue/product/view.phtml 

Since I'm very new to Magento I have no idea of how to do that. Please help me on this.

Best Answer

Put the below code in your custom extension layout file:

app/design/frontend//template/catalogue/category/view.phtml

<catalog_category_view>
    <reference name="category.products">
        <action method="setTemplate">
            <template>mymodule/catalog/category/view.phtml</template>
        </action>
    </reference>    
</catalog_category_view>

app/design/frontend//template/catalogue/product/view.phtml

<catalog_product_view>
    <reference name="product.info">
        <action method="setTemplate">
            <template>custom/catalog/product/view.phtml</template>
        </action>
    </reference>
</catalog_product_view>
Related Topic