0

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>
5
  • Not sure if this changes something but add an as attribute on the block element: block type="checkout/cart_sidebar" name="minicart" as="minicart" template="checkout/cart/header.phtml">...</block>
    – Marius
    Commented Jul 23, 2013 at 19:39
  • Thanks! Just tried that but still no luck. Everything in the layout executes except loading that file. Not sure if it makes any difference but this is a new install and is located in the base/default folder?
    – user693
    Commented Jul 23, 2013 at 20:07
  • Do you see anything in the var/log folder related to this? (assuming you have the logging activated).
    – Marius
    Commented Jul 24, 2013 at 6:58
  • @tech0925 What makes you think the template isn't being loaded? (Alternate question — what code is in your custom checkout/cart/header.phtml template?) Commented Jul 24, 2013 at 21:33
  • Hello @Alan. Because the HTML contained in the header.phtml file is not in the loaded HTML. @Marius, I actually haven't checked the logs. Maybe that will tell me something.
    – user693
    Commented Jul 25, 2013 at 0:44

1 Answer 1

1

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.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.