我尝试替换默认的折扣区块。不幸的是,块总是位于容器的底部。我不能把它移到默认的区块位置。
我的xml -
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<remove name="checkout.cart.coupon"/>
<referenceContainer name="cart.discount">
<block class="{namespace}\Coupons\Block\Coupon" name="checkout.cart.coupon2" as="sadasdasd" template="test.phtml"/>
</referenceContainer>
<move element="cart.discount" destination="checkout.cart.container" before="checkout.cart.order.actions.gift_options" />
</body>
</page>结果屏幕-

发布于 2015-08-11 14:49:00
我认为checkout.cart.order.actions.gift_options不是checkout.cart.container的直接子级,所以“之前”子句并不是查找您想要的位置,而是默认使用“最后一个子级”作为默认行为。
https://stackoverflow.com/questions/31879264
复制相似问题