X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   No city masks in zone. (https://forum.x-cart.com/showthread.php?t=70870)

gkarlsson 12-29-2014 01:12 PM

No city masks in zone.
 
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:

{* vimset ts=2 sw=2 sts=2 et: *}

{**
 * 
Zonecity masks template
 
*
 * @
author    Qualiteam software Ltd <info@x-cart.com>
 * @
copyright Copyright (c2011-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?

qualiteam 12-30-2014 09:24 AM

Re: No city masks in zone.
 
You can override protected methods in your modules.

Private methods are the thing which you can't override (and that's why there is no private methods in XC5).

gkarlsson 12-30-2014 09:31 AM

Re: No city masks in zone.
 
Strange - when I overwrote this protected method I got really strange results and my whole Admin interface was whacked.

Here is the excerpt from my php file

PHP Code:

namespace XLite\Module\KR\KRFeatures\View;

abstract class 
Countries extends \XLite\View\Tabs\ATabs implements \XLite\Base\IDecorator
{
    protected function 
isCityMasksEditEnabled()
    {
        return 
true;
    }



tony_sologubov 01-08-2015 05:05 AM

Re: No city masks in zone.
 
You need to decorate the \XLite\View\Tabs\Countries class instead of \XLite\View\Tabs\ATabs.

gkarlsson 01-08-2015 06:15 AM

Re: No city masks in zone.
 
Thanks,
I must have missed that.


All times are GMT -8. The time now is 06:20 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.