<?xml version="1.0" encoding="utf-8"?>
<modification>
    <code>GeoIP OC-2 5.3</code>
    <name>GeoIP</name>
    <version>5.3</version>
    <author>Roman Shipilov</author>
    <link>http://opencart.progroman.ru/demo/1/</link>

    <!-- Подключение модуля -->
    <file path="catalog/controller/common/header.php">
        <operation>
            <search><![CDATA[$data['language'] = $this->load->controller('common/language');]]></search>
            <add position="before"><![CDATA[		$data['geoip'] = $this->load->controller('module/geoip');]]></add>
        </operation>
    </file>

    <!-- Подключение css и js -->
    <file path="catalog/view/theme/*/template/common/header.tpl">
        <operation>
            <search><![CDATA[<?php foreach ($styles as $style) { ?>]]></search>
            <add position="before"><![CDATA[<link href="catalog/view/theme/default/stylesheet/geoip.css" rel="stylesheet">]]></add>
        </operation>
        <operation>
            <search><![CDATA[</head>]]></search>
            <add position="before">
                <![CDATA[<script src="catalog/view/javascript/jquery/jquery.geoip-module.js" type="text/javascript"></script>]]></add>
        </operation>
    </file>

    <!-- Добавляем вывод города на странице регистрации -->
    <file path="catalog/controller/account/register.php">
        <operation>
            <search>
                <![CDATA[$data['city'] = $this->request->post['city'];]]>
            </search>
            <add position="after">
                <![CDATA[		} elseif (isset($this->session->data['shipping_address']['city'])) {
            $data['city'] = $this->session->data['shipping_address']['city'];]]>
            </add>
        </operation>
    </file>

    <!-- Добавляем вывод города при оформлении заказа с регистрацией -->
    <file path="catalog/controller/checkout/register.php,catalog/controller/checkout/payment_address.php,catalog/controller/checkout/shipping_address.php">
        <operation>
            <search index="0">
                <![CDATA[$this->load->model('localisation/country');]]>
            </search>
            <add position="before">
                <![CDATA[
        if (isset($this->session->data['shipping_address']['city'])) {
            $data['city'] = $this->session->data['shipping_address']['city'];
        } else {
            $data['city'] = '';
        }
        ]]>
            </add>
        </operation>
    </file>
    <file path="catalog/view/theme/*/template/checkout/register.tpl,catalog/view/theme/*/template/checkout/payment_address.tpl,catalog/view/theme/*/template/checkout/shipping_address.tpl">
        <operation>
            <search>
                <![CDATA[<input type="text" name="city" value=""]]>
            </search>
            <add position="replace">
                <![CDATA[<input type="text" name="city" value="<?php echo $city; ?>"]]>
            </add>
        </operation>
    </file>

    <!-- SimpleGeo -->
    <file path="catalog/model/tool/simplegeo.php">
        <operation>
            <search>
                <![CDATA[if ($mode == self::SIMPLE_GEO_OWN)]]>
            </search>
            <add position="before">
                <![CDATA[
            $geoip = $this->registry->get('geoip');
            if ($geoip->getZoneId()) {
	            ModelToolSimpleGeo::$geo = $geoip->getFullInfo();
            } else]]>
            </add>
        </operation>
    </file>

</modification>