Zen Cart Logo
Forums / Addon Shipping Modules / Zone awareness causes my module to go red

Zone awareness causes my module to go red

Views: 813

Results 1 to 4 of 4
30 Oct 2011, 9:24 AM
#1
greyman56 avatar

greyman56

New Zenner

Join Date:
May 2008
Location:
Kenilworth Qld Australia
Posts:
25
Plugin Contributions:
0

Zone awareness causes my module to go red

I am writing a courier shipping module for e-go.com.au and all seems to be working OK, except:-

When I added geo zone awareness by copying the code from the flat module, changing the constant to match my new modules naming convention, added the setting to the install function and keys function, the coloured circle in the admin panel goes red if I select a shipping zone. If I leave it as -none-, then the circle goes green.

The same shipping zone settings in the flat or item shipping modules do not have this effect. So I am guessing it is not something to do with the zone settings in the DB. But I could be wrong.

Even though the circle is red when a zone is set (in my e-go module), if I change my shipping address between Australia and USA then the correct behaviour happens. By this I mean that only modules whose zones have been set to USA or -none- show up in the checkout and shipping estimator when I set my address to USA. Similarly, only modules (including my e-go one) that have Australia zone selected or -none- show up when the address is Australia.

But I really like things to work properly, so need to track down why the module seems to enable and disable itself properly, but still have the circle red.

I have searched here and in Google for a couple of hours now to no avail.

1 Nov 2011, 2:07 AM
#2
greyman56 avatar

greyman56

New Zenner

Join Date:
May 2008
Location:
Kenilworth Qld Australia
Posts:
25
Plugin Contributions:
0

Re: Zone awareness causes my module to go red

I figured it out.

I was setting $this->sort_order after the zone check code in the class init function.
The zone checking test runs in admin when it does not have the $order available. So therefore sets $this->enabled to false.

So I moved the sort_order to above the zone checking and the icon went yellow.

This is still not ideal as I think that yellow means installed but not enabled. The icon goes green when no shipping zone is set, and yellow when it is. BTW, the flat rate and per item do the same.

So the answer was to add a condition in the zone check for IS_ADMIN_FLAG != true so it does not do this check in admin.

All good now I think.

1 Nov 2011, 2:10 AM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Zone awareness causes my module to go red

Yellow also means you set a Zone on a module ... so that doesn't mean it isn't enabled ...

If it isn't working, check the Zone Definition and check its DETAILS ...

2 Nov 2011, 5:58 AM
#4
greyman56 avatar

greyman56

New Zenner

Join Date:
May 2008
Location:
Kenilworth Qld Australia
Posts:
25
Plugin Contributions:
0

Re: Zone awareness causes my module to go red

Thanks for pointing that out Linda. I'll take out that "is not admin" check so it goes yellow when a zone is set. That is a useful visual aid when looking at the shipping module list.