如何修改 Magento 订单单以显示自定义产品属性?
我需要在订单单 PDF 上显示产品的附加自定义属性,以便我们的经销商可以找到正确的产品 ID。我们使用 3 种不同类型的 SKU;一个是我们自己的,另一个来自我们的供应商,另一个来自制造商。
我必须更改 Magento 的哪一部分才能添加自定义产品属性?是否有一个扩展可以让我做到这一点,或者我必须编写一些代码吗?
I need to display an additonal custom attribute from a product on the Order Slip PDF so that our distributor can find the proper product id. We have 3 different types of SKUs being used; one is our own, the other is from our supplier and another is from the manufacturer.
Which part of Magento do I have to change in order to add the custom product attribute? Is there an extension that lets me do that or do I have to write some code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我们已经做了一个涵盖所有这些事情的扩展。
您可以:
检查一下,它会诚实地让您的订单处理速度更快,客户看到的“最后一句话”会给他们留下深刻的印象并再次订购!
Magento 定制 PDF:发票、装箱单和提货单
we have made an extension which covers all these things.
You can :
Check it out, it will honestly make your order processing much faster, and the 'final word' that the customer sees will leave them impressed and ordering again!
Magento Customised PDFS : Invoices, Packing Sheets, and PickLists
我不确定是否有人为 PDF 格式编写过任何扩展,大多数人似乎都用他们编写的 PDF 完全替换了它。这是因为 Magento 的 PDF 写得糟糕,并且不适合更改。
如果您找不到修改现有 PDF 的扩展,请围绕它进行计划。
希望有帮助!
谢谢,
乔
I am not sure whether anyone has written any extensions for PDF formatting, most people seem to replace it entirely with a PDF they have written. This is because Magento's PDF writing is terribly written, and not really up for changes.
If you cannot find an extension to modify the existing PDFs, plan around it.
Hope that helps!
Thanks,
Joe
另一个想法 - 正如约瑟夫建议的那样,您可能可以围绕它进行计划...
您可以将额外的数据创建为下拉自定义选项,而不是属性,并且只有一个可能的值设置为默认值。它将显示在产品、购物车、结帐、订单、发票页面和 PDF 上,客户将无法取消选择它。
An additional idea - as Joseph suggested you might be able to plan around it...
Instead of an attribute you can create the extra data as a drop-down custom option, with only one possible value that is set to default. It will show on the product, cart, checkout, order, invoice pages and the PDF and the customer will not be able to deselect it.
查看文件
app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
。其中包含产品输出所需的部分。将文件复制到匹配的目录路径,但在app/code/local
中,这是覆盖和进行编辑的安全方法。您应该能够看到$lines
数组如何用于定位文本。尝试在自定义选项之前或之后插入类似的内容。
当然,您插入的确切位置以及您所说的属性是您的选择。
Look in the file
app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php
. That contains the part necessary for product output. Copy the file to a matching directory path but inapp/code/local
, this is a safe way to override and make edits. You should be able to see how the$lines
array is used for positioning text.Try inserting something like this either just before or just after the custom options.
Exactly where you insert and what you call the attribute is your choice of course.