Magento – Custom PHTML file not loading via the XML

layouttheme

I am trying to figure out why the checkout/cart/header.phtml is not loading when I am calling it from the xml file. This is a custom xml file called beckin_minicart.xml. Everything loads just fine except the phtml file. Do you see what I am doing wrong here?

<?xml version="1.0" encoding="UTF-8"?>
<layout>

    <default>

        <reference name="head">
         <action method="addJs" ifconfig="minicart/settings/enable"><script>minicart/jquery-1.8.3.js</script></action>
         <action method="addJs" ifconfig="minicart/settings/enable"><script>minicart/cartdropdown.js</script></action>
             <action method="addCss" block="head" ifconfig="minicart/settings/enable"><template>css/minicart/minicart.css</template></action>
        </reference>



    <reference name="header">

        <!-- Quick Cart Dropdown -->
            <block type="checkout/cart_sidebar" name="minicart" template="checkout/cart/header.phtml">
        <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
            <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
        </block>

        </reference>

    <reference name="top.links">
        <remove name="checkout_cart_link"/>
    </reference>

        <remove name="left.permanent.callout"/>
        <remove name="right.permanent.callout"/>
        <remove name="paypal.partner.right.logo"/>
        <remove name="cart_sidebar"/>

    </default>

</layout>

Best Answer

I'm still not 100% sure what you're asking, but looking at your code

<reference name="header">

    <!-- Quick Cart Dropdown -->
        <block type="checkout/cart_sidebar" name="minicart" template="checkout/cart/header.phtml">
    <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
        <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
    </block>

    </reference>

Here you're adding a new block named minicart to the header block. However, the header block is a template block, which means it does not automatically render blocks that have been added to it. You'd need to have a

$this->getChildHtml('minicart');

In your

page/html/header.phtml

template.