1
0
mirror of synced 2024-11-22 21:36:10 +03:00

search city by zip code

This commit is contained in:
gorokh 2019-07-12 15:00:41 +03:00
parent 6d379c52f5
commit 3bf7da198d

View File

@ -566,6 +566,9 @@ class RetailCrmHistory
} }
} elseif (array_key_exists($key, $order['delivery']['address'])) { } elseif (array_key_exists($key, $order['delivery']['address'])) {
if ($propsKey[$orderProp]['TYPE'] == 'LOCATION') { if ($propsKey[$orderProp]['TYPE'] == 'LOCATION') {
if( $order['delivery']['address']['index'] ) {
$location = CSaleLocation::GetByZIP($order['delivery']['address']['index']);
}
$order['delivery']['address'][$key] = trim($order['delivery']['address'][$key]); $order['delivery']['address'][$key] = trim($order['delivery']['address'][$key]);
if(!empty($order['delivery']['address'][$key])){ if(!empty($order['delivery']['address'][$key])){
$parameters = array(); $parameters = array();
@ -582,7 +585,9 @@ class RetailCrmHistory
$parameters['filter']['NAME.LANGUAGE_ID'] = 'ru'; $parameters['filter']['NAME.LANGUAGE_ID'] = 'ru';
try { try {
$location = \Bitrix\Sale\Location\Search\Finder::find($parameters, array('USE_INDEX' => false, 'USE_ORM' => false))->fetch(); if ( !isset($location) ) {
$location = \Bitrix\Sale\Location\Search\Finder::find($parameters, array('USE_INDEX' => false, 'USE_ORM' => false))->fetch();
}
$somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']); $somePropValue = $propertyCollection->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
self::setProp($somePropValue, $location['CODE']); self::setProp($somePropValue, $location['CODE']);
} catch (\Bitrix\Main\ArgumentException $argumentException) { } catch (\Bitrix\Main\ArgumentException $argumentException) {