diff --git a/admin/language/en-gb/extension/module/retailcrm.php b/admin/language/en-gb/extension/module/retailcrm.php index 9fda572..7b8fe7b 100644 --- a/admin/language/en-gb/extension/module/retailcrm.php +++ b/admin/language/en-gb/extension/module/retailcrm.php @@ -25,7 +25,6 @@ $_['text_success_catalog'] = 'Catalog successfully unloaded'; $_['text_error_order'] = 'Error! Order is not unloaded!'; $_['text_error_order_id'] = 'Error! Enter the correct order number!'; - $_['retailcrm_dict_delivery'] = 'Shipment methods'; $_['retailcrm_dict_status'] = 'Order statuses'; $_['retailcrm_dict_payment'] = 'Payment methods'; diff --git a/admin/model/extension/retailcrm/icml.php b/admin/model/extension/retailcrm/icml.php index d1dea3e..f2f3d47 100644 --- a/admin/model/extension/retailcrm/icml.php +++ b/admin/model/extension/retailcrm/icml.php @@ -220,7 +220,7 @@ class ModelExtensionRetailcrmIcml extends Model ->appendChild($this->dd->createTextNode($product['name'])); } $e->appendChild($this->dd->createElement('price')) - ->appendChild($this->dd->createTextNode($productPrice + $optionsTotalCost)); + ->appendChild($this->dd->createTextNode($product['price'] + $optionsTotalCost)); /** * Vendor */ diff --git a/admin/view/template/extension/module/retailcrm.tpl b/admin/view/template/extension/module/retailcrm.tpl index bf57c3e..2137202 100644 --- a/admin/view/template/extension/module/retailcrm.tpl +++ b/admin/view/template/extension/module/retailcrm.tpl @@ -68,6 +68,25 @@ +

+
+
+ +
+ +
+ +
+
+

+
+ + +
+ @@ -78,6 +97,10 @@

+<<<<<<< HEAD:admin/view/template/extension/module/retailcrm.tpl +======= + +>>>>>>> 82e6d620766d6f21f0041e8744d92bbfc84da472:admin/view/template/extension/module/retailcrm.tpl
@@ -202,4 +225,8 @@ $('#export_order').button('reset'); } }); - \ No newline at end of file +<<<<<<< HEAD:admin/view/template/extension/module/retailcrm.tpl + +======= + +>>>>>>> 82e6d620766d6f21f0041e8744d92bbfc84da472:admin/view/template/extension/module/retailcrm.tpl diff --git a/catalog/controller/api/retailcrm.php b/catalog/controller/api/retailcrm.php index 00ad266..d33ca2b 100644 --- a/catalog/controller/api/retailcrm.php +++ b/catalog/controller/api/retailcrm.php @@ -52,7 +52,22 @@ class ControllerApiRetailcrm extends Controller if ($this->config->get($shippingModule['code'] . '_status')) { if($this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address)) { - $quote_data[] = $this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address); + $method_data = $this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address); + if($method_data['quote']) { + $quote_data[] = $method_data; + } else { + $this->load->language('extension/shipping/' . $shippingModule['code']); + $quote_data[] = array( + 'code' => $shippingModule['code'], + 'title' => $this->language->get('text_description') + ); + } + } else { + $this->load->language('extension/shipping/' . $shippingModule['code']); + $quote_data[] = array( + 'code' => $shippingModule['code'], + 'title' => $this->language->get('text_description') + ); } } } @@ -61,12 +76,15 @@ class ControllerApiRetailcrm extends Controller $deliveryTypes = array(); foreach ($quote_data as $shipping) { - - foreach ($shipping['quote'] as $shippingMethod) { + if(isset($shipping['quote']) && !empty($shipping['quote'])){ + foreach ($shipping['quote'] as $shippingMethod) { + $deliveryTypes[$shipping['code']]['title'] = $shipping['title']; + $deliveryTypes[$shipping['code']][$shippingMethod['code']] = $shippingMethod; + } + } else { $deliveryTypes[$shipping['code']]['title'] = $shipping['title']; - $deliveryTypes[$shipping['code']][$shippingMethod['code']] = $shippingMethod; + $deliveryTypes[$shipping['code']][$shipping['code']] = $shipping; } - } return $deliveryTypes; diff --git a/catalog/model/extension/retailcrm/order.php b/catalog/model/extension/retailcrm/order.php index 0ac3a3d..a473ae6 100644 --- a/catalog/model/extension/retailcrm/order.php +++ b/catalog/model/extension/retailcrm/order.php @@ -64,6 +64,7 @@ class ModelExtensionRetailcrmOrder extends Model { } } } + $order['discount'] = $couponTotal; $order['createdAt'] = $order_data['date_added']; @@ -76,7 +77,12 @@ class ModelExtensionRetailcrmOrder extends Model { $order_data['shipping_iso_code_2'] = $shipping_country['iso_code_2']; } - $delivery_code = $order_data['shipping_code']; + if(isset($settings['retailcrm_delivery'][$order_data['shipping_code']])) { + $delivery_code = $order_data['shipping_code']; + } else { + $delivery_code = stristr($order_data['shipping_code'], '.', TRUE); + } + $order['delivery'] = array( 'code' => !empty($delivery_code) ? $settings['retailcrm_delivery'][$delivery_code] : '', 'cost' => $deliveryCost, @@ -167,8 +173,6 @@ class ModelExtensionRetailcrmOrder extends Model { $order = array(); $payment_code = $order_data['payment_code']; - $delivery_code = $order_data['shipping_code']; - $order['externalId'] = $order_id; $order['firstName'] = $order_data['firstname']; $order['lastName'] = $order_data['lastname']; @@ -193,6 +197,12 @@ class ModelExtensionRetailcrmOrder extends Model { $country = (isset($order_data['shipping_country'])) ? $order_data['shipping_country'] : '' ; + if(isset($settings['retailcrm_delivery'][$order_data['shipping_code']])) { + $delivery_code = $order_data['shipping_code']; + } else { + $delivery_code = stristr($order_data['shipping_code'], '.', TRUE); + } + $order['delivery'] = array( 'code' => !empty($delivery_code) ? $settings['retailcrm_delivery'][$delivery_code] : '', 'address' => array( @@ -209,6 +219,7 @@ class ModelExtensionRetailcrmOrder extends Model { )) ) ); + if(!empty($deliveryCost)){ $order['delivery']['cost'] = $deliveryCost; } @@ -219,7 +230,7 @@ class ModelExtensionRetailcrmOrder extends Model { foreach ($orderProducts as $product) { $offerId = ''; - if(!empty($product['option'])) { + if (!empty($product['option'])) { $options = array(); $productOptions = $this->model_catalog_product->getProductOptions($product['product_id']);