无法在结帐/购物车页面的默认购物车区块下显示自定义区块

时间:2013-07-03 14:19:41

标签: magento magento-1.4

我有一个自定义块,我想在结帐购物车页面上的默认/ template / checkout / cart.phtml下添加。

我使用local.xml阻止显示如下:

<?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>

问题是它出现在cart.phtml之上,基本上它似乎忽略了块定义中的after =“content”,如果我使用after =“ - ”后它也不会移动。

checkout.xml的相关部分如下所示:

<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>

我必须遗漏一些东西,但我甚至试过=“checkout.cart”,并直接添加块,但在这两种情况下块都不会渲染,它只会渲染内容引用是否包括在内,但是在错误的地方。如何更新local.xml以便checkoutextras块将呈现在购物车下方?

1 个答案:

答案 0 :(得分:4)

这应该有效:

<?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>