如何将购物车总重量添加到 opencart 中的发票?

How to add total cart weight to invoice in opencart?

我正在 opencart 1.5.6 上开发电子商务网站。网站快准备好了,但我坚持了 1 点。 例如,我的购物车中有 4 件产品,每件重 100 克。我已经在每个产品的发票中添加了重量列。但现在我想显示购物车的总重量或所有产品重量的总和。 我得到了裁判。从这里增加重量: http://www.opencartaz.com/opencart/-vqmod-add-weight-to-invoice.html

附上截图。

请帮帮我

您正在使用 vqmod 吗?

在文件 admin/view/template/sale/order_invoice.tpl 中搜索 <?php foreach ($order['voucher'] as $voucher) { ?>

将位置设置为之前并添加:

<tr>
  <td align="right" colspan="4"><b>Total Weight:</b></td>
  <td align="right"><?php 
    $total_weight = 0;
    foreach($order['product'] as $product) {
      $total_weight += $product['weight'];
    }
    echo $total_weight;
  ?></td>
  <td> </td>
</tr>

这将在产品列表和优惠券之间添加产品总重量。