The CodeBlaster
The CodeBlaster

Reputation: 137

How to add total cart weight to invoice in opencart?

i am developing an ecommerce website on opencart 1.5.6. site is almost ready but i stuck on 1 point. for example i have 4 product in my cart with weight 100gram each. I already add the weight column in invoice for each product. but now i want to show the total weight of cart or the sum of the all products weight. i got the ref. for adding weight from here : http://www.opencartaz.com/opencart/-vqmod-add-weight-to-invoice.html

Here is the screenshot attached.

enter image description here

please help me.

Upvotes: 0

Views: 1531

Answers (1)

Richard Parnaby-King
Richard Parnaby-King

Reputation: 14892

You are using vqmod?

Search in the file admin/view/template/sale/order_invoice.tpl for <?php foreach ($order['voucher'] as $voucher) { ?>.

Set the position to before and add:

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

This will add the total product weight between the list of products and the vouchers.

Upvotes: 1

Related Questions