Tuesday 3 April 2012

Magento :: add or remove javascript files to your template

Following  lines will be helping for you if you’r trying to add some javascript file to your custom theme. 

As per your requirements, you’ll need to see in which layout file you want to call your js file and simply put this line there:

<action method=”addItem”><type>skin_js</type><name>js/product.js</name></action>

Above line will try to find the product.js file under /skin/frontend/default/Your_Theme/js /product.js

Similarly you can remove a default javascript file by putting this line in your layout file:

<action method=”removeItem”>   <type>js</type>   <name>varien/product.js</name>   <params />   </action>

Hope this will be helping someone for fighting against Magento.

No comments:

Post a Comment