2

I am using a separate template file only for one category For that i have set up a separate page layout everything is working fine

content from my page.xml

<page_product_view_brand translate="label">
        <label>Product View (left)</label>
        <reference name="root">
            <action method="setTemplate"><template>page/product_view_brand.phtml</template></action>
            <!-- Mark root page block that template is applied -->
            <action method="setIsHandle"><applied>1</applied></action>


        </reference>
        <reference name="head">
            <action method="removeItem"><type>skin_css</type><name>css/screen.css</name></action>
        </reference>
    </page_product_view_brand>

This page is uses totally different css files. So i want to remove all the css that is loading other than my required ones.

But i am not able to remove the css from my document.What am i doing wrong

EDIT: Two places in page.xml

<block type="page/html_head" name="head" as="head">
 <action method="addCss"><stylesheet>css/screen.css</stylesheet></action>
</block>
.....................
<block type="page/html_customhead" name="customhead" as="customhead">
 <action method="addCss"><stylesheet>css/screen.css</stylesheet></action>
</block>

2 Answers 2

7

You're best of adding any changes to the local.xml to ensure the new rules are processed last.

[...]
<page_product_view_brand>
   <reference name="head">
      <action method="removeItem"><type>skin_css</type><name>css/screen.css</name></action>
   </reference>
   <reference name="customhead">
      <action method="removeItem"><type>skin_css</type><name>css/screen.css</name></action>
   </reference>
</page_product_view_brand>
[...]

Should do the trick

6
  • tried this. but no luck <reference name should be header or head Commented Nov 27, 2013 at 13:38
  • Its still present in the document :( Commented Nov 27, 2013 at 13:53
  • yes. its remoivng when i changed the <page_product_view_brand> to <default> but how to remove it only for that template Commented Nov 27, 2013 at 13:58
  • Im not sure what customhead does but I've updated my answer. please try that Commented Nov 27, 2013 at 15:50
  • Your last update also i tried, but there is no luck. Commented Nov 28, 2013 at 9:52
3

Be sure to put your updates etc inside the <default></default> handle.

You could create simple module and specify a layout update handle for the specific template:

<layout>
    <updates>
        <customtemplate>
            <file>modulename/customtemplate.xml</file>
        </customtemplate>
    </updates>
</layout>

Then in the customtemplate.xml

<?xml version="1.0"?>
<layout>
  <reference name="head">
    <!-- Remove default assets -->
    <action method="removeItem">
    <type>skin_css</type>
    <name>css/whatever.css</name>
    </action>
  </reference>
</layout>

Might seem a bit long winded but should yield the results you want...

1
  • This is not what i want.If i put in <default> it will remove.I want to remove only for one template Commented Nov 28, 2013 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.