VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: CGLaidlaw on March 03, 2015, 22:09:22 PM

Title: Product Weight Retrieval for Shipping
Post by: CGLaidlaw on March 03, 2015, 22:09:22 PM
I am currently working on implementing the FedEx Plugin for VM 3.0.4 shipping methods. However, as I have been working with the plugin that I am using for FedEx, it does not support multi-package or Fright LTL shipping. So I am taking it upon myself to expand the functionality of this plugin to allow shipping of carts that exceed 150 LBS via multi-packaging and allowing shipping items of individual weight that exceeds 150 LBS for Freight LTL. In order for me to do this I need to access the individual weights of the individual items within the cart to calculate the packages/freight shipping costs. Where would I find the calculation for the cart? (Assuming the total cart weight is calculated in the code from the individual weights)

The only reference that I have been able to find is at: http://forum.virtuemart.net/index.php?topic=115233.0 (http://forum.virtuemart.net/index.php?topic=115233.0)
Where they mention the use of vmShipmentMethod::get_weight($product["virtuemart_product_id"]) * $product->quantity'];
yet I do not see this method anywhere in the cart.php file within the virtuemart component.
Title: Re: Product Weight Retrieval for Shipping
Post by: GJC Web Design on March 04, 2015, 00:25:58 AM
something like?  (un-tested)


$product_weights = array();
foreach ($cart->products as $product) {
$product_weights[$product->virtuemart_product_id] = $product->product_weight*$product->quantity;
}

Title: Re: Product Weight Retrieval for Shipping
Post by: CGLaidlaw on March 04, 2015, 04:56:04 AM
I will try it out and let you know, thank you!!