Hi Guys,
I want to add packaging weight to the total weight of all the products in the basket.
Example basket:
2 pieces of product 1 (20gram a piece) 40 gram
3 pieces of product 2 (80 gram a peice) 240 gram
Total weight of products 280 gram.
Than add 90 gram of packaging.
Shipping methode must use 370 gram to select the correct shipping methode.
I think for this I must hack the vmpsplugin.php. I found this code:
protected function getOrderWeight (VirtueMartCart $cart, $to_weight_unit) {
static $weight = array();
if(!isset($weight[$to_weight_unit])) $weight[$to_weight_unit] = 0.0;
if(count($cart->products)>0 and empty($weight[$to_weight_unit])){
foreach ($cart->products as $product) {
$weight[$to_weight_unit] += (ShopFunctions::convertWeightUnit ($product->product_weight, $product->product_weight_uom, $to_weight_unit) * $product->quantity);
}
}
return $weight[$to_weight_unit];
}
What can I do to add the extra 90 gram?
Look forward to your help!
Kind Regards.
If you echo out the $cart is the packing weight there?
or do you mean a standard 90gram to any shipment?
and as always
http://forum.virtuemart.net/index.php?topic=104795.0
http://forum.virtuemart.net/index.php?topic=79799.0
Hi GJC,
Sorry for the lost info: It's about VM 3.0.10 en J3.4.4.
Indeed I mean a standard 90 gram to any shipment!
Can you help me with that? Hope so ;-)
Kind regards
Hmmm .. I don't know-- never been asked or tried
I guess add this weight in the shipping method after the getOrderWeight() is called
Could be an additionally parameter.. maybe someone else has a better idea..
I've solved it with this code:
return $weight[$to_weight_unit] + 0.092;
Happy ;-)
would prefer in the shipping plugin.. this will get over written every up date
Agree!!!