OpenCart -如果订单状态已发货,希望在发票中添加注释



我试了很多次,但都没有成功。

In openart order admin -> Any order -> History.

可以看到下面的字段:

  1. 订单状态(处理、已处理、已发运等)
  2. 通知客户
  3. 论>

问题:

截至目前只有客户评论被发布,当我们点击打印发票(如果客户评论存在)

在order_invoice中的代码。tpl (admin 视图模板 销售)

         <?php if ($order['comment']) { ?>
  <table class="comment">
    <tr class="heading">
      <td><b><?php echo $column_comment; ?></b></td>
    </tr>
    <tr>
      <td><?php echo $order['comment']; ?></td>
    </tr>
  </table>    

我还想显示评论时,管理员选择"发货"在订单状态。

如果order_status=shipped,则在order_invoice.tpl中显示admin的注释

因为当管理员在订单状态中选择SHIPPED并在评论中填写跟踪号时,跟踪号将在INVOICE中可见,这将有助于客户保留跟踪证明。

我认为在openart中有两个变量order_statusorder_status_id

我不知道这些的确切格式和链接…你能帮我一下吗?

Thanks in advance

试试这个,

首先修改控制器(/admin/controller/sale/order.php)中的数据数组,添加order_status_id和admin comments/history:

$this->data['orders'][] = array(
  'order_id'             => $order_id,
  'invoice_no'         => $invoice_no,
  'date_added'         => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
  'store_name'         => $order_info['store_name'],
  'store_url'          => rtrim($order_info['store_url'], '/'),
  'store_address'      => nl2br($store_address),
  'store_email'        => $store_email,
  'store_telephone'    => $store_telephone,
  'store_fax'          => $store_fax,
  'email'              => $order_info['email'],
  'telephone'          => $order_info['telephone'],
  'shipping_address'   => $shipping_address,
  'shipping_method'    => $order_info['shipping_method'],
  'payment_address'    => $payment_address,
  'payment_company_id' => $order_info['payment_company_id'],
  'payment_tax_id'     => $order_info['payment_tax_id'],
  'payment_method'     => $order_info['payment_method'],
  'product'            => $product_data,
  'voucher'            => $voucher_data,
  'total'              => $total_data,
  'comment'            => nl2br($order_info['comment']),
  'status'             => $order_info['order_status_id'],
  'admin_comments'     => $this->model_sale_order->getOrderHistories($order_id)
);

然后在order_invoice的末尾。您可以在TPL视图中添加以下内容:

  <?php if ($order['status'] == 3) { ?>
  <table class="comment">
    <tr class="heading">
      <td><b><?php echo $column_comment; ?></b></td>
    </tr>
    <?php foreach ($order['admin_comments'] as $admin_comment) { ?>
        <?php if ($admin_comment['status'] == 'Shipped') { ?>
           <tr>
                <td><?php echo $admin_comment['comment']; ?></td>
           </tr>
        <?php } ?>
    <?php } ?>
  </table>
  <?php } ?>
</div>
<?php } ?>
</body>
</html>

order_status_id == 3正在发货

最新更新