<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<name>CountryZone Manager - Country</name>
	<version>1.05</version>
	<author>AlexDW</author>
	<link>https://www.opencart.com/index.php?route=marketplace/extension&amp;filter_member=AlexDW</link>
	<code>countrymanager</code>
	<file path="admin/view/template/localisation/country_list.twig">
		<operation error="skip">
			<search><![CDATA[
<h1>{{ heading_title }}</h1>
			]]></search>
			<add position="replace"><![CDATA[
<!-- CountryManager -->
      <h1>CountryManager</h1>
<!-- CountryManager -->
			]]></add>
		</operation>
	</file>
	<file path="admin/view/template/localisation/country_list.twig">
		<operation error="abort">
			<search><![CDATA[
<div class="pull-right"><a href="{{ add }}" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus"></i></a>
			]]></search>
			<add position="replace"><![CDATA[
<!-- CountryManager -->
      <div class="pull-right">
		<span style="padding-right:20px;">
		<a href="https://www.opencart.com/index.php?route=marketplace/extension&filter_member=AlexDW" target="_blank" data-toggle="tooltip" title="Get more extensions" class="btn btn-info"><i class="fa fa-download"></i></a></span>
        <button type="button" data-toggle="tooltip" title="{{ button_enable_country }}" class="btn btn-success" onclick="$('#form-country').attr('action', '{{ enable_country }}'); $('#form-country').submit();"><i class="fa fa-plus"></i></button>
        <button type="button" data-toggle="tooltip" title="{{ button_disable_country }}" class="btn btn-danger" onclick="$('#form-country').attr('action', '{{ disable_country }}'); $('#form-country').submit();"><i class="fa fa-minus"></i></button>
	  <a href="{{ enable_all }}" data-toggle="tooltip" title="{{ button_enable_all }}" class="btn btn-success" data-confirm="{{ button_enable_all }}"><i class="fa fa-globe fa-2x"></i></a>
	  <a href="{{ disable_all }}" data-toggle="tooltip" title="{{ button_disable_all }}" class="btn btn-danger" data-confirm="{{ button_disable_all }}"><i class="fa fa-globe fa-2x"></i></a>
	  <a href="{{ add }}" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus"></i></a>
<!-- CountryManager -->
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
<td class="text-left">{% if sort == 'name' %}
			]]></search>
			<add position="before"><![CDATA[
<!-- CountryManager -->
              <td class="text-left" width="80px">{% if sort == 'country_id' %}
                <a href="{{ sort_id }}" class="{{ order|lower }}">ID</a>
                {% else %}
                <a href="{{ sort_id }}">ID</a>
                {% endif %}</td>
<!-- CountryManager -->
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
<td class="text-right">{{ column_action }}</td>
			]]></search>
			<add position="before"><![CDATA[
<!-- CountryManager -->
              <td class="text-left">{{ entry_postcode_required }}</td>
              <td class="text-left">{{ entry_status }}</td>
<!-- CountryManager -->
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
<div class="panel-body">
			]]></search>
			<add position="after"><![CDATA[
<!-- CountryManager -->
        <div class="well">
          <div class="row">
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-id">ID</label>
                <input type="text" name="filter_id" value="{{ filter_id }}" placeholder="ID" id="input-id" class="form-control" />
              </div>
              <div class="form-group">
                <label class="control-label" for="input-country">{{ entry_name }}</label>
                <input type="text" name="filter_country" value="{{ filter_country }}" placeholder="{{ entry_name }}" id="input-country" class="form-control" />
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-iso2">{{ entry_iso_code_2 }}</label>
                <input type="text" name="filter_iso2" value="{{ filter_iso2 }}" placeholder="{{ entry_iso_code_2 }}" id="input-iso2" class="form-control" />
              </div>
              <div class="form-group">
                <label class="control-label" for="input-iso3">{{ entry_iso_code_3 }}</label>
                <input type="text" name="filter_iso3" value="{{ filter_iso3 }}" placeholder="{{ entry_iso_code_3 }}" id="input-iso3" class="form-control" />
              </div>
            </div>
            <div class="col-sm-4">
              <div class="form-group">
                <label class="control-label" for="input-code">{{ entry_postcode_required }}</label>
                <select name="filter_code" id="input-code" class="form-control">
                  <option value="*"></option>
				  {% if filter_code == 1 %}
                  <option value="1" selected="selected">{{ text_yes }}</option>
                  {% else %}
                  <option value="1">{{ text_yes }}</option>
                  {% endif %}
                  {% if filter_code == 2 %}
                  <option value="2" selected="selected">{{ text_no }}</option>
                  {% else %}
                  <option value="2">{{ text_no }}</option>
                  {% endif %}
                </select>
              </div>
              <div class="form-group">
                <label class="control-label" for="input-status">{{ entry_status }}</label>
                <select name="filter_status" id="input-status" class="form-control">
                  <option value="*"></option>
				  {% if filter_status == 1 %}
                  <option value="1" selected="selected">{{ text_enabled }}</option>
                  {% else %}
                  <option value="1">{{ text_enabled }}</option>
                  {% endif %}
                  {% if filter_status == 2 %}
                  <option value="2" selected="selected">{{ text_disabled }}</option>
                  {% else %}
                  <option value="2">{{ text_disabled }}</option>
                  {% endif %}
                </select>
              </div>
            </div>
            <div class="col-sm-12">
			<div class="pull-right">
              <button type="button" id="button-clear" class="btn btn-info"><i class="fa fa-eraser"></i> Clear</button>
			  <button type="button" id="button-filter" class="btn btn-primary"><i class="fa fa-search"></i> Filter</button>
            </div>
            </div>
          </div>
        </div>
        <div class="row" style="padding-bottom: 10px;">
          <div class="col-sm-6 text-left">{{ pagination }}</div>
          <div class="col-sm-6 text-right">{{ results }}</div>
        </div>
<!-- CountryManager -->
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
<td class="text-left">{{ country.name }}</td>
			]]></search>
			<add position="before"><![CDATA[
<!-- CountryManager -->
              <td class="text-left">{{ country.country_id }}</td>
<!-- CountryManager -->
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
<td class="text-left">{{ country.iso_code_3 }}</td>
			]]></search>
			<add position="after"><![CDATA[
<!-- CountryManager -->
              <td class="text-left">
				{% if country.postcode > 0 %}
                    <span style="font-size: 90%;" class="label label-info">{{ text_yes }}</span>
                {% else %}
                    {{ text_no }}
                {% endif %}
			  </td>

              <td class="text-left">
			  	{% if country.status > 0 %}
                    <span style="font-size: 90%;" class="label label-success">{{ text_enabled }}</span>
                {% else %}
                    <span style="font-size: 90%;" class="label label-warning">{{ text_disabled }}</span>
                {% endif %}
			  </td>
<!-- CountryManager -->
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
{{ footer }}
			]]></search>
			<add position="after"><![CDATA[
<!-- CountryManager -->
<script type="text/javascript"><!--
$(document).ready(function() {
	$('a[data-confirm]').click(function(ev) {
		var href = $(this).attr('href');
		if (!$('#dataConfirmModal').length) {
			$('body').append('<div id="dataConfirmModal" class="modal" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-body"></div><div class="modal-footer"><button class="btn btn-default" data-dismiss="modal" aria-hidden="true">{{ text_no }}</button><a class="btn btn-danger" id="dataConfirmOK">{{ text_yes }}</a></div></div></div></div>');
		} 
		$('#dataConfirmModal').find('.modal-body').text($(this).attr('data-confirm')+' ?');
		$('#dataConfirmOK').attr('href', href);
		$('#dataConfirmModal').modal({show:true});
		return false;
	});
});

function filter() {
	url = 'index.php?route=localisation/country&user_token={{ user_token }}';

	var filter_id = $('input[name=\'filter_id\']').val();
	
	if (filter_id) {
		url += '&filter_id=' + encodeURIComponent(filter_id);
	}

	var filter_status = $('select[name=\'filter_status\']').val();
	
	if (filter_status !='*') {
		url += '&filter_status=' + encodeURIComponent(filter_status);
	}

	var filter_code = $('select[name=\'filter_code\']').val();
	
	if (filter_code !='*') {
		url += '&filter_code=' + encodeURIComponent(filter_code);
	}

	var filter_country = $('input[name=\'filter_country\']').val();
	
	if (filter_country) {
		url += '&filter_country=' + encodeURIComponent(filter_country);
	}

	var filter_iso2 = $('input[name=\'filter_iso2\']').val();
	
	if (filter_iso2) {
		url += '&filter_iso2=' + encodeURIComponent(filter_iso2);
	}

	var filter_iso3 = $('input[name=\'filter_iso3\']').val();
	
	if (filter_iso3) {
		url += '&filter_iso3=' + encodeURIComponent(filter_iso3);
	}

	location = url;
}

function clear_filter() {
	$('select[class=\'form-control\']').val('*');
	$('input[class=\'form-control\']').val('');
	filter();
	return false;
}
//--></script>  
<script type="text/javascript"><!--
$('input[class=\'form-control\']').keydown(function(e) {
	if (e.keyCode == 13) {
		filter();
	}
});

$('#button-filter').on('click', function() {
		filter();
});

$('#button-clear').on('click', function() {
		clear_filter();
});
//--></script>
			]]></add>
		</operation>
	</file>

	<file path="admin/controller/localisation/country.php">
		<operation error="abort">
			<search><![CDATA[
$url .= '&sort=' . $this->request->get['sort'];
			]]></search>
			<add position="after" offset="1"><![CDATA[
			// CountryManager
			if (isset($this->request->get['filter_id'])) {
				$url .= '&filter_id=' . $this->request->get['filter_id'];
			}

			if (isset($this->request->get['filter_status'])) {
				$url .= '&filter_status=' . $this->request->get['filter_status'];
			}

			if (isset($this->request->get['filter_code'])) {
				$url .= '&filter_code=' . $this->request->get['filter_code'];
			}

			if (isset($this->request->get['filter_country'])) {
				$url .= '&filter_country=' . urlencode(html_entity_decode($this->request->get['filter_country'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso2'])) {
				$url .= '&filter_iso2=' . urlencode(html_entity_decode($this->request->get['filter_iso2'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso3'])) {
				$url .= '&filter_iso3=' . urlencode(html_entity_decode($this->request->get['filter_iso3'], ENT_QUOTES, 'UTF-8'));
			}
			// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
function getList() {
			]]></search>
			<add  position="after"><![CDATA[
		// CountryManager
		if (isset($this->request->get['filter_id'])) {
			$filter_id = $this->request->get['filter_id'];
		} else {
			$filter_id = null;
		}

		if (isset($this->request->get['filter_status'])) {
			$filter_status = $this->request->get['filter_status'];
		} else {
			$filter_status = null;
		}

		if (isset($this->request->get['filter_code'])) {
			$filter_code = $this->request->get['filter_code'];
		} else {
			$filter_code = null;
		}

		if (isset($this->request->get['filter_country'])) {
			$filter_country = $this->request->get['filter_country'];
		} else {
			$filter_country = null;
		}

		if (isset($this->request->get['filter_iso2'])) {
			$filter_iso2 = $this->request->get['filter_iso2'];
		} else {
			$filter_iso2 = null;
		}

		if (isset($this->request->get['filter_iso3'])) {
			$filter_iso3 = $this->request->get['filter_iso3'];
		} else {
			$filter_iso3 = null;
		}
		// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
'sort'  => $sort,
			]]></search>
			<add position="before"><![CDATA[
		// CountryManager
			'filter_id'         => $filter_id,
			'filter_status'     => $filter_status,
			'filter_code'       => $filter_code,
			'filter_country'    => $filter_country,
			'filter_iso2'       => $filter_iso2,
			'filter_iso3'       => $filter_iso3,
		// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
$data['sort'] = $sort;
			]]></search>
			<add position="before"><![CDATA[
		// CountryManager
			$data['filter_id'] = $filter_id;
			$data['filter_status'] = $filter_status;
			$data['filter_code'] = $filter_code;
			$data['filter_country'] = $filter_country;
			$data['filter_iso2'] = $filter_iso2;
			$data['filter_iso3'] = $filter_iso3;
			$data['user_token'] = $this->session->data['user_token'];
		// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
if ($order == 'ASC') {
			]]></search>
			<add position="before"><![CDATA[
		// CountryManager
			if (isset($this->request->get['filter_id'])) {
				$url .= '&filter_id=' . $this->request->get['filter_id'];
			}

			if (isset($this->request->get['filter_status'])) {
				$url .= '&filter_status=' . $this->request->get['filter_status'];
			}

			if (isset($this->request->get['filter_code'])) {
				$url .= '&filter_code=' . $this->request->get['filter_code'];
			}

			if (isset($this->request->get['filter_country'])) {
				$url .= '&filter_country=' . urlencode(html_entity_decode($this->request->get['filter_country'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso2'])) {
				$url .= '&filter_iso2=' . urlencode(html_entity_decode($this->request->get['filter_iso2'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso3'])) {
				$url .= '&filter_iso3=' . urlencode(html_entity_decode($this->request->get['filter_iso3'], ENT_QUOTES, 'UTF-8'));
			}
		// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
$country_total = $this->model_localisation_country->getTotalCountries();
			]]></search>
			<add position="replace"><![CDATA[
		// CountryManager
			$country_total = $this->model_localisation_country->getTotalCountryManager($filter_data);
		// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
$data['sort_name'] = $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . '&sort=name' . $url, true);
			]]></search>
			<add position="before"><![CDATA[
		// CountryManager
			$data['sort_id'] = $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . '&sort=country_id' . $url, true);
		// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
$data['delete'] = $this->url->link(
			]]></search>
			<add position="before"><![CDATA[
		// CountryManager
			$data['enable_all'] = $this->url->link('localisation/country/enable_all', 'user_token=' . $this->session->data['user_token'] . $url, true);
			$data['disable_all'] = $this->url->link('localisation/country/disable_all', 'user_token=' . $this->session->data['user_token'] . $url, true);
			$data['enable_country'] = $this->url->link('localisation/country/enable_country', 'user_token=' . $this->session->data['user_token'] . $url, true);
			$data['disable_country'] = $this->url->link('localisation/country/disable_country', 'user_token=' . $this->session->data['user_token'] . $url, true);
		// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
'country_id' => $result['country_id'],
			]]></search>
			<add position="after"><![CDATA[
		// CountryManager
			'postcode' => $result['postcode_required'],
			'status' => $result['status'],
		// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
public function delete() {
			]]></search>
			<add position="before"><![CDATA[
		// CountryManager
	public function disable_all() {
		$this->language->load('localisation/country');
 
		$this->document->setTitle($this->language->get('heading_title'));
		
		$this->load->model('localisation/country');

		if (!$this->user->hasPermission('modify', 'localisation/country')) {
			$this->error['warning'] = $this->language->get('error_permission');

		} else {
			
			$this->model_localisation_country->disableAllCountry();
			
			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';
			
			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['filter_id'])) {
				$url .= '&filter_id=' . $this->request->get['filter_id'];
			}

			if (isset($this->request->get['filter_status'])) {
				$url .= '&filter_status=' . $this->request->get['filter_status'];
			}

			if (isset($this->request->get['filter_code'])) {
				$url .= '&filter_code=' . $this->request->get['filter_code'];
			}

			if (isset($this->request->get['filter_country'])) {
				$url .= '&filter_country=' . urlencode(html_entity_decode($this->request->get['filter_country'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso2'])) {
				$url .= '&filter_iso2=' . urlencode(html_entity_decode($this->request->get['filter_iso2'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso3'])) {
				$url .= '&filter_iso3=' . urlencode(html_entity_decode($this->request->get['filter_iso3'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true));
		}

		$this->getList();
	}

	public function enable_all() {
		$this->language->load('localisation/country');
 
		$this->document->setTitle($this->language->get('heading_title'));
		
		$this->load->model('localisation/country');

		if (!$this->user->hasPermission('modify', 'localisation/country')) {
			$this->error['warning'] = $this->language->get('error_permission');

		} else {
			
			$this->model_localisation_country->enableAllCountry();
			
			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';
			
			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['filter_id'])) {
				$url .= '&filter_id=' . $this->request->get['filter_id'];
			}

			if (isset($this->request->get['filter_status'])) {
				$url .= '&filter_status=' . $this->request->get['filter_status'];
			}

			if (isset($this->request->get['filter_code'])) {
				$url .= '&filter_code=' . $this->request->get['filter_code'];
			}

			if (isset($this->request->get['filter_country'])) {
				$url .= '&filter_country=' . urlencode(html_entity_decode($this->request->get['filter_country'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso2'])) {
				$url .= '&filter_iso2=' . urlencode(html_entity_decode($this->request->get['filter_iso2'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso3'])) {
				$url .= '&filter_iso3=' . urlencode(html_entity_decode($this->request->get['filter_iso3'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true));
		}

		$this->getList();
	}

	public function enable_country() {
		$this->language->load('localisation/country');
 
		$this->document->setTitle($this->language->get('heading_title'));
		
		$this->load->model('localisation/country');

		if (!$this->user->hasPermission('modify', 'localisation/country')) {
			$this->error['warning'] = $this->language->get('error_permission');
		} elseif (isset($this->request->post['selected'])) {

			foreach ($this->request->post['selected'] as $country_id) {
			$this->model_localisation_country->enableCountry($country_id);
			}

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';
			
			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['filter_id'])) {
				$url .= '&filter_id=' . $this->request->get['filter_id'];
			}

			if (isset($this->request->get['filter_status'])) {
				$url .= '&filter_status=' . $this->request->get['filter_status'];
			}

			if (isset($this->request->get['filter_code'])) {
				$url .= '&filter_code=' . $this->request->get['filter_code'];
			}

			if (isset($this->request->get['filter_country'])) {
				$url .= '&filter_country=' . urlencode(html_entity_decode($this->request->get['filter_country'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso2'])) {
				$url .= '&filter_iso2=' . urlencode(html_entity_decode($this->request->get['filter_iso2'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso3'])) {
				$url .= '&filter_iso3=' . urlencode(html_entity_decode($this->request->get['filter_iso3'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true));
		}

		$this->getList();
	}

	public function disable_country() {
		$this->language->load('localisation/country');
 
		$this->document->setTitle($this->language->get('heading_title'));
		
		$this->load->model('localisation/country');

		if (!$this->user->hasPermission('modify', 'localisation/country')) {
			$this->error['warning'] = $this->language->get('error_permission');
		} elseif (isset($this->request->post['selected'])) {

			foreach ($this->request->post['selected'] as $country_id) {
			$this->model_localisation_country->disableCountry($country_id);
			}

			$this->session->data['success'] = $this->language->get('text_success');

			$url = '';
			
			if (isset($this->request->get['sort'])) {
				$url .= '&sort=' . $this->request->get['sort'];
			}

			if (isset($this->request->get['filter_id'])) {
				$url .= '&filter_id=' . $this->request->get['filter_id'];
			}

			if (isset($this->request->get['filter_status'])) {
				$url .= '&filter_status=' . $this->request->get['filter_status'];
			}

			if (isset($this->request->get['filter_code'])) {
				$url .= '&filter_code=' . $this->request->get['filter_code'];
			}

			if (isset($this->request->get['filter_country'])) {
				$url .= '&filter_country=' . urlencode(html_entity_decode($this->request->get['filter_country'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso2'])) {
				$url .= '&filter_iso2=' . urlencode(html_entity_decode($this->request->get['filter_iso2'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['filter_iso3'])) {
				$url .= '&filter_iso3=' . urlencode(html_entity_decode($this->request->get['filter_iso3'], ENT_QUOTES, 'UTF-8'));
			}

			if (isset($this->request->get['order'])) {
				$url .= '&order=' . $this->request->get['order'];
			}

			if (isset($this->request->get['page'])) {
				$url .= '&page=' . $this->request->get['page'];
			}

			$this->response->redirect($this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token'] . $url, true));
		}

		$this->getList();
	}
		// CountryManager end
			]]></add>
		</operation>
	</file>

	<file path="admin/model/localisation/country.php">		
		<operation error="abort">
			<search><![CDATA[
$sort_data = array(
			]]></search>
			<add position="after"><![CDATA[
			// CountryManager
				'country_id',
			// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
			]]></search>
			<add position="before"><![CDATA[
	// CountryManager
			$sql .= " WHERE name <> 'AlexDW' ";
		if (isset($data['filter_id'])) {
			$sql .= " AND country_id LIKE '%" . (int)$data['filter_id'] . "%'";
		}

		if (isset($data['filter_status'])) {
		if (($data['filter_status']) == 1) {
			$sql .= " AND status = '1'";
		} else {
			$sql .= " AND status <> '1'";
		}
		}

		if (isset($data['filter_code'])) {
		if (($data['filter_code']) == 1) {
			$sql .= " AND postcode_required = '1'";
		} else {
			$sql .= " AND postcode_required <> '1'";
		}
		}

		if (isset($data['filter_country'])) {
			$sql .= " AND name LIKE '%" . $this->db->escape($data['filter_country']) . "%'";
		}

		if (isset($data['filter_iso2'])) {
			$sql .= " AND iso_code_2 LIKE '%" . $this->db->escape($data['filter_iso2']) . "%'";
		}

		if (isset($data['filter_iso3'])) {
			$sql .= " AND iso_code_3 LIKE '%" . $this->db->escape($data['filter_iso3']) . "%'";
		}
	// CountryManager end
			]]></add>
		</operation>
		<operation error="abort">
			<search><![CDATA[
public function getTotalCountries() {
			]]></search>
			<add position="before"><![CDATA[
	// CountryManager
		public function getTotalCountryManager($data = array()) {
		
			$sql = "SELECT COUNT(*) AS total FROM " . DB_PREFIX . "country ";
			$sql .= " WHERE 1 ";

		if (isset($data['filter_id'])) {
			$sql .= " AND country_id LIKE '%" . (int)$data['filter_id'] . "%'";
		}

		if (isset($data['filter_status'])) {
		if (($data['filter_status']) == 1) {
			$sql .= " AND status = '1'";
		} else {
			$sql .= " AND status <> '1'";
		}
		}

		if (isset($data['filter_code'])) {
		if (($data['filter_code']) == 1) {
			$sql .= " AND postcode_required = '1'";
		} else {
			$sql .= " AND postcode_required <> '1'";
		}
		}

		if (isset($data['filter_country'])) {
			$sql .= " AND name LIKE '%" . $this->db->escape($data['filter_country']) . "%'";
		}

		if (isset($data['filter_iso2'])) {
			$sql .= " AND iso_code_2 LIKE '%" . $this->db->escape($data['filter_iso2']) . "%'";
		}

		if (isset($data['filter_iso3'])) {
			$sql .= " AND iso_code_3 LIKE '%" . $this->db->escape($data['filter_iso3']) . "%'";
		}
			$query = $this->db->query($sql);

			return $query->row['total'];
		}

		public function disableAllCountry() {
			$query = $this->db->query("UPDATE " . DB_PREFIX . "country SET `status`='0' ");
			$this->cache->delete('country');
		}

		public function enableAllCountry() {
			$query = $this->db->query("UPDATE " . DB_PREFIX . "country SET `status`='1' ");
			$this->cache->delete('country');
		}

		public function enableCountry($country_id) {
			$this->db->query("UPDATE " . DB_PREFIX . "country SET `status`='1' WHERE country_id = '" . (int)$country_id . "'");
			$this->cache->delete('country');	
		}

		public function disableCountry($country_id) {
			$this->db->query("UPDATE " . DB_PREFIX . "country SET `status`='0' WHERE country_id = '" . (int)$country_id . "'");
			$this->cache->delete('country');	
		}
	// CountryManager end
			]]></add>
		</operation>
	</file>

	<file path="admin/language/en-gb/localisation/country.php">		
		<operation error="skip">
			<search><![CDATA[
<?php
			]]></search>
			<add position="after"><![CDATA[
			// CountryManager
				$_['button_enable_all']    = 'Enable All Countries';
				$_['button_disable_all']   = 'Disable All Countries';
				$_['button_enable_country']    = 'Enable Selected';
				$_['button_disable_country']   = 'Disable Selected';
			// CountryManager end
			]]></add>
		</operation>
	</file>

	<file path="admin/language/ru-ru/localisation/country.php">		
		<operation error="skip">
			<search><![CDATA[
<?php
			]]></search>
			<add position="after"><![CDATA[
			// CountryManager
				$_['button_enable_all']    = 'Включить все страны';
				$_['button_disable_all']   = 'Отключить все страны';
				$_['button_enable_country']    = 'Включить выбранные';
				$_['button_disable_country']   = 'Отключить выбранные';
			// CountryManager end
			]]></add>
		</operation>
	</file>

</modification>