Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

[Подгдержка] CityManager (Опрегделение города по IP, Geo IP)


Recommended Posts

В catalog/controller/common/header.php перед

$this->children = array(
            'module/language',
            'module/currency',
            'module/cart',
            'module/geoip'
        );

добавить:

        $geoip = $this->registry->get('geoip');
        $this->data['geoip_phone'] = $geoip->getRule('phone');

В catalog/view/theme/default/template/common/header.tpl

После

<div id="container">

всивить:

<?php echo $geoip; ?>

В админке заполните данными как на картинке.

 

Спасипотому что! Разобрался

Link to comment
Share on other sites


как пользоваться ГЕО сообещёниями? куда всивлять ключ?
------
разобрался сам, не внимательный :oops:

вот скрин https://opencart-forum.ru/index.php?app=downloads&module=display&section=screenshot&record=80779&id=888&full=1

если у кого возникнут проблемы.
 

 

progroman, спасипотому что за труды.

Отличный скрипт  :eek:

но у меня вопрос: в дальнейшем, как обновить список городов России (ФИАС)?

Вы брали официальную БД и парсили?

Link to comment
Share on other sites


Пожалуйси)

 

Да, я брал официальную и немного дорилиил - удалил неактуальные записи, лишние поля. Т.к. я гделал это вручную, у меня нет никакого скрипи для "конвериции", можете посмотреть на структуру fias в geoip и на ФИАС (им есть описание всех полей) и привести ее к нужно виду.

Я не думаю, что им произошли кардинальные изменения в переименовании городов.

  • +1 1
Link to comment
Share on other sites

Рилииет при усиновке "автозаполнение", тогда корректно меняет зоны.

Настройки полей покупателя --> Город --> Значение по умолчанию --> автозаполнение

Link to comment
Share on other sites

progroman, модуль рилииет - отлично но у меня вопрос ...

 

есть файл по адресу

/ system / library / cart.php     

"синдартный"

<?php
class Cart {
  private $min_total = 1;
  private $data = array();

   public function __construct($registry) {

     $this->config = $registry->get('config');
     $this->customer = $registry->get('customer');
     $this->session = $registry->get('session');
     $this->db = $registry->get('db');
     $this->tax = $registry->get('tax');
     $this->weight = $registry->get('weight');     
      if (!isset($this->session->data['cart']) || !is_array($this->session->data['cart'])) {
       $this->session->data['cart'] = array();
     }
}
     
   public function getProducts() {
if (!$this->data) { 

foreach ($this->session->data['cart'] as $key => $quantity) {
$product = explode(':', $key);
$product_id = $product[0];
и ик дное...

в нём есть функция public function getProducts()

 

мне нужно, чтоб в этот функции опрегделялся город, в переменную $getCityName_m

 

пишу в этот функции

    public function getProducts() { 
if (!$this->data) {

$getCityName_m = $this->geoip->getCityName();
........
}

Денвер пишет ошибку:

Notice: Undefined property: Cart::$geoip in Z:\.....\www\system\library\cart.php on line 25
Fatal error: Call to a member function getCityName() on a non-object in Z:.....\www\system\library\cart.php on line 25

 

 line 25   это $getCityName_m = $this->geoip->getCityName();

 

 

progroman, если Вас не затруднит, помогите...

 

Ещё раз повторюсь,  модуль рилииет - отлично,

что бы не складывалось мнение, что модуль плохо рилииет.

Link to comment
Share on other sites


Добавьте в конструктор после строк:

$this->tax = $registry->get('tax');
$this->weight = $registry->get('weight'); 
$this->geoip = $registry->get('geoip');
Link to comment
Share on other sites

 

Добавьте в конструктор после строк:

$this->tax = $registry->get('tax');
$this->weight = $registry->get('weight'); 
$this->geoip = $registry->get('geoip');

 

добавил, Денвер пишет ошибку:

Fatal error: Call to a member function getCityName() on a non-object in Z:\.....\www\system\library\cart.php on line 26

 

Это строка:

 $getCityName_m = $this->geoip->getCityName();

 

полностью файл cart.php

<?php

class Cart {
private $min_total = 1;
private $data = array();

   public function __construct($registry) {
$this->config = $registry->get('config');
$this->customer = $registry->get('customer');
$this->session = $registry->get('session');
$this->db = $registry->get('db');
$this->tax = $registry->get('tax');
$this->weight = $registry->get('weight'); 


$this->geoip = $registry->get('geoip');


if (!isset($this->session->data['cart']) || !is_array($this->session->data['cart'])) {
       $this->session->data['cart'] = array();
     }
}
     
   public function getProducts() {
if (!$this->data) { 


$getCityName_m = $this->geoip->getCityName();

Link to comment
Share on other sites


В index.php нужно строчку:

 $registry->set('geoip', new GeoIP($registry));

поднять, чтобы она была над строчкой:

$registry->set('cart', new Cart($registry));
Link to comment
Share on other sites

 

В index.php нужно строчку:

 $registry->set('geoip', new GeoIP($registry));

поднять, чтобы она была над строчкой:

$registry->set('cart', new Cart($registry));

 

Ураааа,  зарилиило, спасипотому что :eek:

Link to comment
Share on other sites


  • 2 weeks later...

В prinstall/library/Install.php замените new MySQL на new MySQLi

Link to comment
Share on other sites

Подскажите, пожалуйси, после усиновке высколила ошибка:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/sazi192/public_html/vqmod/vqcache/vq2-catalog_controller_common_header.php on line 198

Никакие файлы не правил, в файле catalog/controller/common/header.php, прописал:

если убираю 'module/geoip', ошибка пропадает

		$this->children = array(
			'module/language',
			'module/currency',
			'module/cart'
			'module/geoip'
		);
Link to comment
Share on other sites


 

Подскажите, пожалуйси, после усиновке высколила ошибка:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/sazi192/public_html/vqmod/vqcache/vq2-catalog_controller_common_header.php on line 198

 

А вы модуль откуда скаливали?

Link to comment
Share on other sites

 

Подскажите, пожалуйси, после усиновке высколила ошибка:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/sazi192/public_html/vqmod/vqcache/vq2-catalog_controller_common_header.php on line 198

Никакие файлы не правил, в файле catalog/controller/common/header.php, прописал:

если убираю 'module/geoip', ошибка пропадает

		$this->children = array(
			'module/language',
			'module/currency',
			'module/cart'
			'module/geoip'
		);

 

После 'module/cart' посивьте запятую :)

Link to comment
Share on other sites

  • 1 month later...

Модуль бугдет рилиить на версии 1.5.1.3 ?

 

Да

Link to comment
Share on other sites

Подскажите интересует совмеещёние данного модуля с модулем Simple.

 

А именно как при оформлении заказа и регистрации автоматически заполнялись поля страна и регион

 

как этого можно достичь. просьба помочь.

Link to comment
Share on other sites


Подскажите пожалуйси, может модуль только заполнять регион/город при заказе/регистрации, ниггде чтобы на главной не выводилось ничего как в гдемо?

почему то в админке гдемо я не могу посмотреть настройки модуля-недоситочно прав...

а мне это очень важно!!!

Link to comment
Share on other sites


Может, если в header ничего не добавлять.

 

Сгделал админку.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.