1

I have created a local.xml file in folder:

/app/design/frontend/default/MAG090172/layout

Code:

<?xml version="1.0" encoding="UTF-8" ?> 
<layout> 
<checkout_cart_index> 
   <remove name="checkout.cart.shipping" /> 
</checkout_cart_index> 
<checkout_cart_index>
        <reference name="content">
            <block name="checkout.cart">
                <remove name="checkout.cart.coupon"/>
            </block>
        </reference>
    </checkout_cart_index>
</layout>

* Unfortunately, it's NOT removed the 2 blocks from Shopping Cart Page .

Is the file in correct folder ? Is syntax of code correct ?

Pls help.

2
<?xml version="1.0" encoding="UTF-8" ?>
<layout>
    <checkout_cart_index>
        <reference name="content">
            <remove name="checkout.cart.shipping"/>
            <remove name="checkout.cart.coupon"/>
        </reference>
    </checkout_cart_index>
</layout>
  • -still NOT working with your code. Even cleared all caches. – Mave Jul 11 '14 at 8:04
  • paste your xml file code – Pradeep Sanku Jul 11 '14 at 8:13
  • <?xml version="1.0" encoding="UTF-8" ?> <layout> <checkout_cart_index> <!-- Removes estimate shipping and cost on cart page --> <reference name="content"> <block name="checkout.cart"> <remove name="checkout.cart.shipping"/> <remove name="checkout.cart.coupon"/> </block> </reference> </checkout_cart_index> <layout> – Mave Jul 11 '14 at 8:18
  • Snapshot link: s30.postimg.org/fy2fhwbwh/cpanel.png – Mave Jul 11 '14 at 8:22
  • its is not layout.xml it should be local.xml.check spelling – Pradeep Sanku Jul 11 '14 at 8:31
2

Just for the record, a year late, without the reference name this worked for me

<checkout_cart_index>  
        <remove name="checkout.cart.coupon"/>       
</checkout_cart_index>  

I think this is because the cart is not in the normal body structure and has its own references

0

From \Mage_Core_Model_Layout::generateXml():

There is not much preference where to place the remove element, as long as it is part of the update, within the XML generation all remove elements regardless where in the document count (//remove).

If the remove element does not have a name attribute, it's ignored.

If you inject xpath improperly via that name attribute string value, the remove element would be ignored. This is not the case in your question.

Next to block elements, also reference elements are checked for the name. Here an improper xpath injection would not ignore the remove element.

All matching nodes ((//block|//reference)[@name='<name>']) not having yet an ignore attribute and not explicitly allowed via their acl attribute will get the ignore attribute set to the string value "1".

To summarize:

Either the block and reference elements you name with your remove elements aren't defined in the update XML so far (your module must depend on the module which blocks you name here) or the block and reference elements you're referring to can't be removed (e.g. they have the ignore attribute already set to a non-true value). Another possibility is that the blocks you're removing have been already generated (\Mage_Core_Model_Layout::generateBlocks()), then it's too late to remove them. Most likely the first or the last is the case.

What you describe can also be the issue that the update handle isn't in use.

You can quickly troubleshoot these issues by making use of xpath injection from within the layout file. If a layout file has "grip", the following XML document will disable all blocks and references that can be ignored:

<?xml version="1.0"?>
<layout>
    <default>
        <remove name="'='"/>
    </default>
</layout>

With this little piece of code you can first of all test if the file is in use. If the file is in use (has grip) and as it contains the default handle, it will remove all blocks, so you see a blank page.

Then you can change <default> to the handle you'd like to test. If the handle still has grip, you will again see the blank page.

So the final test then is to change the name to the name of the block you'd like to remove. If it isn't removed, then the name of the block is wrong and/or you're removing it before it was in there.

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.