Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

State Based Region Shipping Rates


billythekid

Recommended Posts

I have been tempted to do this, but i think i will wait till ms3 comes out. If i were to do this now, the contribution will be useless once ms3 comes out. So, lets wait. I will also add other capabilites such the ability to chose different methods (eg, air, ground, and so on).

 

Jorge Suarez

 

 

FYI: I think i've got a solution when using Country-State Selector seems to be working at this stage....

Link to comment
Share on other sites

Hi all,

 

Thanks for this contrib. Works like charm. However I need to modify the code so it can calculate based on initial shipping price of the package and thereafter a linear increment (only for weight option). I need to configure baseprice:increment:incrementcost in table. The formula should go something like this ( I think :rolleyes: ) :

 

$shipping = 0;

$base = $table_cost[0];

$incr = $table_cost[1];

$costinc = $table_cost[2];

$shipping = $base + ($order_total * ($costinc / $incr)- ($costinc / $incr));

 

where should I put this formula?

 

TIA - BTW, great contrib.

Link to comment
Share on other sites

Hi all,

 

Thanks for this contrib. Works like charm. However I need to modify the code so it can calculate based on initial shipping price of the package and thereafter a linear increment (only for weight option). I need to configure baseprice:increment:incrementcost in table. The formula should go something like this ( I think :rolleyes: ) :

 

$shipping = 0;

$base = $table_cost[0];

$incr = $table_cost[1];

$costinc = $table_cost[2];

$shipping = $base + ($order_total * ($costinc / $incr)- ($costinc / $incr));

 

where should I put this formula?

 

TIA - BTW, great contrib.

 

Well, found the solution myself. So, I post it here if someone else might need it. This is just a kind of quick solution but it works for me.

 

My shipping options are like this :

1. 1st 500g = 4.50, every increment of 250g after that charge 1.00

2. if below than 500g = 4.50

 

above only apply to weight below than 2KG, if more :

1. 1st 500g = 8.00, every increment of 500g after that charge 2.00

 

Here we go:

 

1. Find below code:

 

if (MODULE_SHIPPING_REGIONS_MODE == 'weight') {

for ($i=0; $i<sizeof($regions_table); $i+=2) {

if ($order_total_price <= $regions_table[$i]) {

$shipping = $regions_table[$i+1];

$shipping_method = MODULE_SHIPPING_REGIONS_WEIGHT . ' ' . $shipping_weight . ' ' . MODULE_SHIPPING_REGIONS_WEIGHT_TEXT . ' ' . "$dest_state, $dest_country" . ' ' . MODULE_SHIPPING_REGIONS_TEXT_UNITS;

break;

}

}

}

 

2. Replace with :

 

if (MODULE_SHIPPING_REGIONS_MODE == 'weight') {

if ($order_total_price <= 0.5)

$shipping = 4.50;

elseif (($order_total_price > 0.5) && ($order_total_price <= 2.0)) {

$shipping = 0;

$base = $regions_table[0];

$costbase = $regions_table[1];

$incr = $regions_table[2];

$costincr = $regions_table[3];

$shipping = $costbase + ($costincr * (($order_total_price - $base) / $incr));

} else {

$shipping = 0;

$base = $regions_table[4];

$costbase = $regions_table[5];

$incr = $regions_table[6];

$costincr = $regions_table[7];

$shipping = $costbase + ($costincr * (($order_total_price - $base) / $incr));

}

$shipping_method = MODULE_SHIPPING_REGIONS_WEIGHT . ' ' . $shipping_weight . ' ' . MODULE_SHIPPING_REGIONS_WEIGHT_TEXT . ' ' . "$dest_state, $dest_country" . ' ' . MODULE_SHIPPING_REGIONS_TEXT_UNITS;

}

 

Change whatever you need in hardcoded values and add yours in shipping table according to this format :

 

[baseweight]:[basecost]:[incrementweight]:[incrementcost]:[>2KGbaseweight]:[>2KGbasecost]:[>2KGincrementweight]:[>2KGincrementcost]

 

Done. Maybe there's a better way to do this ;)

 

Thanks.

Link to comment
Share on other sites

  • 1 month later...

Hi all....

 

 

I just donwload the contrib. Install it in fresh installation OSc MS2 ... follow readme instruction and install this module in admin/module/shipping. done. but when I make an order shopping with value 59,99 (2 items movie):

 

Please select the preferred shipping method to use on this order.

 

 

Flat Rate

Best Way $5.00

 

 

Region Based Rates

No shipping available to the selected location

 

 

Then I remove Flat Rate Shipping Module, and then output in checkout_shipping.php :

 

 

This is currently the only shipping method available to use on this order.

 

Region Based Rates

No shipping available to the selected location

 

 

Is there something wrong? Help me please....Thx

Link to comment
Share on other sites

  • 4 weeks later...

Hi ppl,

 

i don't know if anyone needs it, but well since i needed it and coded it i thought maybe someone else may find it interesting.

I needed a possibility to add a "all" region since we ship to the whole world. So as i am lame and don't want to add all countrys into a region, i added some code to check if the last region configured in admin contains "All" and sets the region to use to that region if the customers country isn't in any other region.

To achieve it just add:

if ($dest_region == 0) {
	  $i = $this->regions;
	  $regions_table = constant('MODULE_SHIPPING_REGIONS' . $i);
	  $country_states_or_countries = split("[,]", $regions_table);
	  if (in_array("All", $country_states_or_countries)) $dest_region = $this->regions;
  }

 

after

if ($dest_region == 0) {
	  for ($i=1; $i<=$this->regions; $i++) {
		$regions_table = constant('MODULE_SHIPPING_REGIONS' . $i);
		$country_states_or_countries = split("[,]", $regions_table);
		if (in_array($dest_country, $country_states_or_countries)) {
		  $dest_region = $i;
		  break;
		}
	  }
  }

 

Done :)

Hope it helps someone.

 

greetz Gsnerf

Edited by Gsnerf
Link to comment
Share on other sites

I used this contribution (State Based Region) and it works but something is strange...if I set in the product weight 5.0 it is converted to 10.0 pounds in the "checkout_shipping.php" if I set in the product weigt 6.0 it is converted to 11.0 pounds and so on...I mean the weight I set the system add 5 pounds I don?t know why.

 

Example:

 

if I set in the product weight 16.0 the system set 21 pound (libras) as you can see below in the "chechout_shipping.php"...I?m using spanish language.

 

---------------------"chechout_shipping.php" section where the shipping modules are listed --------

Forma de Env?o

Esta es la unica forma de env?o disponible para su pedido.

 

Tarrifas basadas en regiones

Envio de 21 Libras to Nuevo Leon, M?xico $80.00

-----------------------------------------------------------------------------------------------------------------

 

I thought because the unit conversion from kilos to pounds but it is not because the convesion from kilos to pound is 2.205.

 

May someone help me to understand why this happend

Link to comment
Share on other sites

I used this contribution (State Based Region) and it works but something is strange...if I set in the product weight 5.0 it is converted to 10.0 pounds in the "checkout_shipping.php" if I set in the product weigt 6.0 it is converted to 11.0 pounds and so on...I mean the weight I set the system add 5 pounds I don?t know why.

 

Example:

 

if I set in the product weight 16.0 the system set 21 pound (libras) as you can see below in the "chechout_shipping.php"...I?m using spanish language.

 

---------------------"chechout_shipping.php" section where the shipping modules are listed --------

Forma de Env?o

Esta es la unica forma de env?o disponible para su pedido.

 

Tarrifas basadas en regiones

Envio de 21 Libras to Nuevo Leon, M?xico $80.00

-----------------------------------------------------------------------------------------------------------------

 

I thought because the unit conversion from kilos to pounds but it is not because the convesion from kilos to pound is 2.205.

 

May someone help me to understand why this happend

I have noticed the same thing too.

The converstion that work on the module currently is:

Weight x 4 = Pounds

 

Hope this helps

 

Kunal

Link to comment
Share on other sites

Hi!! Kunal

 

Thanks you for help

 

But It doesn?t make sense for me because if I set 6 in the weight with your formula will display 24 pounds...but I got 11 Pounds (6+5) if I set 21 in the weight field I got 26 (21+5) and so on...Weight plus 5.

Link to comment
Share on other sites

Hi!! Kunal

 

Thanks you for help

 

But It doesn?t make sense for me because if I set 6 in the weight with your formula will display 24 pounds...but I got 11 Pounds (6+5) if I set 21 in the weight field I got 26 (21+5) and so on...Weight plus 5.

 

 

I think you are both forgetting about the tare weight (weight of packing materials), you can set that to 0 if necessary in Configuration - Shipping/Packaging - Package Tare weight.

 

Cheers

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
I think you are both forgetting about the tare weight (weight of packing materials), you can set that to 0 if necessary in Configuration - Shipping/Packaging - Package Tare weight.

 

Cheers

 

I have kept the Tare Weight to 0 but still have to use my formula to make things work.

Link to comment
Share on other sites

  • 3 months later...

This may seem like a stupid question, but bare with me as I'm new to this!

 

Where exactly do I put the files to install the mod?

 

Do I put one of the regions.php file in /catalog/includes/modules/shipping

and another in /catalog/includes/languages/english/modules/shipping

 

Which ones go where and what else do I need to do? Am I getting this completley wrong!?

Link to comment
Share on other sites

This may seem like a stupid question, but bare with me as I'm new to this!

 

Where exactly do I put the files to install the mod?

 

Do I put one of the regions.php file in /catalog/includes/modules/shipping

and another in /catalog/includes/languages/english/modules/shipping

 

Which ones go where and what else do I need to do? Am I getting this completley wrong!?

 

After extraction, the install files should be in a folder structure that mirrors your store folder structure. Just put the files in the corresponding folder in your store.

Link to comment
Share on other sites

Has anyone accomplished setting up two of these modules to run

simultaneously?

 

One for regular shipping and the other for express shipping, etc. ...

 

If so would you be willing to share the code for a second install.

 

I've tried adjusting the code like some have suggested in this

forum but am not that familiar with how the script works. Therefore,

I'm creating a real mess on my test site. :(

 

Any help would be appreciated,

 

Thanks,

 

Keith

Link to comment
Share on other sites

  • 3 weeks later...

Im have a problem,

 

Just now I have the following settings :

 

Enable US Regions Method

1

 

Sort Order

0

 

Handling Fee

0.00

 

Mode

per_item

 

Tax Class

--none--

 

Region 1 States/Countries

Fife

 

Region 1 Shipping Table

30:1.50

 

Region 2 States/Countries

Dundee, Perth

 

Region 2 Shipping Table

30:1.50,

 

Region 3 States/Countries

Kinross

 

Region 3 Shipping Table

30:1.50,

 

 

Now the problem I have is if I have nothing in my cart it still says I am sending out 1 item, then if I add something to the cart it says I have 2 items being posted...

 

Why is this happening???

 

Before someone says Perth, Dundee, Kinross arent in the states, I know, I am running a UK database for the areas.

 

O.

Link to comment
Share on other sites

  • 3 weeks later...

First of all - I LOVE this contribution. I looked for weeks for something like this and finally found it ... and also found the Canadian version. I have installed them both so I can charge tax on the shipping. (I guess our gvt likes to tax everything here.)

 

Can someone tell me where these contributions are named?

 

When you get tho the shipping cart I would like to modify the name that comes up.

Link to comment
Share on other sites

  • 2 weeks later...
Im have a problem,

 

Just now I have the following settings :

 

Enable US Regions Method

1

 

Sort Order

0

 

Handling Fee

0.00

 

Mode

per_item

 

Tax Class

--none--

 

Region 1 States/Countries

Fife

 

Region 1 Shipping Table

30:1.50

 

Region 2 States/Countries

Dundee, Perth

 

Region 2 Shipping Table

30:1.50,

 

Region 3 States/Countries

Kinross

 

Region 3 Shipping Table

30:1.50,

Now the problem I have is if I have nothing in my cart it still says I am sending out 1 item, then if I add something to the cart it says I have 2 items being posted...

 

Why is this happening???

 

Before someone says Perth, Dundee, Kinross arent in the states, I know, I am running a UK database for the areas.

 

O.

 

Check the shipping/packaging setting under the configuration group. if you can't figure this out reply here or send me a private message with a link to check this strange behavior.

Link to comment
Share on other sites

First of all - I LOVE this contribution. I looked for weeks for something like this and finally found it ... and also found the Canadian version. I have installed them both so I can charge tax on the shipping. (I guess our gvt likes to tax everything here.)

 

Can someone tell me where these contributions are named?

 

When you get tho the shipping cart I would like to modify the name that comes up.

 

browse to catalog\includes\languages\[language]\modules\shipping\regions

 

there you can change the wording to anything related to this module.

Link to comment
Share on other sites

Has anyone accomplished setting up two of these modules to run

simultaneously?

 

One for regular shipping and the other for express shipping, etc. ...

 

If so would you be willing to share the code for a second install.

 

I've tried adjusting the code like some have suggested in this

forum but am not that familiar with how the script works. Therefore,

I'm creating a real mess on my test site. :(

 

Any help would be appreciated,

 

Thanks,

 

Keith

 

Thats is very possible. I have installed this module in 4 different variations on a single site. its a little hard to explain, but someone a few pages back posted a very good explaintion. I would re-explain, but there is a at least a couple pages of that topic discussed. just go bakc a few pages on this same thread.

 

Nezah.Net

Edited by nezah.net
Link to comment
Share on other sites

  • 3 weeks later...

Is there any means to mix modes??

 

I'd like to price base lower 48 US states then percent base Alkaska & Hawaii

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

(to repeat.. trying to copy the module to use percent based for Aklaska & Hawaii and keep the original to use price based for lower 48 US states)

 

some progress, but something is still not right.. I copied the 2 files:

/catalog/includes/modules/shipping/regions.php

/catalog/includes/languages/english/modules/shipping/regions.php

 

renamed them to:

/catalog/includes/modules/shipping/regionsPCT.php

/catalog/includes/languages/english/modules/shipping/regionsPCT.php

 

In

/catalog/includes/modules/shipping/regionsPCT.php

 

I changed every instance of

MODULE_SHIPPING_REGIONS

to

MODULE_SHIPPING_PCTREGIONS

(also done in the language file)

 

revised:

class regions {

to:

class pctregions {

 

revised

// class constructor

function regions() {

to

// class constructor

function pctregions() {

 

revised every instance of

$regions

to

$pctregions

 

 

I do not get any errors when I go to the Shipping Modules page in the ADMIN, but the module does not show up.. only the original one shows up

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...