【发布时间】:2012-10-01 12:11:01
【问题描述】:
在捆绑产品的每件商品之后,我在 Magento 的 pdf 发票中得到价格,在我的情况下为 0.00 美元,我该如何删除它? 我发现产品是由 $this->_drawItem($item, $page, $order); 写的在 Invoice.php 中
如何从我的 pdf 发票中删除 0.00 美元?
非常感谢!
【问题讨论】:
-
你有什么magento版本?
在捆绑产品的每件商品之后,我在 Magento 的 pdf 发票中得到价格,在我的情况下为 0.00 美元,我该如何删除它? 我发现产品是由 $this->_drawItem($item, $page, $order); 写的在 Invoice.php 中
如何从我的 pdf 发票中删除 0.00 美元?
非常感谢!
【问题讨论】:
配置中定义的每种产品类型的渲染器。默认渲染器和分组产品类型在app/code/core/Mage/Sales/etc/config.xml中定义:
<pdf>
<invoice>
<default>sales/order_pdf_items_invoice_default</default>
<grouped>sales/order_pdf_items_invoice_grouped</grouped>
</invoice>
...
</pdf>
app/code/core/Mage/Bundle/etc/config.xml中的捆绑产品类型:
<pdf>
<invoice>
<bundle>bundle/sales_order_pdf_items_invoice</bundle>
</invoice>
...
</pdf>
对应的型号是Mage_Bundle_Model_Sales_Order_Pdf_Items_Invoice
您可以在您的 local 命名空间中创建自己的渲染器扩展此模型,复制并更改 draw() 方法并在您的配置文件中定义此渲染器。
【讨论】:
您需要查看 Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option 并修改 getPrice 函数,但要正确执行此操作需要重写类,这完全是另一个主题。重写的一个很好的起点是这样的参考:http://codemagento.com/2011/02/rewriting-a-block-class/
【讨论】: