I'm trying to remove the jcarousel script (it is located in js/ folder and not skin/ folder) from the category page. This script is added in local.xml file of my theme:

<action method="addJs"><script>hellothemes/jquery.jcarousel.min.js</script></action>

Now, I add this row in the <default> tag of catalog.xml:

<reference name="head">
 <action method="removeItem"><type>js</type><name>hellothemes/jquery.jcarousel.min.js</name></action>

but nothing changes.

Any solution?

  • see my answer here it my help magento.stackexchange.com/questions/55468/… Jun 17 '15 at 15:40
  • if this script is used on the home page you can do something wrap it in this <?php if( Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' ) : ?> // Put your Script here. <?php endif; ?> Jun 17 '15 at 15:42
  • I understand your idea but Magento provides the possibility to add/remove css/js in any layout pages and I'd like to follow this solution.
    – WaPoNe
    Jun 17 '15 at 16:17
  • see may answer it is working for me change <type>js</type> to <type>skin_js</type> Jun 17 '15 at 16:19
  • I've tried it and it has not worked but do attention: if you use skin_js you're saying to Magento to find the file into skin/ folder instead of js/ (as my case)
    – WaPoNe
    Jun 17 '15 at 16:24

Add JS :

<action method="addItem"><type>skin_js</type><name>js/owl.carousel.js</name></action>

Remove JS :

<action method="removeItem"><type>skin_js</type><name>js/slideshow.js</name></action>

Add js files into hellothemes/js


The issue seems to be with the layout handles specified although pspahn's answer is correct his layout handle is wrong.

I'm quoting marius from the following link to help you further understand the differences in the catalog category layout handles

Difference between <catalog_category_default> and <catalog_category_view>

catalog_category_view is loaded for all the category pages. It's the default layout handler for the category page. The category page maps to the catalog module, category controller, view action.

catalog_category_default is loaded only for categories that are not marked as anchors. There is also a layout handle called catalog_category_layered that is loaded for categories marked as anchor.

Try the following code its a modification of pspahn's answer. <layout> <default> <reference name="head"> <action method="addJs"> <file>your/file.js</file> </action> </reference> </default> <catalog_category_default> <reference name="head"> <action method="removeItem"> <type>js</type> <file>your/file.js</file> </action> </reference> </catalog_category_default > <catalog_category_layered> <reference name="head"> <action method="removeItem"> <type>js</type> <file>your/file.js</file> </action> </reference> </catalog_category_layered > </layout>


If you're adding this file through your local.xml layout, you will want to remove it here also since it is loaded after catalog.xml.


        <reference name="head">
            <action method="addJs">
        <reference name="head">
            <action method="removeItem">
  • Hi pspahn, you're right.. local.xml is loaded after catalog.xml so I tried adding this code in local.xml file: <catalog_category_default translate="label"> <reference name="head"> <action method="removeItem"><type>js</type><name>hellothemes/jquery.jcarousel.min.js</name></action> </reference> </catalog_category_default> but it doesn't work again! In the source code I read: <script src="mysite/js/hellothemes/jquery.jcarousel.min.js" type="text/javascript"> Why?
    – WaPoNe
    Jun 18 '15 at 8:09
  • I typed this from memory -- catalog_category_index should be catalog_category_view
    – pspahn
    Jun 18 '15 at 16:07

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.