Shipping Prices per product (for two regions) UPDATE

The project I started on for a client (read a bit here), worked well. The client came back to me with some extra requirements, namely;

1. Give each product an “extra cost” per region. To be used when people order more than 1 item, thus a widget costing $5 for postage with an extra fee of $2, would charge $7 for postage if the buyer ordered 2. And so on.

2. This to be done per product, per region.

3. Postage only to charge the HIGHEST postage cost + any extras.

Well, I have to say this complicated matters and took some thinking about!

Step 1 was to add the extra inputs in the admin – category – product (adding/editing) page, along with the relevant database changes;

Step 2 was to recode the shipping module I built to get the MAX value of an array. This array created by the costs of the postage (in the above image “HOME Shipping Cost” / “ROW Shipping Cost”).

Step 3 was to recode the cart class to enable the cart to keep track of the “extras” cost.

Now I have all the info needed to make sure that the shipping charges correctly. I’ve tested this to destruction and cannot break the calculations, so I am happy to make this live on the clients site – whilst also advising him to keep an eye on the shipping costs charged and let me know of any problems.

Example

In the example above, the cart holds 1 hoodie (charged at $5 + $2.50 for extras) and 3 tshirts (charged at $2.99 + $1.25 for extras). So the total postage charge is;

1 Hoodie @ 5.00
No extra charge for Hoodies as only 1 purchased.
No postage charge for T-shirts, as the Hoodie postage charge is higher.
3 extra postage charges for the tshirt @ 1.25 * 3

$5 + $1.25 + $1.25 + $1.25 = $8.75

Conclusion

Hope that anyone reading can see that pretty much anything is possible with osCommerce. The 2.2 and 2.3.1 versions of osCommerce are loosely coded, so it is easy to make the changes to enable whatever it is that you need to do. The v3 osCommerce will be harder to code for, but only because the code is so much more structured.

Leave a Reply

Your email address will not be published. Required fields are marked *