New Zenner
- Join Date:
- Aug 2009
- Posts:
- 6
- Plugin Contributions:
- 0
[Done v1.3.9] Number of Boxes Bug in perweightunit
There is a bug in the perweightunit shipping module, which is in the current version, as well as past versions.
When a customer places an order that is over the "Maximum Package Weight" (Configuration -> Shipping/Packaging), Zen Cart divides the weight between multiple packages. The problem is, the perweightunit shipping module doesn't add the packages together, so it only charges the customer for the first package.
Example:
Shopping Cart Weight: 60lb total
Zen Cart: Split into 2 packages, each being 30lb
perweightunit: [bug] Charge the customer for 1 30lb package (rather than 2 x 30lb)
Solution:
My version of the perweightunit.php file can be found here:
gist.github.com/193690
Here is a diff showing the changes:
diff a/includes/modules/shipping/perweightunit.php b/includes/modules/shipping/perweightunit.php
94c94
< global $order, $shipping_weight;
---
> global $order, $shipping_weight, $shipping_num_boxes;
101,102c101,102
< 'cost' => (MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units)
< + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING)));
---
> 'cost' => ((MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units)
> + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING)*$shipping_num_boxes)));
Hopefully this helps others who work with perweightunit and large orders.