VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Shipping VM 1.1 => UPS VM 1 => Topic started by: ifredsayred on March 25, 2009, 21:38:19 PM

Title: [SOLVED] Per-Piece Shipping
Post by: ifredsayred on March 25, 2009, 21:38:19 PM
Hello-

In setting up a UPS shipping method for my client, I wondered if anyone had come up with a way to charge a standard ship rate based on "per piece" rather than weight?

My client bundles shipping and handling into the final fee, so he wants to charge $X for the first item, and $1 for each additional item. Is it possible to create such a beast with the standard UPS shipping module, or will this be a re-write of the module from the ground up?

Thanks in advance!



SOLUTION

Couldn't find a way to change this in the UPS module itself (without breaking it), so I set it up using the standard shipping module, and adding the following line of code to calculate shipping:
$total_shipping_handling = $d["zone_qty"]+8;
Title: Re: [SOLVED] Per-Piece Shipping
Post by: duchess on September 02, 2009, 12:35:52 PM
excuse me, I'm having the same issue. What represents "8" in your code line?
Title: Re: [SOLVED] Per-Piece Shipping
Post by: ifredsayred on September 02, 2009, 15:50:25 PM
It works like this - say I charge $9 for the first item, and $1 for each additional item. As an example, a customer has five items in their basket - then the shipping cost would be calculated like this:


fixed_cost = $9
per_item_cost = $1

total_shipping_cost = (total_number_of_items) + (fixed_cost - per_item_cost)

or

total_shipping_cost = (5 items)+($9-$1)
or
$total_shipping_cost = 5 + 8 = $13


So, long story short, the 8 in the formula above equals the difference between the fixed_cost ($9) and the per-item cost ($1). I hope that makes sense. If not, feel free to post questions, and I'll answer ASAP.