Magento - 扩展product.info.addtocart以添加新的“添加到购物车按钮”

时间:2013-02-01 03:16:24

标签: magento

我想添加一个新的添加到购物车按钮,就像paypal快速结帐按钮一样。

我设法通过“product.info.extrahint”插入表单,但问题是,当你在catalog.xml中使用它时,它会将你的按钮放在“qty”和“addtocart”按钮的上方。我想要做的是将它添加到catalog.xml中“product.info.addtocart”的末尾

(来自catalog.xml)

 <block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addto.phtml"/>
 <block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml"/>
 <block type="catalog/product_view" name="product.info.extra_buttons" as="extra_buttons" template="mycustomexpresscheckout/pay.phtml" />

添加它会使按钮显示在正确的位置,但这不是paypal express按钮的完成方式。对于paypal express,该按钮被添加到“addtocart”块。事实上,如果我删除该块,我的原始添加到购物车和paypalexpress结帐按钮都消失了。

这是原作:http://www.bounceapp.com/86522

这是我改变catalog.xmlhttp://www.bounceapp.com/86523

的人

任何人都可以协助,或指出我正确的方向吗?

Magento 1.6 - 默认模板

2 个答案:

答案 0 :(得分:1)

您可以在 product.info.addtocart 中包含 product.info.extra_buttons

<block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addto.phtml"/>
     <block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml">
     <block type="catalog/product_view" name="product.info.extra_buttons" as="extra_buttons" template="mycustomexpresscheckout/pay.phtml" />
</block>

之后,您需要将addtocart.phtml内的子阻止(product.info.extra_buttons)称为$this->getChildHtml('extra_buttons');

答案 1 :(得分:0)

在您的local.xml的{​​{1}}节点下,放置以下代码,它应该可以工作:

<catalog_product_view>

对我来说,它无需在<reference name="product.info.addtocart"> <block type="catalog/product_view" name="product.info.extra_buttons" as="extra_buttons" template="mycustomexpresscheckout/pay.phtml" /> </reference> 中添加getChildHtml('extra_buttons')即可正常工作。希望能为您服务...