Magento – Removing Header and Footer from Popup

layoutlocal.xmlpopuptheme

With the reference from my yesterday question CODE, now I am able to show the send mail to friend in a popup with the below code in test.phtml( set it via local.xml)

test.phtml

<?php if ($this->canEmailToFriend()): ?>
    <li><a href='#' onclick="return showCompare('<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>');" class="link-email-friend" title="<?php echo $this->__('Email to a Friend') ?>"><?php echo $this->__('Email to a Friend') ?></a></li>
<?php endif; ?>

JS code( test.phtml)

<script type="text/javascript">
    function showCompare(url){
    win = new Window({ title: "Compare Products", url:url, zIndex:3000, destroyOnClose: true, recenterAuto:false, resizable: false, width:450, height:473, minimizable: false, maximizable: false, draggable: false});
    win.showCenter(true);
    }
</script> 

Now the pop up is shown , but with whole page layout ie Header & Footer showing up, so I want here is to REMOVE the Header & Footer,

So After a careful inspection, I found out the particular block is residing in

frontend/base/default/layout/sendfriend.xml

So What I did here is created a local.xml file to override( Header & Footer), with the below code

<layout version="0.1.0">
    <sendfriend_product_send translate="label">
        <label>Catalog Product Email to a Friend</label>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
        <reference name="head">
            <action method="addJs"><script>varien/product.js</script></action>
        </reference>
        <reference name="root">
            <remove name="header"/>
            <remove name="footer"/>
        </reference>
        <reference name="content">
            <block type="sendfriend/send" name="sendfriend.send" template="sendfriend/send.phtml" />
        </reference>
    </sendfriend_product_send>
</layout>

But unfortunately its not working , but when I place the same piece of code in sendfriend.xml, it works (removing Header & Footer).

I am a bit lost, as how I am gonna put things up her, I mean how to do this in a standard way ?

Best Answer

The local.xml file must be in the directory of the actual theme you are using, i.e.

app/design/frontend/[package]/[theme]/layout

Multiple local.xml files in the fallback hierarchy are not taken into account. The first of these that can be found, is used:

app/design/frontend/[package]/[theme]/layout/local.xml
app/design/frontend/[package]/default/layout/local.xml
app/design/frontend/base/default/layout/local.xml

(assuming default hierarchy and no custom defined hierarchy)