News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Add packaging weight to card

Started by ovg, September 30, 2015, 19:59:43 PM

Previous topic - Next topic

ovg

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.

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

ovg

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

GJC Web Design

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..
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

ovg

I've solved it with this code:

return $weight[$to_weight_unit] + 0.092;

Happy ;-)

GJC Web Design

would prefer in the shipping plugin.. this will get over written every up date
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation