I trying to add custom js & css only for all category pages.
I create a local.xml
file at app/design/frontend/package/theme/layout/local.xml
& add this code inside it.
< ?xml version="1.0"?>
<layout version="0.1.0">
<catalog_category_default>
<reference name="head">
<action method="addItem">
<type>skin_js</type><name>js/myjavascript.js</name>
</action>
<action method="addItem">
<type>skin_css</type><name>css/mycss.css</name>
</action>
</reference>
</catalog_category_default>
</layout>
But I don't get that files in head section. So my question is how to add custom css & js files for all category pages ?
Best Answer
The category pages can use 2 layout handles depending on the 'is_anchor' flag of the category.
catalog_category_default
is used whenis_anchor
isno
andcatalog_category_layered
is used whenis_anchor
isyes
.But there is one layout handle that is loaded, but magento does not use it in it's files.
<catalog_category_view>
.So you can try with this code: