Merge branch 'master' into master

This commit is contained in:
Alex Lushpai 2017-04-07 12:35:06 +03:00 committed by GitHub
commit b84739162c
6 changed files with 16 additions and 5 deletions

View File

@ -54,6 +54,13 @@ class ControllerExtensionModuleRetailcrm extends Controller
'catalog/model/account/customer/addCustomer/after', 'catalog/model/account/customer/addCustomer/after',
'extension/module/retailcrm/customer_create' 'extension/module/retailcrm/customer_create'
); );
$this->model_extension_event
->addEvent(
'retailcrm',
'catalog/model/checkout/order/editOrder/after',
'extension/module/retailcrm/order_edit'
);
} }
/** /**
@ -78,6 +85,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
*/ */
public function index() public function index()
{ {
$this->load->model('localisation/country'); $this->load->model('localisation/country');
$this->load->model('setting/setting'); $this->load->model('setting/setting');
$this->load->model('extension/module'); $this->load->model('extension/module');

View File

@ -12,7 +12,6 @@ $_['retailcrm_base_settings'] = 'Connection settings';
$_['retailcrm_dict_settings'] = 'Dictionary settings'; $_['retailcrm_dict_settings'] = 'Dictionary settings';
$_['retailcrm_countries_settings'] = 'Trading zones setting'; $_['retailcrm_countries_settings'] = 'Trading zones setting';
$_['retailcrm_upload_order'] = 'Unload single order'; $_['retailcrm_upload_order'] = 'Unload single order';
$_['retailcrm_url'] = 'RetailCRM URL'; $_['retailcrm_url'] = 'RetailCRM URL';
$_['retailcrm_apikey'] = 'RetailCRM API Key'; $_['retailcrm_apikey'] = 'RetailCRM API Key';
@ -25,7 +24,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

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

View File

@ -1,7 +1,6 @@
<?php <?php
class ModelExtensionRetailcrmOrder extends Model { class ModelExtensionRetailcrmOrder extends Model {
public function uploadToCrm($orders) { public function uploadToCrm($orders) {
$this->load->model('catalog/product'); $this->load->model('catalog/product');

View File

@ -49,6 +49,7 @@
<label for="retailcrm_apikey"><?php echo $retailcrm_apikey; ?></label><br> <label for="retailcrm_apikey"><?php echo $retailcrm_apikey; ?></label><br>
<input id="retailcrm_apikey" type="text" name="retailcrm_apikey" value="<?php if (isset($saved_settings['retailcrm_apikey'])): echo $saved_settings['retailcrm_apikey']; endif;?>"> <input id="retailcrm_apikey" type="text" name="retailcrm_apikey" value="<?php if (isset($saved_settings['retailcrm_apikey'])): echo $saved_settings['retailcrm_apikey']; endif;?>">
</div> </div>
<h3><?php echo $retailcrm_countries_settings; ?></h3> <h3><?php echo $retailcrm_countries_settings; ?></h3>
<div class="retailcrm_unit"> <div class="retailcrm_unit">
<div class="well well-sm" style="height: 150px; overflow: auto; width: 30%;"> <div class="well well-sm" style="height: 150px; overflow: auto; width: 30%;">
@ -78,6 +79,7 @@
<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>
<?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>

View File

@ -59,11 +59,13 @@ class ModelExtensionRetailcrmOrder extends Model {
if ($totals['code'] == 'shipping') { if ($totals['code'] == 'shipping') {
$deliveryCost = $totals['value']; $deliveryCost = $totals['value'];
} }
if ($totals['code'] == 'coupon') { if ($totals['code'] == 'coupon') {
$couponTotal = abs($totals['value']); $couponTotal = abs($totals['value']);
} }
} }
} }
$order['discount'] = $couponTotal; $order['discount'] = $couponTotal;
$order['createdAt'] = $order_data['date_added']; $order['createdAt'] = $order_data['date_added'];
@ -209,6 +211,7 @@ class ModelExtensionRetailcrmOrder extends Model {
)) ))
) )
); );
if(!empty($deliveryCost)){ if(!empty($deliveryCost)){
$order['delivery']['cost'] = $deliveryCost; $order['delivery']['cost'] = $deliveryCost;
} }
@ -219,7 +222,7 @@ class ModelExtensionRetailcrmOrder extends Model {
foreach ($orderProducts as $product) { foreach ($orderProducts as $product) {
$offerId = ''; $offerId = '';
if(!empty($product['option'])) { if (!empty($product['option'])) {
$options = array(); $options = array();
$productOptions = $this->model_catalog_product->getProductOptions($product['product_id']); $productOptions = $this->model_catalog_product->getProductOptions($product['product_id']);