Major API change for the module. Compatibility with the Bitrix API has been added. The minimum required version of the 1C-Bitrix Main module is now 17.0.9.
Support for Bitrix Geolocation functionality has been added. The module now includes one of the Geolocation Handlers, in addition to the pre-installed ones.
The module can now be used in standard Bitrix functionality for city search (for example, in the standard location search in the new order form) if the handler is enabled on the geolocation handlers list page.
After updating, a new handler should appear on the «Settings - Product Settings - Geolocation» page. Alternatively, it will be available in the list on the «Add» button.
API compatibility with module versions is preserved. The module can be updated on sites where it was previously installed.
If you are hesitant to update, create a backup of the /bitrix/modules/askaron.geo/ folder.
The method \Askaron\Geo\Info::getIp() now internally calls the standard \Bitrix\Main\Service\GeoIp\Manager::getRealIp(). They are practically identical.
The method \Askaron\Geo\Info::getIp(), as before, returns a different $ip if \Askaron\Geo\Info::setIp($ip) was called.
The method \Askaron\Geo\Info::getSxGeoCityFull($ip = '') now accepts an optional $ip parameter. If the IP is not set or is empty, the address is taken from \Askaron\Geo\Info::getIp() as before.
The method \Askaron\Geo\Info::getSxGeoCityFull() is now highly discouraged for use in your own code.
The method $arLocation = \Askaron\Geo\Location::getLocation() continues to work as before.
However, a standard Bitrix method with our and other handlers has also been added. It returns a geolocation object, or null if not found, or if all handlers are disabled.
$result = \Bitrix\Main\Service\GeoIp\Manager::getDataResult(\Askaron\Geo\Info::getIp(), "ru");
The method \Askaron\Geo\Info::getSxGeoCityFull() works faster than \Bitrix\Main\Service\GeoIp\Manager::getDataResult(). However, this difference is practically imperceptible.
The method \Bitrix\Main\Service\GeoIp\Manager::getDataResult() works with any geolocation handlers, so use it now.
The method $arLocation = \Askaron\Geo\Location::getLocation() now internally calls \Bitrix\Main\Service\GeoIp\Manager::getDataResult() and accesses all installed handlers.
If all geolocation handlers are disabled or nothing is found, it calls \Askaron\Geo\Info::getSxGeoCityFull() a second time for compatibility with sites where the module was previously installed.
\Askaron\Geo\Location::getLocation() caches the result for the user, so no additional load is created.