Magento 在签出/购物车页面的默认购物车块下显示自定义块时出现问题
我有一个自定义块,我正在尝试将其添加到checkout cart页面上的default/template/checkout/cart.phtml下面 我使用local.xml进行块显示,如下所示:Magento 在签出/购物车页面的默认购物车块下显示自定义块时出现问题,magento,magento-1.4,Magento,Magento 1.4,我有一个自定义块,我正在尝试将其添加到checkout cart页面上的default/template/checkout/cart.phtml下面 我使用local.xml进行块显示,如下所示: <?xml version="1.0" encoding="UTF-8"?> <layout> <default> <reference name="checkout.cart"> <referen
<?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=内容,如果使用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>
我肯定遗漏了什么,但我甚至尝试了after=checkout.cart,并将块直接添加到,但在这两种情况下,块都不会渲染,它仅在包含内容引用的情况下渲染,但在错误的位置。如何更新local.xml以使checkoutextras块呈现在购物车下方?这应该可以:
<?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>
这应该起作用:
<?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>
感谢bImage,它工作得非常完美,你不会相信我花了多长时间摆弄layout.xml试图让它工作!干杯但愿我有更多的声誉,这样我就可以投票支持你的答案了!。感谢bImage,它工作得非常完美,你不会相信我花了多长时间摆弄layout.xml试图让它工作!干杯但愿我有更多的声誉,这样我就可以投票支持你的答案了!。