Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

No city masks in zone.

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 12-29-2014, 01:12 PM
 
gkarlsson gkarlsson is offline
 

Member
  
Join Date: Apr 2014
Posts: 24
 

Default 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?
__________________
X-Cart: 5.2.6
Reply With Quote
  #2  
Old 12-30-2014, 09:24 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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).
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 12-30-2014, 09:31 AM
 
gkarlsson gkarlsson is offline
 

Member
  
Join Date: Apr 2014
Posts: 24
 

Default 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;
    }

__________________
X-Cart: 5.2.6
Reply With Quote
  #4  
Old 01-08-2015, 05:05 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: No city masks in zone.

You need to decorate the \XLite\View\Tabs\Countries class instead of \XLite\View\Tabs\ATabs.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
qualiteam (01-12-2015)
  #5  
Old 01-08-2015, 06:15 AM
 
gkarlsson gkarlsson is offline
 

Member
  
Join Date: Apr 2014
Posts: 24
 

Default Re: No city masks in zone.

Thanks,
I must have missed that.
__________________
X-Cart: 5.2.6
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:44 PM.

   

 
X-Cart forums © 2001-2020