X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Total weight of all products on the Invoice (https://forum.x-cart.com/showthread.php?t=27468)

Dawn Howard 12-19-2006 08:07 AM

Total weight of all products on the Invoice
 
How do you display the total weight of all products ordered on the Invoice?

Dawn Howard 12-20-2006 09:09 AM

Re: Total weight of all products on the Invoice
 
I tried using the mod here: http://forum.x-cart.com/showthread.php?t=5315 but using the skin1/customer/main/cart_totals.tpl file

didn't work...

Dawn Howard 12-22-2006 05:12 AM

Re: Total weight of all products on the Invoice
 
I'm surprised no one knows how to do this... not even a idea?

Dawn Howard 01-05-2007 06:07 AM

Re: Total weight of all products on the Invoice
 
Ok so how about having the total weight appear somewhere else I can reference for any given order?

balinor 01-10-2007 10:40 AM

Re: Total weight of all products on the Invoice
 
Please don't double post, I have removed your second post on this topic. If you aren't getting an answer from the forums, post a ticket with X-Cart via your help desk. Thanks :)

just wondering 01-20-2007 05:45 AM

Re: Total weight of all products on the Invoice
 
*bump*

Anyone found a way of how to do this yet?

greylar 01-31-2007 07:28 PM

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


All times are GMT -8. The time now is 06:01 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.