2015-02-06 52 views
0

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

下面是附加的截图。

enter image description here

请帮助我。

+0

这将有助于显示您已经拥有什么特定点,或者您希望使用输入变量 – JammyDodger231 2015-02-06 10:38:24

+0

来运行代码的具体点,但是如何将总重量纳入发票模板。 – 2015-02-06 10:45:41

回答

1

您正在使用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> 

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

+0

我用这个代码,但它只显示0kg的重量。你可以看到上面的截图。 – 2015-02-06 12:51:12

+0

@TheCodeBlaster我已经更新了我的答案。 – 2015-02-06 13:09:57

+0

@ Richard Parnaby-King谢谢。有用。我修改它符合产品数量。 – 2015-02-07 07:25:04

相关问题