public function getGeoDataByIp($mode) { if (!ModelToolSimpleGeo::$ip_checked) { if ($mode == self::SIMPLE_GEO_OWN) { ModelToolSimpleGeo::$geo = $this->getGeoIpBySimpleOpenCart(); } elseif ($mode == self::SIMPLE_GEO_MAXMIND_EXTENSION) { ModelToolSimpleGeo::$geo = $this->getGeoIpByMaxMind(); } elseif ($mode == self::SIMPLE_GEO_MAXMIND_TABLE) { ModelToolSimpleGeo::$geo = $this->getGeoIpByMaxMindFromDataBase(); } else { ModelToolSimpleGeo::$geo = array('country_id' => '', 'zone_id' => '', 'city' => '', 'postcode' => ''); } ModelToolSimpleGeo::$ip_checked = true; } return ModelToolSimpleGeo::$geo; }
public function getGeoIp() { if (!ModelToolSimpleGeo::$ip_checked) { ModelToolSimpleGeo::$geo = $this->getGeoIpBySimpleOpenCart(); if (!is_array(ModelToolSimpleGeo::$geo)) { ModelToolSimpleGeo::$geo = $this->getGeoIpByMaxMind(); } //ModelToolSimpleGeo::$geo = $this->getGeoIpByMaxMindFromDataBase(); /* // You can add own logic for determining geo data of customer by IP address, for example you can install extension from maxmind.com // But value returned from this method must contain this fields: $geo = array( 'country_id' => '', 'zone_id' => '', 'city' => '', 'postcode' => '' ); */ ModelToolSimpleGeo::$ip_checked = true; } return ModelToolSimpleGeo::$geo; }