Merge branch 'master' of github.com:retailcrm/opencart-module

This commit is contained in:
Dmitry Akolzin 2017-04-12 11:18:53 +03:00
commit 6c6baaec71
5 changed files with 67 additions and 12 deletions

View File

@ -25,7 +25,6 @@ $_['text_success_catalog'] = 'Catalog successfully unloaded';
$_['text_error_order'] = 'Error! Order is not unloaded!'; $_['text_error_order'] = 'Error! Order is not unloaded!';
$_['text_error_order_id'] = 'Error! Enter the correct order number!'; $_['text_error_order_id'] = 'Error! Enter the correct order number!';
$_['retailcrm_dict_delivery'] = 'Shipment methods'; $_['retailcrm_dict_delivery'] = 'Shipment methods';
$_['retailcrm_dict_status'] = 'Order statuses'; $_['retailcrm_dict_status'] = 'Order statuses';
$_['retailcrm_dict_payment'] = 'Payment methods'; $_['retailcrm_dict_payment'] = 'Payment methods';

View File

@ -220,7 +220,7 @@ class ModelExtensionRetailcrmIcml extends Model
->appendChild($this->dd->createTextNode($product['name'])); ->appendChild($this->dd->createTextNode($product['name']));
} }
$e->appendChild($this->dd->createElement('price')) $e->appendChild($this->dd->createElement('price'))
->appendChild($this->dd->createTextNode($productPrice + $optionsTotalCost)); ->appendChild($this->dd->createTextNode($product['price'] + $optionsTotalCost));
/** /**
* Vendor * Vendor
*/ */

View File

@ -68,6 +68,25 @@
<button type="button" id="export_order" data-toggle="tooltip" title="<?php echo $text_button_export_order; ?>" class="btn btn-success"><i class="fa fa-download"></i></button> <button type="button" id="export_order" data-toggle="tooltip" title="<?php echo $text_button_export_order; ?>" class="btn btn-success"><i class="fa fa-download"></i></button>
</div> </div>
<h3><?php echo $retailcrm_countries_settings; ?></h3>
<div class="retailcrm_unit">
<div class="well well-sm" style="height: 150px; overflow: auto; width: 30%;">
<?php foreach($countries as $country) : ?>
<div class="checkbox">
<label>
<input type="checkbox" name="<?php echo 'retailcrm_country[]'; ?>" value="<?php echo $country['country_id']; ?>" <?php if(isset($saved_settings['retailcrm_country']) && in_array($country['country_id'], $saved_settings['retailcrm_country'])): echo 'checked'; endif;?>>
<?php echo $country['name']; ?>
</label>
</div>
<?php endforeach; ?>
</div>
</div>
<h3><?php echo $retailcrm_upload_order; ?></h3>
<div class="retailcrm_unit">
<label><?php echo $text_button_export_order; ?> № </label><input type="text" name="order_id">
<button type="button" id="export_order" data-toggle="tooltip" title="<?php echo $text_button_export_order; ?>" class="btn btn-success"><i class="fa fa-download"></i></button>
</div>
<?php if (isset($saved_settings['retailcrm_apikey']) && $saved_settings['retailcrm_apikey'] != '' && isset($saved_settings['retailcrm_url']) && $saved_settings['retailcrm_url'] != ''): ?> <?php if (isset($saved_settings['retailcrm_apikey']) && $saved_settings['retailcrm_apikey'] != '' && isset($saved_settings['retailcrm_url']) && $saved_settings['retailcrm_url'] != ''): ?>
<?php if (!empty($retailcrm_errors)) : ?> <?php if (!empty($retailcrm_errors)) : ?>
@ -78,6 +97,10 @@
<h3><?php echo $retailcrm_dict_settings; ?></h3> <h3><?php echo $retailcrm_dict_settings; ?></h3>
<h4><?php echo $retailcrm_dict_delivery; ?></h4> <h4><?php echo $retailcrm_dict_delivery; ?></h4>
<<<<<<< HEAD:admin/view/template/extension/module/retailcrm.tpl
=======
>>>>>>> 82e6d620766d6f21f0041e8744d92bbfc84da472:admin/view/template/extension/module/retailcrm.tpl
<?php foreach($delivery['opencart'] as $value): ?> <?php foreach($delivery['opencart'] as $value): ?>
<div class="pm"><?php echo $value['title'].':'; ?></div> <div class="pm"><?php echo $value['title'].':'; ?></div>
@ -202,4 +225,8 @@
$('#export_order').button('reset'); $('#export_order').button('reset');
} }
}); });
<<<<<<< HEAD:admin/view/template/extension/module/retailcrm.tpl
</script> </script>
=======
</script>
>>>>>>> 82e6d620766d6f21f0041e8744d92bbfc84da472:admin/view/template/extension/module/retailcrm.tpl

View File

@ -52,7 +52,22 @@ class ControllerApiRetailcrm extends Controller
if ($this->config->get($shippingModule['code'] . '_status')) { if ($this->config->get($shippingModule['code'] . '_status')) {
if($this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address)) { 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(); $deliveryTypes = array();
foreach ($quote_data as $shipping) { foreach ($quote_data as $shipping) {
if(isset($shipping['quote']) && !empty($shipping['quote'])){
foreach ($shipping['quote'] as $shippingMethod) { foreach ($shipping['quote'] as $shippingMethod) {
$deliveryTypes[$shipping['code']]['title'] = $shipping['title']; $deliveryTypes[$shipping['code']]['title'] = $shipping['title'];
$deliveryTypes[$shipping['code']][$shippingMethod['code']] = $shippingMethod; $deliveryTypes[$shipping['code']][$shippingMethod['code']] = $shippingMethod;
} }
} else {
$deliveryTypes[$shipping['code']]['title'] = $shipping['title'];
$deliveryTypes[$shipping['code']][$shipping['code']] = $shipping;
}
} }
return $deliveryTypes; return $deliveryTypes;

View File

@ -64,6 +64,7 @@ class ModelExtensionRetailcrmOrder extends Model {
} }
} }
} }
$order['discount'] = $couponTotal; $order['discount'] = $couponTotal;
$order['createdAt'] = $order_data['date_added']; $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']; $order_data['shipping_iso_code_2'] = $shipping_country['iso_code_2'];
} }
if(isset($settings['retailcrm_delivery'][$order_data['shipping_code']])) {
$delivery_code = $order_data['shipping_code']; $delivery_code = $order_data['shipping_code'];
} else {
$delivery_code = stristr($order_data['shipping_code'], '.', TRUE);
}
$order['delivery'] = array( $order['delivery'] = array(
'code' => !empty($delivery_code) ? $settings['retailcrm_delivery'][$delivery_code] : '', 'code' => !empty($delivery_code) ? $settings['retailcrm_delivery'][$delivery_code] : '',
'cost' => $deliveryCost, 'cost' => $deliveryCost,
@ -167,8 +173,6 @@ class ModelExtensionRetailcrmOrder extends Model {
$order = array(); $order = array();
$payment_code = $order_data['payment_code']; $payment_code = $order_data['payment_code'];
$delivery_code = $order_data['shipping_code'];
$order['externalId'] = $order_id; $order['externalId'] = $order_id;
$order['firstName'] = $order_data['firstname']; $order['firstName'] = $order_data['firstname'];
$order['lastName'] = $order_data['lastname']; $order['lastName'] = $order_data['lastname'];
@ -193,6 +197,12 @@ class ModelExtensionRetailcrmOrder extends Model {
$country = (isset($order_data['shipping_country'])) ? $order_data['shipping_country'] : '' ; $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( $order['delivery'] = array(
'code' => !empty($delivery_code) ? $settings['retailcrm_delivery'][$delivery_code] : '', 'code' => !empty($delivery_code) ? $settings['retailcrm_delivery'][$delivery_code] : '',
'address' => array( 'address' => array(
@ -209,6 +219,7 @@ class ModelExtensionRetailcrmOrder extends Model {
)) ))
) )
); );
if(!empty($deliveryCost)){ if(!empty($deliveryCost)){
$order['delivery']['cost'] = $deliveryCost; $order['delivery']['cost'] = $deliveryCost;
} }