【问题标题】:OpenCart - Want to add comments in invoice if order status is shippedOpenCart - 如果订单状态已发货,想要在发票中添加评论
【发布时间】:2014-03-14 13:00:36
【问题描述】:

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

在 opencart 订单管理 -> 任何订单 -> 历史记录。

我们看到以下字段:

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

问题:

目前只有客户 cmets在我们点击 PRINT INVOICE 时发布(如果客户 cmets 存在)

order_invoice.tpl (admin\view\template\sale) 中的代码

         <?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>    

我还想在管理员在订单状态中选择“已发货”时显示 cmets。

如果 order_status=shipped 然后在 order_invoice.tpl 中由管理员显示 cmets

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

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

我不知道这些的确切格式和链接...您能帮我解决这个问题吗?

提前致谢

【问题讨论】:

    标签: php opencart


    【解决方案1】:

    试试这个,

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

    $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 正在发货。

    【讨论】:

    • 非常感谢您的回复。虽然它适用于订单状态 = 已发货,但如果订单状态 = 已发货,它还会显示该特定订单的先前 cmets。假设现在 Order_status = 为订单 XYZ 发货。订单 XYZ 的先前状态(正在处理:处理 cmets)(已处理:已处理 cmets)(已发货:运送 cmets)。我只想在 XYZ 的订单状态标记为已发货时才显示其运送 cmets。截至目前,它显示了 order_status=shipped 订单的所有 3 个处理 cmets、已处理 cmets、运输 cmets。谢谢
    • 感谢您的回复。我试过上面的代码。它只显示文本:评论:。但是实际的管理员 cmets 并没有显示为哪个订单状态发货。你能再看看吗。谢谢
    • 你能不能试试 order_invoice.tpl 的更新代码,然后发回输出的内容
    • 带字符串的奇数输出...-> 评论 [通知] => 1 ) 数组 ( [date_added] => 2014-03-14 10:28:18 [status] => 已发货 [评论] => EP123456789OK [notify] => 1) 欺诈行为:review Is International:true 交易响应消息:交易成功 交易响应代码:SUCCESS 交易状态:SUCCESS Array ( [date_added] => 2014-03-14 10: 26:24 [status] => 处理 [comment] => Transaction Id: PZT14031415545524814 .........首先它显示 order_status=shipped cmets,而不是其他 cmets
    • 非常感谢 jx12345...你说应该可以...它有效..:-)
    猜你喜欢
    • 2023-04-03
    • 2021-09-16
    • 2023-03-06
    • 2014-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-05
    • 2017-07-18
    相关资源
    最近更新 更多