From 0ad1bde3f853cc4b6e138a2d0d2128d6922d64b6 Mon Sep 17 00:00:00 2001 From: Alexandr Krasnij Date: Mon, 8 Jun 2020 19:17:31 +0300 Subject: [PATCH] feat: add support address ID --- .../extension/d_vuefront/store/checkout.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/catalog/controller/extension/d_vuefront/store/checkout.php b/catalog/controller/extension/d_vuefront/store/checkout.php index 23452a8..69d50c8 100644 --- a/catalog/controller/extension/d_vuefront/store/checkout.php +++ b/catalog/controller/extension/d_vuefront/store/checkout.php @@ -295,10 +295,14 @@ public function createOrder($args) { $this->session->data['shipping_address'] = array(); + $this->session->data['shipping_address_id'] = ''; + foreach ($this->shippingAddress() as $value) { $this->session->data['shipping_address'][$value['name']] = ''; } + $this->session->data['shipping_address_id'] = ''; + $this->session->data['payment_address'] = array( 'custom_field' => array() ); @@ -349,6 +353,9 @@ public function updateOrder($args) } } + $this->session->data['shipping_address_id'] = $args['shippingAddressId']; + $this->session->data['payment_address_id'] = $args['paymentAddressId']; + if (!empty($args['shippingMethod'])) { $shipping = explode('.', $args['shippingMethod']); @@ -388,6 +395,8 @@ public function confirmOrder() $shippingAddress = $this->session->data['shipping_address']; $paymentAddress = $this->session->data['payment_address']; + $shippingAddressId = $this->session->data['shipping_address_id']; + $paymentAddressId = $this->session->data['payment_address_id']; $shippingMethod = $this->session->data['shipping_method']; @@ -452,6 +461,20 @@ public function confirmOrder() } $this->load->model('account/customer'); + $this->load->model('account/address'); + + if($paymentAddressId !== "") { + $paymentAddress = $this->model_account_address->getAddress($paymentAddressId); + var_dump($paymentAddress); + $paymentAddress['firstName'] = $paymentAddress['first_name']; + $paymentAddress['lastName'] = $paymentAddress['first_name']; + } + + if($shippingAddressId !== "") { + $shippingAddress = $this->model_account_address->getAddress($shippingAddressId); + $shippingAddress['firstName'] = $shippingAddress['first_name']; + $shippingAddress['lastName'] = $shippingAddress['first_name']; + } $order_data['customer_id'] = 0; $order_data['customer_group_id'] = '';