代码之家  ›  专栏  ›  技术社区  ›  nocksock

向Ubercart发票添加自定义字段

  •  6
  • nocksock  · 技术社区  · 15 年前

    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.

    2 回复  |  直到 12 年前
        1
  •  4
  •   akarpovsky    12 年前

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

    首先结账 customer.itpl.php 客户.itpl.php 文件位于 ubercart/uc_order/templates .

    然后,您可以编辑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-type/product/fields .

    您可以在 this issue .

        2
  •  0
  •   mirzu    15 年前

    我个人不需要做这种改变,所以我不是根据经验来谈,而是看一下我要尝试的文档:(您可以通过修改现有模块来减少一些工作,但这是我能想到的最干净的方法)

    1. 创建一个存储字段和订单号的模块。
    2. 使用“修改发票编辑”屏幕,为用户提供编辑字段的方法。
    3. 根据订单号,使用发票模板拉入您的字段。 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.