1
0
mirror of synced 2025-01-31 07:11:42 +03:00

Some fixes (#11)

This commit is contained in:
dewalt201 2017-08-24 08:40:05 +03:00 committed by Alex Lushpai
parent 1cb97f9e92
commit 3f54a8fc89
2 changed files with 28 additions and 17 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/nbproject/private/

View File

@ -289,29 +289,39 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) :
$user_data_billing = $order->get_address('billing');
if (!empty($user_data_billing)) {
if (!empty($user_data_billing['phone'])) $order_data['phone'] = $user_data_billing['phone'];
if (!empty($user_data_billing['email'])) $order_data['email'] = $user_data_billing['email'];
if (!empty($user_data_billing['first_name'])) $order_data['firstName'] = $user_data_billing['first_name'];
if (!empty($user_data_billing['last_name'])) $order_data['lastName'] = $user_data_billing['last_name'];
if (!empty($user_data_billing['postcode'])) $order_data['delivery']['address']['index'] = $user_data_billing['postcode'];
if (!empty($user_data_billing['city'])) $order_data['delivery']['address']['city'] = $user_data_billing['city'];
if (!empty($user_data_billing['country'])) $order_data['delivery']['address']['countryIso'] = $user_data_billing['country'];
}
$user_data = $order->get_address('shipping');
if (!empty($user_data)) {
if (!empty($user_data['phone'])) $order_data['phone'] = $user_data['phone'];
if (!empty($user_data['email'])) $order_data['email'] = $user_data['email'];
if (!empty($user_data['first_name'])) $order_data['firstName'] = $user_data['first_name'];
if (!empty($user_data['last_name'])) $order_data['lastName'] = $user_data['last_name'];
if (!empty($user_data['postcode'])) $order_data['delivery']['address']['index'] = $user_data['postcode'];
if (!empty($user_data['city'])) $order_data['delivery']['address']['city'] = $user_data['city'];
if (!empty($user_data['country'])) $order_data['delivery']['address']['countryIso'] = $user_data['country'];
$order_data['delivery']['address']['text'] = sprintf(
"%s %s %s %s",
$user_data['postcode'],
$user_data['city'],
$user_data['address_1'],
$user_data['address_2']
);
}
$order_data['delivery']['address']['text'] = sprintf(
"%s %s %s %s",
!empty($user_data_billing['postcode']) ? $user_data_billing['postcode'] : $user_data['postcode'],
!empty($user_data_billing['city']) ? $user_data_billing['city'] : $user_data['city'],
!empty($user_data_billing['address_1']) ? $user_data_billing['address_1'] : $user_data['address_1'],
!empty($user_data_billing['address_2']) ? $user_data_billing['address_2'] : $user_data['address_2']
);
$order_items = array();
foreach ($order->get_items() as $item) {