如何修改 Magento 订单单以显示自定义产品属性?

发布于 2024-09-29 04:49:41 字数 172 浏览 3 评论 0原文

我需要在订单单 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

Oo萌小芽oO 2024-10-06 04:49:42

我们已经做了一个涵盖所有这些事情的扩展。

您可以:

  • 以多种格式显示多个自定义属性,甚至过滤它们
  • 输出高度定制的发票、装箱单或提货单
  • 生成 PDF,无论订单状态如何

检查一下,它会诚实地让您的订单处理速度更快,客户看到的“最后一句话”会给他们留下深刻的印象并再次订购!

Magento 定制 PDF:发票、装箱单和提货单

we have made an extension which covers all these things.

You can :

  • show multiple custom attributes, in multiple formats, and even filter them
  • output a highly-customised invoice, packing slip, or pick list
  • produce the PDFs no matter what the order status is

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

谜兔 2024-10-06 04:49:42

我不确定是否有人为 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

爱你不解释 2024-10-06 04:49:42

另一个想法 - 正如约瑟夫建议的那样,您可能可以围绕它进行计划...

您可以将额外的数据创建为下拉自定义选项,而不是属性,并且只有一个可能的值设置为默认值。它将显示在产品、购物车、结帐、订单、发票页面和 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.

时光与爱终年不遇 2024-10-06 04:49:41

查看文件 app/code/core/Mage/Sales/Model/Order/Pdf/Items/Invoice/Default.php。其中包含产品输出所需的部分。将文件复制到匹配的目录路径,但在 app/code/local 中,这是覆盖和进行编辑的安全方法。您应该能够看到 $lines 数组如何用于定位文本。

尝试在自定义选项之前或之后插入类似的内容。

// The quote item doesn't have any product attributes, it is only a quote!
$product = Mage::getModel('catalog/product')->load($item->getProductId());
// Use the actual product object to add a new line.
$lines[][] = array(
    'text' => Mage::helper('core')->__('Manufacturer SKU: ') . $product->getManufacturerSku(),
    'feed' => 35
);

当然,您插入的确切位置以及您所说的属性是您的选择。

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 in app/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.

// The quote item doesn't have any product attributes, it is only a quote!
$product = Mage::getModel('catalog/product')->load($item->getProductId());
// Use the actual product object to add a new line.
$lines[][] = array(
    'text' => Mage::helper('core')->__('Manufacturer SKU: ') . $product->getManufacturerSku(),
    'feed' => 35
);

Exactly where you insert and what you call the attribute is your choice of course.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文