Re: Total weight of all products on the Invoice
Basically you need to add the following function to func.php
function func_my_total_weight ($products) {
$myweight = 0;
foreach ($products as $key => $value) {
if (isset($products[$key]['weight']))
{
$mytempweight = $products[$key]['weight'] * $products[$key]['amount'];
$myweight = $myweight + $mytempweight;
}
}
return $myweight;
}
I created my own because the xcart function (func_weight_shipping_products) doesn't count the weight of free shipping products and I wanted the actual weight.
Then add the following line in the func_place_order function right before the order insert statement.
$my_order_weight = func_my_total_weight($products);
Then add a field in the xcart_orders table called my_order_weight and modify the insert statement to insert $my_order_weight in into the my_order_weight field in the xcart_orders table.
Then you should be able to output that field in the invoice template i.e. $order.my_order_weight
I did the first part but am using the weight for other things...it only took 15 minutes to make the necessary changes. My funky naming convention is so I can tell the difference between xcart coding and mine and my variables won't conflict with xcarts. I just slapped this post together so not everything above may be perfect but you get the idea. I hope that helps.
Keep in mind that mods like this make it impossible to upgrade your cart later. I just used xcart as a starting point and have been making it my own from that point on.
G
__________________
Greylar
X-cart Gold 4.0.12 [linux]
|