Jump to content

Workaround: shipping costs by carriers and states/provinces


Recommended Posts

After much frustrations trying to configure shipping cost by assigning states within a country to different shipping zones, I finally have a workaround.

 

The original topic where I complained about this BUG can be found here:

http://www.prestashop.com/forums/topic/325635-where-to-report-a-bug/

 

The ugly facts: the shipping costs simulations and calculations contained in classes/cart.php for the most part part ignore any id_zone settings, and will just use the default zone set for the country, disregarding any settings made for states.

 

I don't understand how a project like prestashop at this state of maturity could release such a broken shipping costs module, unless... well, there are add-ons that supposedly solve exactly that problem...

 

 

Anyway, after trying to fiddle with cart.php functions, I gave up on fixing the BUG myself because of the intricate abstract code, which is not designed for easy modification.

Instead, I found a simple but dirty workaround which I now share here.

 

Example: let's suppose you have a country, like USA, and you got states or provinces or whatever, and you want to specifiy one shipping cost calculation for the whole country, plus specific costs for states.

For example, 20 USD for delivery within USA and 10 EUR within California.

 

Steps:

- Make sure you have the primary country setup with its provinces, i.e. USA and its states

- Create a new country, name it "USA - California", the system wants an ISO code and will refuse some, so try inputting something like "USCC" there. this country does not need to contain states if you plan to attach only one state to it, but it can contain states if you want to make delivery zone covering California plus Oregon for example.

- after adding the country, activate it and make note of the "ID" on the left of the screen

- you should already have the states, but if not, create the states you need. You will notice your new country does not turn up in the list of countries offered to attach a new state to... (I can only guess the reasons for this)

- access your database, use something like phpmyadmin. go into the table "states", find your newly created state and alter the column "id_country" and put the previously noted ID there. If you want to assign other states to the same delivery zone, do the same for the other states.

- go to Localization-> Zones in Prestashop admin and create 2 zones, for example "USA" and "USA - California" (or whatever you want to call them).

- now go to Localization -> Countries, assign the country USA to zone "USA" and the Country "USA - California" to zone "USA - California"

 

done... now the shipping costs will be properly applied to what the customer sets as a "Country"...

 

dirty workaround I know, but since shipping zones are totally useless in the current state of Prestashop, that was the only easy solution I could come up with.

 

I hope this is useful to some.

I would be very interested if someone could contribute the code fixes for making the shipping zones work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...