I was trying to migrate tax rates from XC4 to XC5 and discovered that I could not create zones that resolve down to city level. The option was just not there on the Zone Page.
I discovered this in Countries.php
PHP Code:
/**
* Disable city masks field in the interface
*
* @return boolean
*/
protected function isCityMasksEditEnabled()
{
return false;
}
And I wonder why anyone would code this. As it was protected I could not override it with a custom module so I just decided to override the field.city.tpl in our module.
with this:
PHP Code:
{* vim: set ts=2 sw=2 sts=2 et: *}
{**
* Zone: city masks template
*
* @author Qualiteam software Ltd <info@x-cart.com>
* @copyright Copyright (c) 2011-2014 Qualiteam software Ltd <info@x-cart.com>. All rights reserved
* @license [url]http://www.x-cart.com/license-agreement.html[/url] X-Cart 5 License Agreement
* @link [url]http://www.x-cart.com/[/url]
*
* @ListChild (list="zones.zone.details", weight="350")
*}
{*<widget class="\XLite\View\FormField\Textarea\Simple" value="{zone.getZoneCities(1)}" label="City masks" rows="5" cols="70" fieldName="zone_cities" help="{t(#Zone city masks help#)}" IF="isCityMasksEditEnabled()" />*}
<widget class="\XLite\View\FormField\Textarea\Simple" value="{zone.getZoneCities(1)}" label="City masks" rows="5" cols="70" fieldName="zone_cities" help="{t(#Zone city masks help#)}" />
Removing the 'isCityMasksEditEnabled()' IF statement. At least now I can add cities back to zones.
Does anyone know a better way to re-activate cities in zones?