Skip to content

Instantly share code, notes, and snippets.

@mamontov-cpp
Created July 12, 2018 09:31
Show Gist options
  • Save mamontov-cpp/eb037a44e553942e3079f291b9ae4887 to your computer and use it in GitHub Desktop.
Save mamontov-cpp/eb037a44e553942e3079f291b9ae4887 to your computer and use it in GitHub Desktop.
/**
* Обновляет координаты склада, если они не заданы, но известен адрес.
*
* @param int $id
* @param bool $forceUpdate принудительно обновить координаты склада
*/
public static function updateGpsGeocode($id, $forceUpdate = false)
{
$arStore = self::getGeoData($id);
$shouldUpdate = true;
if (!$forceUpdate) {
$shouldUpdate = (!$arStore["GPS_N"] && !$arStore["GPS_S"]);
}
if ($shouldUpdate && $arStore["ADDRESS"])
{
$arUpdate = self::loadGps($arStore["ADDRESS"]);
if ($arUpdate && Loader::includeModule("catalog"))
{
\CCatalogStore::Update($id, $arUpdate);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment