Magento - container1和container2的拆分选项

时间:2012-09-06 09:20:47

标签: html magento magento-1.7 php

在默认布局中,选项和添加到购物车按钮由

调用
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>

我想从添加到购物车和数量字段中拆分可配置选项,以便在我的布局中的不同位置显示它们。任何想法或随时可以使用的解决方法?

2 个答案:

答案 0 :(得分:1)

你可以很容易地拆分它(但是我花了很多时间才找到它:)) - 如果你看一下 app / code / core / Mage / Core / Block / Abstract.php 对于公共函数getChildChildHtml 的PHPDoc,您将看到第二个参数确定子块名称。因此,您可以在价格区块呈现之前先调用

<?php echo $this->getChildChildHtml('container1', 'product.info.options.wrapper', true, true) ?>

在价格块呈现后,调用

<?php echo $this->getChildChildHtml('container1', 'product.info.options.wrapper.bottom', true, true) ?>

答案 1 :(得分:0)

虽然您的最终解决方案将取决于您需要在布局中移动/插入这些块的位置,但您绝对可以将“添加到购物车”product.info.options.wrapper.bottom从可配置选项product.info.container1或{{ 1}}像这样:

product.info.container2

然后单独显示“添加到购物车”按钮的最简单方法是在<catalog_product_view> <reference name="product.info.container1"> <action method="unsetChild"><name>product.info.options.wrapper.bottom</name></action> </reference> <reference name="product.info.container2"> <action method="unsetChild"><name>product.info.options.wrapper.bottom</name></action> </reference> </catalog_product_view> 中注释掉条件,这样可以显示catalog/product/view.phtml块是否有产品选项:< / p>

product.info.addtocart

希望这有助于您了解这些块的结构。其他可能有用的资源:

相关问题