Magento – Remove newsletter just from checkout page

checkoutnewsletter

I want to remove newsletter just from checkout page and i search about it and try these codes but i don't get any result.

I add below code in local.xml in app\design\frontend\default\my-theme\layout\local.xml but nothing changed !!!

<checkout_onepage_index>
    <remove name="footer.newsletter"/>
</checkout_onepage_index>

Also i try this code in checkout.xml in app\design\frontend\default\base\default\layout\checkout.xml but again nothing changed !!!

<checkout_onepage_index translate="label">
<remove name="footer.newsletter"/>
</checkout_onepage_index>

thanks for help.

EDIT:

I check my code again when i add below code in checkout.xml, newsletter remove from all pages, why?

<checkout_cart_index translate="label">
    <remove name="footer.newsletter"/>
</checkout_cart_index>

EDIT2:
This is the code of local.xml that show newsletter box:

<reference name="footer">
    <remove name="cms_footer_links"/>
    <remove name="footer_links2"/>
    <block type="newsletter/subscribe" name="footer.newsletter" as="footerNewsletter"
           template="newsletter/subscribe-footer.phtml"/>                       
</reference>

EDIT3:

I search this subject again and understand that i should make my directory and copy files that i want to change them, but when i copy checkout.xml and change it to what i want nothing will be happen, because i should change the Current package namein admin panel but if i set my directory for current package name all things will mess!!! I really confused and don't know how can i solve this problem!

Thanks for help.

Best Answer

It would appear that you have it rendering in two places: left.newsletter and footerNewsLetter.

So try

<checkout_cart_index>
        <remove name="footerNewsletter"/>
</checkout_cart_index>

<checkout_cart_index>
        <remove name="left.newsletter"/>
</checkout_cart_index>

local.xml belongs under a theme in your package like so:

app\design\frontend\my-theme\default\layout\local.xml

You also should reference the parent block the newsletter was declared in.

<checkout_cart_index>
    <reference name="footer">
        <remove name="footer.newsletter"/>
    </reference>
</checkout_cart_index>

UPDATE

Magento looks first for files in here app/design/frontend/custom_package/custom_theme/

then it looks for files in here app/design/frontend/custom_package/default

then it looks in here app/design/frontend/base/default

It will also look in the currently configured theme hierarchy for a local.xml

UPDATE

In your local.xml you are giving the block an alias footerNewsletter, you could also use that in your remove statement. Also like Amit says in his more precise answer, you should be using the cart controller in your layout update.

<checkout_cart_index>
    <reference name="footer">
        <remove name="footerNewsletter"/>
    </reference>
</checkout_cart_index>

UPDATE

If you are unsure of how Magento's Theme Hierarchy works, I would suggest reading through the knowledge base article on the subject

You can set your package to be live on the site by going to System -> Configuration -> Design. Then use your custom_package name

Related Topic