State fix
This commit is contained in:
parent
61ae452aec
commit
fec8645764
@ -1,3 +1,6 @@
|
|||||||
|
## 2020-06-18 3.6.4
|
||||||
|
* Передача названия региона / штата / провинции вместо кода
|
||||||
|
|
||||||
## 2020-06-10 3.6.3
|
## 2020-06-10 3.6.3
|
||||||
* Улучшено обновление данных заказа по истории
|
* Улучшено обновление данных заказа по истории
|
||||||
|
|
||||||
|
@ -27,4 +27,26 @@ abstract class WC_Retailcrm_Abstracts_Address extends WC_Retailcrm_Abstracts_Dat
|
|||||||
'text' => '',
|
'text' => '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns state name by it's code
|
||||||
|
*
|
||||||
|
* @param string $countryCode
|
||||||
|
* @param string $stateCode
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function get_state_name($countryCode, $stateCode)
|
||||||
|
{
|
||||||
|
if (preg_match('/^[A-Z\-0-9]{0,5}$/', $stateCode) && !is_null($countryCode)) {
|
||||||
|
$countriesProvider = new WC_Countries();
|
||||||
|
$states = $countriesProvider->get_states($countryCode);
|
||||||
|
|
||||||
|
if (!empty($states) && array_key_exists($stateCode, $states)) {
|
||||||
|
return (string) $states[$stateCode];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $stateCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,8 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($arItemsOld)) {
|
if (!empty($arItemsOld)) {
|
||||||
$result = end(array_diff($arItemsNew, $arItemsOld));
|
$diff = array_diff($arItemsNew, $arItemsOld);
|
||||||
|
$result = end($diff);
|
||||||
} else {
|
} else {
|
||||||
$result = end($arItemsNew);
|
$result = end($arItemsNew);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class WC_Retailcrm_Customer_Address extends WC_Retailcrm_Abstracts_Address
|
|||||||
$data = array(
|
$data = array(
|
||||||
'index' => $customer->get_billing_postcode(),
|
'index' => $customer->get_billing_postcode(),
|
||||||
'countryIso' => $customer->get_billing_country(),
|
'countryIso' => $customer->get_billing_country(),
|
||||||
'region' => $customer->get_billing_state(),
|
'region' => $this->get_state_name($customer->get_billing_country(), $customer->get_billing_state()),
|
||||||
'city' => $customer->get_billing_city(),
|
'city' => $customer->get_billing_city(),
|
||||||
'text' => $customer->get_billing_address_1() . ', ' . $customer->get_billing_address_2()
|
'text' => $customer->get_billing_address_1() . ', ' . $customer->get_billing_address_2()
|
||||||
);
|
);
|
||||||
|
@ -26,7 +26,7 @@ class WC_Retailcrm_Order_Address extends WC_Retailcrm_Abstracts_Address
|
|||||||
$data = array(
|
$data = array(
|
||||||
'index' => $address['postcode'],
|
'index' => $address['postcode'],
|
||||||
'city' => $address['city'],
|
'city' => $address['city'],
|
||||||
'region' => $address['state']
|
'region' => $this->get_state_name($address['country'], $address['state'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->set_data_fields($data);
|
$this->set_data_fields($data);
|
||||||
|
@ -45,6 +45,9 @@ API-ключ должен быть для отдельного магазина
|
|||||||
2. В появившихся списках справочников настройте соответствие способов доставки и оплаты, а так же статусов заказов. Отметьте галочку "Выгружать остатки", если хотите выгружать остатки из Retailcrm в магазин (подробнее смотрите в описании).
|
2. В появившихся списках справочников настройте соответствие способов доставки и оплаты, а так же статусов заказов. Отметьте галочку "Выгружать остатки", если хотите выгружать остатки из Retailcrm в магазин (подробнее смотрите в описании).
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 3.6.4 =
|
||||||
|
* Передача названия региона / штата / провинции вместо кода
|
||||||
|
|
||||||
= 3.6.3 =
|
= 3.6.3 =
|
||||||
* Улучшено обновление данных заказа по истории
|
* Улучшено обновление данных заказа по истории
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Version: 3.6.3
|
* Version: 3.6.4
|
||||||
* WC requires at least: 3.0
|
* WC requires at least: 3.0
|
||||||
* WC tested up to: 3.9.3
|
* WC tested up to: 3.9.3
|
||||||
* Plugin Name: WooCommerce retailCRM
|
* Plugin Name: WooCommerce retailCRM
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @link https://wordpress.org/plugins/woo-retailcrm/
|
* @link https://wordpress.org/plugins/woo-retailcrm/
|
||||||
* @version 3.6.3
|
* @version 3.6.4
|
||||||
*
|
*
|
||||||
* @package RetailCRM
|
* @package RetailCRM
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user