3

i have a custom css for specific page which is category product page, i want to include this css only when i load this page, as i know the page is located in theme/default/template/catalog/category/page.phtml, is there any way to do this ?

basically i have to include it like this in my phtml:

<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl('style/reset.css'); ?>" />
5
  • means you wanna load this css on specific category ?? Mar 30 '17 at 4:30
  • @MurtuzaZabuawala no, i just need to load this css in category page
    – simple guy
    Mar 30 '17 at 4:31
  • means on every category page ?? Mar 30 '17 at 4:32
  • @MurtuzaZabuawala yes, need to load in frontend/theme/default/template/catalog/category/page.phtml
    – simple guy
    Mar 30 '17 at 4:35
  • Is that CMS Page
    – Magento 2
    Mar 30 '17 at 6:00
3

For display css on category page. please follow as below

put your css file in your theme

ex . skin/frontend/YourPackage/YourTheme/css/yourcssname.css

in your theme's local.xml located in app/design/frontend/YourPackage/YourTheme/layout/local.xml

Put below code in layout node.

<catalog_category_default>
    <reference name="head">
        <action method="addItem"><type>skin_css</type><name>yourcssname.css</name></action>
    </reference> 
</catalog_category_default>
<catalog_category_layered>
    <reference name="head">
        <action method="addItem"><type>skin_css</type><name>yourcssname.css</name></action>
    </reference> 
</catalog_category_layered>
10
  • i've added it below <layout> tag and its not working
    – simple guy
    Mar 30 '17 at 5:10
  • Have you put your css in skin folder ?? Mar 30 '17 at 5:14
  • Yes i already put it and remove var/cache
    – simple guy
    Mar 30 '17 at 5:43
  • GIve me full path of your css and also give me the code which is in local.xml that you added Mar 30 '17 at 5:47
  • <action method="addItem"><type>skin_css</type><name>category-products.css</name></action>
    – simple guy
    Mar 30 '17 at 5:57

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.