update: admin/controller/extension/module/retailcrm.php

update:      admin/language/en-gb/extension/module/retailcrm.php
	update:      admin/language/ru-ru/extension/module/retailcrm.php
	update:      admin/model/extension/retailcrm/order.php
	update:      admin/view/template/extension/module/retailcrm.tpl
This commit is contained in:
Dmitry Akolzin 2017-04-06 16:40:06 +03:00
parent a84925fd19
commit 0c4d2a577e
5 changed files with 41 additions and 18 deletions

View File

@ -127,7 +127,9 @@ class ControllerExtensionModuleRetailcrm extends Controller
'text_button_export_order', 'text_button_export_order',
'text_button_catalog', 'text_button_catalog',
'text_success_catalog', 'text_success_catalog',
'retailcrm_upload_order' 'retailcrm_upload_order',
'text_error_order',
'text_error_order_id'
); );
$this->load->model('extension/extension'); $this->load->model('extension/extension');
@ -322,9 +324,10 @@ class ControllerExtensionModuleRetailcrm extends Controller
$data['order_status'] = $status['retailcrm_status'][$data['order_status_id']]; $data['order_status'] = $status['retailcrm_status'][$data['order_status_id']];
$this->load->model('extension/retailcrm/order'); $this->load->model('extension/retailcrm/order');
$this->model_extension_retailcrm_order->uploadOrder($data); $result = $this->model_extension_retailcrm_order->uploadOrder($data);
} }
echo json_encode($result);
} }
/** /**

View File

@ -22,6 +22,9 @@ $_['text_button_export'] = 'Unload all orders and customers';
$_['text_button_export_order'] = 'Unload order'; $_['text_button_export_order'] = 'Unload order';
$_['text_button_catalog'] = 'Unload catalog'; $_['text_button_catalog'] = 'Unload catalog';
$_['text_success_catalog'] = 'Catalog successfully unloaded'; $_['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_delivery'] = 'Shipment methods';
$_['retailcrm_dict_status'] = 'Order statuses'; $_['retailcrm_dict_status'] = 'Order statuses';

View File

@ -22,6 +22,8 @@ $_['text_button_export'] = 'Выгрузить все заказы и к
$_['text_button_export_order'] = 'Выгрузить заказ'; $_['text_button_export_order'] = 'Выгрузить заказ';
$_['text_button_catalog'] = 'Выгрузить каталог'; $_['text_button_catalog'] = 'Выгрузить каталог';
$_['text_success_catalog'] = 'Каталог успешно выгружен'; $_['text_success_catalog'] = 'Каталог успешно выгружен';
$_['text_error_order'] = 'Ошибка! Заказ не выгружен!';
$_['text_error_order_id'] = 'Ошибка! Введите корректный номер заказа!';
$_['retailcrm_dict_delivery'] = 'Способы доставки'; $_['retailcrm_dict_delivery'] = 'Способы доставки';
$_['retailcrm_dict_status'] = 'Статусы'; $_['retailcrm_dict_status'] = 'Статусы';

View File

@ -58,8 +58,10 @@ class ModelExtensionRetailcrmOrder extends Model {
unset($customers); unset($customers);
$this->retailcrm->ordersCreate($order); $result = $this->retailcrm->ordersCreate($order);
} }
return $result;
} }
private function process($order_data) { private function process($order_data) {

View File

@ -171,20 +171,33 @@
}); });
$('#export_order').on('click', function() { $('#export_order').on('click', function() {
var order_id = $('input[name=\'order_id\']').val();
if (order_id && order_id > 0) {
$.ajax({ $.ajax({
url: '<?php echo $catalog; ?>'+'admin/index.php?route=extension/module/retailcrm/exportOrder&token=' + token + '&order_id=' + $('input[name=\'order_id\']').val(), url: '<?php echo $catalog; ?>'+'admin/index.php?route=extension/module/retailcrm/exportOrder&token=' + token + '&order_id=' + order_id,
beforeSend: function() { beforeSend: function() {
$('#export_order').button('loading'); $('#export_order').button('loading');
}, },
complete: function(json) {
$('.alert-success').remove();
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> <?php echo $text_success_export_order; ?></div>');
$('#export_order').button('reset');
},
error: function(xhr, ajaxOptions, thrownError) { error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
},
success: function(data, textStatus, jqXHR) {
if (jqXHR['responseText'] == 'false') {
$('.alert-success').remove();
$('#content > .container-fluid').prepend('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i><?php echo $text_error_order; ?></div>');
$('#export_order').button('reset');
} else {
$('.alert-success').remove();
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i><?php echo $text_success_export_order; ?></div>');
$('#export_order').button('reset');
$('input[name=\'order_id\']').val('');
}
} }
}); });
} else {
$('.alert-success').remove();
$('#content > .container-fluid').prepend('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $text_error_order_id; ?></div>');
$('#export_order').button('reset');
}
}); });
</script> </script>