VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Adam Bazaroff on October 13, 2016, 21:58:04 PM

Title: Show order weight in invoice
Post by: Adam Bazaroff on October 13, 2016, 21:58:04 PM
How can I show order_weight in invoice?
Thanks!
Title: Re: Show order weight in invoice
Post by: GJC Web Design on October 13, 2016, 23:26:07 PM
http://forum.virtuemart.net/index.php?topic=79799.0
http://forum.virtuemart.net/index.php?topic=104795.0
Title: Re: Show order weight in invoice
Post by: Adam Bazaroff on October 13, 2016, 23:29:40 PM
Sorry, VirtueMart 2.6.14... but v.3 is don't have this too.
Title: Re: Show order weight in invoice
Post by: Milbo on October 13, 2016, 23:32:52 PM
You should update at least to vm2.6.22. This should work without any trouble. The update to vm3 is also not a big deal as long you stay with joomla 2.5
Title: Re: Show order weight in invoice
Post by: Adam Bazaroff on October 13, 2016, 23:35:02 PM
Thank you, but right now I try to find solution for showing order weight on Invoice.
Title: Re: Show order weight in invoice
Post by: Milbo on October 13, 2016, 23:52:17 PM
There is as far as I know, no native method in vm2
Title: Re: Show order weight in invoice
Post by: Adam Bazaroff on October 14, 2016, 08:59:13 AM
But it shows in order edit, on the bottom of page! In delivery table. How I can show it in invoice?
Title: Re: Show order weight in invoice
Post by: Milbo on October 14, 2016, 15:49:40 PM
That is part of your delivery table and depends on your shipment plugin.
Title: Re: Show order weight in invoice
Post by: Marttyn on December 17, 2019, 12:05:26 PM
Im developing a plugin to generate a file with the order shipping details. So then i can use this file to upload it on the shipping company website, and avoid copying manually all the shipping details.
I need to specify the order weight, but i cant find it in getMyOrderDetails(). Instead there i could find each product weight alone. So i go through all the items in the order adding each product weight. Is this the best approach to do it?


$orderDetails = $orderModel->getMyOrderDetails($id);

foreach($orderDetails['items'] as $item){
if(!empty($item->product_weight)){
$qty = (int)$item->product_quantity;
$weight = (int)$item->product_weight;

//weight in grams
if($item->product_weight_uom == "G"){
$total_weight = $total_weight + ($weight * $qty);
}
//weight in kilos
elseif($item->product_weight_uom == "Kg"){
$total_weight = $total_weight + (($weight * 1000) * $qty);
}
}
}


Thanks
Title: Re: Show order weight in invoice
Post by: pinochico on December 18, 2019, 06:18:56 AM
There is no weight for packaging, You have to add to function
Title: Re: Show order weight in invoice
Post by: AH on December 18, 2019, 10:26:22 AM
Martyn

Yes - there is no weight stored in the order item table or the total order header

Therefore you have to get the current item weight and do the calculation yourself when an order is loaded
Title: Re: Show order weight in invoice
Post by: Marttyn on December 18, 2019, 12:00:47 PM
As showed before, ive already done the coding, and its working fine.
But woudnt it be grate if VM already had a function to retrieve the order weight?
Title: Re: Show order weight in invoice
Post by: pinochico on December 19, 2019, 16:37:48 PM
QuoteBut woudnt it be grate if VM already had a function to retrieve the order weight?

ok, - again :)

You don't have setup for weight of packaging for order. This weight I have to send to shipping company and show in cart nad order summary, because sometime order has another price for shipping, then we added custom code for shipping plugin and change calculation in cart.


Rudolf