将自定义字段添加到 Ubercart 发票

发布于 2024-09-06 20:36:28 字数 90 浏览 3 评论 0原文

我的客户有一家基于 ubercart 的商店,运作良好。由于一些内部事务,他需要手动向每张发票添加一个字段。我想知道是否或者如何向所有发票上显示的订单添加自定义字段。

My client has an ubercart based shop which works fine. Due to some internal stuff he needs to manually add a field to each invoice. I wanted to know if or rather how i can add a custom field to orders that gets displayed on all the invoices.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

难以启齿的温柔 2024-09-13 20:36:28

这是一个老问题,但这可能对其他人有帮助;您可以使用以下代码。

首先查看位于 ubercart/uc_order/templates 下的 customer.itpl.phpcustomer.itpl.php 文件。

然后,您可以编辑回显所有产品的 foreach 循环,并以这种方式添加您自己的字段:

<?php
     foreach ($order->products as $product) {
         $nid = ($product->nid);
         $noderef = node_load($nid);
         echo $product->title .' : '.$noderef->your_own_field[0]['value'];
         echo "<br />";
?>

我的 Ubercart 安装具有可以从 http://www.mysite.com/admin/content/node- 编辑产品字段类型/产品/字段

您可以找到有关此问题的更多信息。

It's an old question but this may help others; you can use the following code.

First checkout the customer.itpl.php or customer.itpl.php files located under ubercart/uc_order/templates.

Then you can edit the foreach loop that echoes all the products and add your own fields this way:

<?php
     foreach ($order->products as $product) {
         $nid = ($product->nid);
         $noderef = node_load($nid);
         echo $product->title .' : '.$noderef->your_own_field[0]['value'];
         echo "<br />";
?>

My Ubercart installation has the product fields can be edited from http://www.mysite.com/admin/content/node-type/product/fields.

You can find more information on this issue.

幼儿园老大 2024-09-13 20:36:28

我个人没有必要进行此更改,所以我不是根据经验说话,而是查看文档,我会尝试以下操作:(您可以通过修改现有模块来走捷径并避免一些工作,但这是最干净的我能想到的方式)

  1. 创建一个存储您的字段和订单号的模块。
  2. 使用 from_alter 修改发票编辑屏幕,为您的用户提供编辑字段的方法。
  3. 根据订单号,使用发票模板提取您的字段。 发票“系统”文档

这不是一个简单的更改,但使用此模式您将获得所需的修改,而不必担心更新不起作用。

I have not personally had to make this change, so I'm not speaking from experience, but looking at the documentation I would try the following: (you could cut corners and avoid some work by modifying the existing modules, but this is the cleanest way I can think of)

  1. create a module that stores your field and the the order number.
  2. using from_alter modify the invoice editing screen to give your users a way to edit the field.
  3. use the invoice template to pull in your field, based on the order number. invoice "system" documentation.

It's not a simple change, but using this pattern you'll get the modification you are looking for without having to worry about updates not working.

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