osCommerce Quiz?

By | December 18, 2009

An osCommerce Quiz for you to think about;

[php]
switch (tep_get_zone_code($order->delivery[‘country’][‘id’], $order->delivery[‘zone_id’], ”)) {
case ‘HI’:
case ‘AK’:
$extra_cost = ($cart->show_total() * (13/100));
break;
default:
$extra_cost = 0;
switch ($order->delivery[‘country’][‘iso_code_2’]) {
case ‘US’:
$extra_cost = 0;
break;
default:
$extra_cost = ($cart->show_total() * (13/100));
}
}
[/php]

And then an extra piece of code like this, elsewhere in the file…

[php]+ $extra_cost[/php]

I came up with proof of concept code (proof of concept is just that, it shows it work but might not be the most graceful codebase) to illustrate something. Thought it might be interesting for you guys to see some code with no explanation, and find out what the code is for.

So, questions;

1. In which file(s) could this code be placed?
2. Which country/countries add NO cost?
3. Which states add an extra cost?
4. What is the extra cost?

8 thoughts on “osCommerce Quiz?

  1. Jeff

    Your code is much cleaner than mine for the same functionality. I used a series of if statements to determine if the zone should incur extra costs:

    if ($order->delivery[zone_id] == 21) $remote=1;

    I then use a model to determine the extra costs associated for the remote zones:

    if ($remote == 1) {
    $shipping += (13.00 + ($shipping_weight * 1.4));
    if ($shipping_num_boxes > 1) $shipping += ($shipping * $shipping_num_boxes);
    }

    You will see I charge a remote surcharge based on weight and an additional fee. I also increase the cost based on the number of boxes.

    I hate it when the first comment of a blog posts like this answers the question. So I did not answer your questions, but my comment will make it easier for someone to figure it the answers.

    jeff

  2. Gary Post author

    Hey Jeff – well, you & I know the answer, I guess no-one else does! Or no-one reads my blog other than you and I lol 😀

  3. Carine

    others are shopowners and too busy with the holiday sales ?
    eeuh, second question answered … ?

  4. Jackal

    Any prizes?

    I am guessing its added in the shipping modules (includes/modules/shipping). For Hawaii and Alaska and anything outside of USA, an extra fee of 13% is added.

  5. Jackal

    I forgot to add, that you might want to put case ‘PR’ too. Coz Puerto Rico is not in continental USA but considered country code USA.

  6. Gary Post author

    Thanks Jackal – I never knew that PR was considered a part of the USA.

Leave a Reply

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