I need to add css file to shopping cart page. But it should only added to the that page. Is it possible to do this?
2 Answers
you can add this xml code in your local.xml it will add css only for cart page
<checkout_cart_index translate="label">
<reference name="head">
<action method="addCss">
<stylesheet>css/style.css</stylesheet>
</action>
</reference>
</checkout_cart_index>
Magento is create a unique handler
whenever the cart page is rendered.For cart page,the handler is checkout_cart_index
. and the this handler a use of Mage_Page_Block_Html_Head
class's addCss()
function you can add css file.
How to use this at layout files ,you can try Qaisar Satti Answer
In each page,magento is create a handler which value is same as front Controller Full Action Name (
Mage::app()->getFrontController()->getAction()->getFullActionName()
).
Format:
<'Handler_Name' translate="label"> <reference name="head"> <action method="addCss"> <stylesheet>css/style.css</stylesheet> </action> </reference> </'Handler_Name'>