Some fixes (#11)
This commit is contained in:
parent
1cb97f9e92
commit
3f54a8fc89
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/nbproject/private/
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user