1
0
mirror of synced 2024-11-25 23:06:08 +03:00

Merge pull request #70 from Evgeniy-Goroh/master

search city by zip code
This commit is contained in:
Alex Lushpai 2019-07-18 11:59:35 +03:00 committed by GitHub
commit 3e8b496e95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 {
if ( !isset($location) ) {
$location = \Bitrix\Sale\Location\Search\Finder::find($parameters, array('USE_INDEX' => false, 'USE_ORM' => false))->fetch(); $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) {