Trouble displaying a custom block under the default cart block on the checkout/cart page

StackOverflow https://stackoverflow.com/questions/17450549

  •  02-06-2022
  •  | 
  •  

Question

I have a custom block which I am trying to add below the default/template/checkout/cart.phtml on the checkout cart page.

I have block displaying using local.xml as follows:

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

<layout>
    <default>
        <reference name="checkout.cart">
            <reference name="content">

                    <block type="module/checkoutextras" name="checkoutextras" as="extras" template="fracture/module/checkoutextras.phtml" after="content" />

            </reference>
        </reference>
    </default>
</layout>

the problem is that it's appearing above the cart.phtml, basically it appears to be ignoring the after="content" in the block definition, it also doesn't move if I use after="-".

The relevant part of checkout.xml looks like this:

<checkout_cart_index translate="label">
        <label>Shopping Cart</label>
        <remove name="right"/>
        <remove name="left"/>
        <!-- Mage_Checkout -->
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="checkout/cart" name="checkout.cart">
                <action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
                <action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
                <action method="chooseTemplate"/>
                <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/item/default.phtml</template></action>
                <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/item/default.phtml</template></action>
                <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/item/default.phtml</template></action>

                <block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
                    <label>Payment Methods Before Checkout Button</label>
                    <block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
                </block>

                <block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
                    <label>Shopping Cart Form Before</label>
                </block>

                <block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
                    <label>Payment Methods After Checkout Button</label>
                    <block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
                    <block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
                </block>

                <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
                <block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>

                <block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml">
                <block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>
                </block>
            </block>
        </reference>
        <block type="core/text_list" name="additional.product.info" translate="label">
            <label>Additional Product Info</label>
        </block>
    </checkout_cart_index>

I must be missing something, but i've even tried after="checkout.cart", and adding the block directly to but in both cases the block won't render, it only renders if the content reference is included, but in the wrong place. How can I update local.xml so that the checkoutextras block will render below the cart?

Was it helpful?

Solution

This should work :

<?xml version="1.0"?>
<layout>
    <checkout_cart_index><!-- You just need to update the layout for the cart page, so you can use the corresponding action name -->
        <reference name="content"><!-- A single reference to the wrapping "content" block is enough (you want to put content below the cart, not inside) -->
            <block type="module/checkoutextras" name="checkoutextras" as="extras" template="fracture/module/checkoutextras.phtml" after="-" />
        </reference>
    </checkout_cart_index>
</layout>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top