Thread: Modifying Zones

Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2007
    Posts
    125
    Plugin Contributions
    0

    Default Modifying Zones

    I read the FAQ, How do I set up the Zones Shipping Module? and the sample set of 5 shipping zones shown in that is exactly what I would like to use for my site. But the instructions for setting it up do not match what I see on the Admin fields in ZenCart 1.3.7 - do they apply to an earlier version? Is there an update for 1.3.7?

    Also, I want to charge sales tax only for California buyers, and have tentatively set Zone 1 for California only, and Zone 2 for the rest of the U.S. However, the "rest of the U.S." includes all zones (all states) which includes California. Will this be a problem? I don't see any way of removing California from the list of Zones under "Zone 2".
    hedera

    Nature bats last.

  2. #2
    Join Date
    Nov 2007
    Posts
    125
    Plugin Contributions
    0

    Default Re: Modifying Zones

    I've done a lot more studying on this, and I'm now down to 4 zones, so I still need to modify zones.php, but I need help on how and where to do that so as to make a correct override. Can someone please confirm these assumptions:

    The correct override for zones.php would be in this folder (LifeRing is our override):

    /ZenCart/includes/modules/LifeRing/shipping/zones.php

    This is an override for

    /ZenCart/includes/modules/shipping/zones.php

    In that override file I've changed the statement
    $this->num_zones = 3;

    to read
    $this->num_zones = 4;

    and it seems to have no effect; am I in the wrong file? If so, what file should I be overriding?

    I also updated the "default countries" variable in the same file with this code:

    for ($i = 1; $i <= $this->num_zones; $i++) {
    $default_countries = '1:US,2:CA,3:AU,NZ,IE,GB,4:00';

    I also see no effect here; the changes don't show in ZenCart when I reinstall the module, and I still only have 3 zones available. Is this syntax correct? If not, what is the update format? Should I leave out the zone numbers? Should I use an array() statement? Should the separate groups of countries be enclosed in single or double quotes?

    Also, it's not clear to me how I put the shipping weight/cost data into the table. In the install() function, the 3 $db->Execute() statements seem to update the countries, the shipping zone costs, and the handling fees; but I can't see how I get the data into them. All I keep seeing after reinstalling the zone rates module are the entries that are hard coded in the install() function.

    Is anybody listening? I opened this thread 2 weeks ago...
    hedera

    Nature bats last.

  3. #3
    Join Date
    Nov 2007
    Posts
    125
    Plugin Contributions
    0

    Default Re: Modifying Zones

    More information: I've just discovered that by changing the number of zones in this file:

    /ZenCart/includes/modules/shipping/zones.php

    I have successfully made the change appear in my admin panel. So my override was obviously in the wrong place. But a change here won't survive an upgrade. The wrong place was

    /ZenCart/includes/modules/LifeRing/shipping/zones.php

    But: the tutorial The Override System Really Simplified doesn't clearly show a place for an override of the shipping module. Where should an override for the shipping module go??
    hedera

    Nature bats last.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Modifying Zones

    To add more zones you need to save any definitions to NotePad as they will be lost in a minute ...

    Then REMOVE the Zone Rate zones shipping module ...

    Edit the file:
    /includes/modules/shipping/zones.php

    and change the number of zones from 3 to how many you need, as defined in the instructions of the file and you should find the number set around line 120 ...

    Then INSTALL the Zone Rate zones and you will now have the additional zones there to be defined ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Nov 2007
    Posts
    125
    Plugin Contributions
    0

    Default Re: Modifying Zones

    Thank you for your response, Linda. Your answer confirms what I just found out by experiment.

    Do I infer correctly from this that it isn't possible to do an override of parts of the shipping module, such as zones.php?? That is the conclusion I was beginning to reach after beating on this thing for a week. So that if and when we upgrade ZenCart, I will have to redo the Zones Table from scratch, every time we upgrade?

    If that is the case I'd better document it.
    hedera

    Nature bats last.

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Modifying Zones

    That is where you would clone zones.php to something like zonesfred.php and all zones becomes zonesfred and ZONES become ZONESFRED ...

    This would make your own custom shipping module ... however becareful on customizing zones.php and table.php as these use the world ZONES and TABLES as other referrences in the code ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Nov 2007
    Posts
    125
    Plugin Contributions
    0

    Default Re: Modifying Zones

    Yikes. If I read you right, you're suggesting renaming the file, and then changing all the internal self references from "zones" and "ZONES" to "zoneswhatever"...

    I'm not sure it won't be easier to rebuild the shipping table than to maintain that, especially since some of the internal references, if I understand correctly, should NOT be changed. With no more experience with PHP than I have, I don't think I want to try that.

    Thanks for the suggestion, though, and I'll stare at it and see if I can make sense of it. It would be better to have something that won't get overwritten.
    hedera

    Nature bats last.

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Modifying Zones

    From one upgrade to another you do not need to reset the settings ... this is only if you need to customize the code ...

    Plus you will want to compare your changes to the new file of an upgrade ...

    My suggestion was to clone it to your own module (don't delete the original, save that as referrence uninstalled) and then on upgrades your custom shipping module would never be overwritten ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. Zones plus three more zones inside one zone
    By Rakuda in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 6 Oct 2011, 03:21 PM
  2. Zones module: Can I create shipping zones for different states?
    By Lisa in Vermont in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 31 Dec 2008, 06:35 AM
  3. my store->zones not showing any zones for my country
    By oavs in forum Addon Shipping Modules
    Replies: 7
    Last Post: 3 Jan 2007, 05:22 AM
  4. Modifying the # of Zones for Shipping Method
    By Rishu in forum Addon Shipping Modules
    Replies: 2
    Last Post: 27 Nov 2006, 06:02 PM
  5. modifying custom shipping zones
    By whiteboxer in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 24 Aug 2006, 11:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg