Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Modify the Zone Shipping mod to use states instead of countries?

Modify the Zone Shipping mod to use states instead of countries?

Locked

Views: 3,589

Results 1 to 17 of 17
This thread is locked. New replies are disabled.
11 Aug 2009, 3:54 PM
#1
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Modify the Zone Shipping mod to use states instead of countries?

I want to set up shipping zones inside the US, by US State.

I expect this can be done by only modifying the english defines and this line (around line 134) in zones.php

$dest_country = $order->delivery['country']['iso_code_2'];

I just need to know how to get the 2 char state abbreviation out of the $order object.

Should this work? What are the variables to access inside the $order object?

11 Aug 2009, 4:45 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

What might be easier is the Add On for Zone Table that lets you build the Zones specifically for each one so you can use Country or State or a combination per Zone defined ...

12 Aug 2009, 3:46 PM
#3
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Modify the Zone Shipping mod to use states instead of countries?

I am using a very old, heavily modified, version of zen-cart. It was started before my company even had a full time PHP developer, and no-one here knew about overrides. The core files have been hacked apart and put back together as well.

I need something that is either VERY backward compatible, or to write my own custom solution.

So, is my idea from my original post a good one?
How do I get the 2 letter state out of $order->delivery ?

12 Aug 2009, 8:27 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

I think it would be worth looking into the Add On ... I don't recall anything in it that would break in an older version and it takes a short time to build a Zone to test it and then install the Zone Table shipping module ...

It would be a lot faster than trying to re-write the Zone Rate zones shipping module ...

13 Aug 2009, 1:29 PM
#5
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Modify the Zone Shipping mod to use states instead of countries?

Linda,
Thanks for the suggestion.

I downloaded the zonetable shipping module. When I uploaded the files and went to admin I got this message:
"Fatal error: Class zonetable: Cannot inherit from undefined class base in /home/flowerte/public_html/includes/modules/shipping/zonetable.php on line 13"

It must be that the "base" class is newer than this version of the cart. One of these days I'll have to re-build this customer's cart, but I really don't want to tackle that right now.(Especially since this particular customer cannot afford to pay the labor.) Do you know a work around?

13 Aug 2009, 1:53 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

Change the line:

class zonetable extends base {

to read:

class zonetable {

and see if that works better for you ...

13 Aug 2009, 6:04 PM
#7
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Modify the Zone Shipping mod to use states instead of countries?

Thank you,
I was concerned that "base" might have some functionality that would be missing if I did that.

It looks like that is going to work. I had to learn how to set up zones definitions, but I think I got it. I haven't tested it on the public side, but the admin portion works.
Thanks again,
TecBrat.

13 Aug 2009, 10:32 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

Glad that helped ... let us know how it works for you ...

NOTE: on this shipping module, if you first make your Zones and then do the INSTALL the module will have each Zone with its own define area ...

Example: if you only have 3 Zones defined, and then install it, you will have 3 sections defined ...

If you then add 2 more Zones, they will not be setup correctly ... you can fix it by doing a quick REMOVE, INSTALL and re-configure ...

NOTE: if you need to do a REMOVE, first save your settings to NotePad or something as they will be lost when you do the REMOVE/INSTALL ...

24 Aug 2009, 5:51 PM
#9
semaxd avatar

semaxd

New Zenner

Join Date:
May 2008
Location:
Ventura Co.
Posts:
82
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

Ajeh:

Glad that helped ... let us know how it works for you ...

NOTE: on this shipping module, if you first make your Zones and then do the INSTALL the module will have each Zone with its own define area ...

Example: if you only have 3 Zones defined, and then install it, you will have 3 sections defined ...

If you then add 2 more Zones, they will not be setup correctly ... you can fix it by doing a quick REMOVE, INSTALL and re-configure ...

NOTE: if you need to do a REMOVE, first save your settings to NotePad or something as they will be lost when you do the REMOVE/INSTALL ...

Hi Linda,
happy monday!

ok, so how do i make the zoneshipping add-on show me 4 zones?
What do i change in the code I guess is a better question.
I have the zones i need set up now, just need to make the zoneshipping mod show me 4, to implement them.
thanks
jim

25 Aug 2009, 5:43 PM
#10
semaxd avatar

semaxd

New Zenner

Join Date:
May 2008
Location:
Ventura Co.
Posts:
82
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

anyone know this its like a void in the zencart. it seems to be avoided lol

27 Aug 2009, 2:49 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

Do a REMOVE, INSTALL and now configure it ...

You just need to have the Zones all defined before you install it so it will give you the setup settings for each Zone ...

27 Aug 2009, 4:54 PM
#12
semaxd avatar

semaxd

New Zenner

Join Date:
May 2008
Location:
Ventura Co.
Posts:
82
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

thats just super sweet! so simple i over looked thanks Linda!!!

Im all dialed in now

27 Aug 2009, 10:22 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Modify the Zone Shipping mod to use states instead of countries?

Thanks for the update that just a simple REMOVE, INSTALL and re-configure was able to fix the module issue that you were having ... :smile:

2 Sep 2009, 2:49 PM
#14
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Modify the Zone Shipping mod to use states instead of countries?

I thought I had this set up and working in admin. I set up 4 zones and removed/installed the mod. I can make a selection for each shipping zone and I can select weight, item, or price. I can enable or disable the mod. All these changes persist if I save and return. If I try changing the shipping costs, it reverts to the default. (default is 25:8.50,50:5.50,10000:0.00) I tried "1:17,2:34,3:51,4:68" and I also tried "10000:999"

Any ideas why this isn't working?
I also looked for it in the shopping cart and it was not offered even though the address I used was in a state that is in zone1.

2 Sep 2009, 4:54 PM
#15
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Modify the Zone Shipping mod to use states instead of countries?

The reason it wasn't showing up in My cart was that I don't have state dropdown ability on this ancient cart, and my shipping state was entered in lower case. I re-entered it in first letter capital and it showed up. I still have not been able to edit my shipping amounts.

2 Sep 2009, 6:16 PM
#16
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Modify the Zone Shipping mod to use states instead of countries?

I was able to work-around this problem by putting my cost data in using phpMyadmin. I'd still like to know how to fix it in admin. (configuration - browse - sort by configuration key, descending {Because they were the last keys created} then look for MODULE_SHIPPING_ZONETABLE_COST_1 {and ...2 etc} and edit as needed.)

30 Dec 2009, 8:14 PM
#17
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: Modify the Zone Shipping mod to use states instead of countries?

I just had to edit one of my rates, and found that I had to sort by "date added" to easily find this. I am not sure what I was thinking in my previous post. (Work around for old cart not taking updates in admin.)