Merge pull request #99 from iyzoer/master

Bug fix twig template
This commit is contained in:
Alex Lushpai 2018-07-19 17:07:06 +03:00 committed by GitHub
commit 9eecfcffb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 13 deletions

View File

@ -1,3 +1,7 @@
## v.3.0.5
* Исправлены ошибки в шаблоне twig
* Добавлена обработка истории изменений при сохранении настроек для установки текущего sinceId, если история в retailCRM пустая
## v.3.0.4 ## v.3.0.4
* Добавлена проверка группы пользователя в заказе при редактировании * Добавлена проверка группы пользователя в заказе при редактировании
* Добавлена передача скидки по бонусным баллам * Добавлена передача скидки по бонусным баллам

View File

@ -1 +1 @@
3.0.4 3.0.5

View File

@ -150,7 +150,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
$ordersHistory = $api->ordersHistory(); $ordersHistory = $api->ordersHistory();
if ($ordersHistory->isSuccessful()) { if ($ordersHistory->isSuccessful() && !empty($ordersHistory['history'])) {
$ordersHistory = $api->ordersHistory(array(), $ordersHistory['pagination']['totalPageCount']); $ordersHistory = $api->ordersHistory(array(), $ordersHistory['pagination']['totalPageCount']);
if ($ordersHistory->isSuccessful()) { if ($ordersHistory->isSuccessful()) {
@ -163,7 +163,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
$customersHistory = $api->customersHistory(); $customersHistory = $api->customersHistory();
if ($customersHistory->isSuccessful()) { if ($customersHistory->isSuccessful() && !empty($customersHistory['history'])) {
$customersHistory = $api->customersHistory(array(), $customersHistory['pagination']['totalPageCount']); $customersHistory = $api->customersHistory(array(), $customersHistory['pagination']['totalPageCount']);
if ($customersHistory->isSuccessful()) { if ($customersHistory->isSuccessful()) {
@ -176,9 +176,9 @@ class ControllerExtensionModuleRetailcrm extends Controller
$this->model_setting_setting->editSetting( $this->model_setting_setting->editSetting(
'retailcrm_history', 'retailcrm_history',
array( array(
'retailcrm_history_orders' => $sinceIdOrders, 'retailcrm_history_orders' => isset($sinceIdOrders) ? $sinceIdOrders : 1,
'retailcrm_history_customers' => $sinceIdCustomers, 'retailcrm_history_customers' => isset($sinceIdCustomers) ? $sinceIdCustomers : 1,
'retailcrm_history_datetime' => $generatedAt 'retailcrm_history_datetime' => isset($generatedAt) ? $generatedAt : date('Y-m-d H:i:s')
) )
); );
} }

View File

@ -115,6 +115,10 @@ class ModelExtensionRetailcrmOrder extends Model {
} }
} }
if (!empty($order_data['payment_iso_code_2'])) {
$order['countryIso'] = $order_data['payment_iso_code_2'];
}
$order['number'] = $order_data['order_id']; $order['number'] = $order_data['order_id'];
$order['externalId'] = $order_data['order_id']; $order['externalId'] = $order_data['order_id'];
$order['firstName'] = $order_data['firstname']; $order['firstName'] = $order_data['firstname'];
@ -151,6 +155,7 @@ class ModelExtensionRetailcrmOrder extends Model {
'code' => isset($delivery_code) ? $delivery_code : '', 'code' => isset($delivery_code) ? $delivery_code : '',
'cost' => $deliveryCost, 'cost' => $deliveryCost,
'address' => array( 'address' => array(
'countryIso' => $order_data['shipping_iso_code_2'],
'index' => $order_data['shipping_postcode'], 'index' => $order_data['shipping_postcode'],
'city' => $order_data['shipping_city'], 'city' => $order_data['shipping_city'],
'region' => $order_data['shipping_zone'], 'region' => $order_data['shipping_zone'],

View File

@ -97,16 +97,16 @@
<label>{{ text_button_export_order }} № </label><input type="text" name="order_id"> <label>{{ text_button_export_order }} № </label><input type="text" name="order_id">
<button type="button" id="export_order" data-toggle="tooltip" title="{{ 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="{{ text_button_export_order }}" class="btn btn-success"><i class="fa fa-download"></i></button>
</div> </div>
{% if saved_settings.retailcrm_apiversion is defined and saved_settings.retailcrm_apiversion != 'v3' %} {% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion != 'v3' %}
<h3>{{ special_price_settings }}</h3> <h3>{{ special_price_settings }}</h3>
<div class="retailcrm_unit"> <div class="retailcrm_unit">
<label>{{ special_price_settings }}</label> <label>{{ special_price_settings }}</label>
<select id="module_retailcrm_special" name="module_retailcrm_special"> <select id="module_retailcrm_special" name="module_retailcrm_special">
{% for priceType in priceTypes %} {% for priceType in priceTypes %}
{% if priceType.active == true %} {% if priceType.active == true %}
<option value="{{priceType.code }}" {% if saved_settings.retailcrm_special is defined and saved_settings.retailcrm_special == priceType.code %} selected="selected" {% endif %}> <option value="{{priceType.code }}" {% if saved_settings.module_retailcrm_special is defined and saved_settings.module_retailcrm_special == priceType.code %} selected="selected" {% endif %}>
{{ priceType.name }} {{ priceType.name }}
</option> </option>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select> </select>
@ -170,7 +170,7 @@
<div class="retailcrm_unit"> <div class="retailcrm_unit">
<select id="module_retailcrm_default_payment" name="module_retailcrm_default_payment" > <select id="module_retailcrm_default_payment" name="module_retailcrm_default_payment" >
{% for k, v in payments.opencart %} {% for k, v in payments.opencart %}
<option value="{{ k }}" {% if saved_settings.retailcrm_default_payment is defined and k == saved_settings.retailcrm_default_payment %} selected="selected" {% endif %}> <option value="{{ k }}" {% if saved_settings.module_retailcrm_default_payment is defined and k == saved_settings.module_retailcrm_default_payment %} selected="selected" {% endif %}>
{{ v }} {{ v }}
</option> </option>
{% endfor %} {% endfor %}
@ -183,7 +183,7 @@
<optgroup label="{{ value.title }}"> <optgroup label="{{ value.title }}">
{% for k, v in value %} {% for k, v in value %}
{% if k != 'title' %} {% if k != 'title' %}
<option value="{{ v.code }}" {% if saved_settings.retailcrm_default_shipping is defined and v.code == saved_settings.retailcrm_default_shipping %} selected="selected" {% endif %}> <option value="{{ v.code }}" {% if saved_settings.module_retailcrm_default_shipping is defined and v.code == saved_settings.module_retailcrm_default_shipping %} selected="selected" {% endif %}>
{{ v.title }} {{ v.title }}
</option> </option>
{% endif %} {% endif %}
@ -195,10 +195,10 @@
</div> </div>
<h4>{{ retailcrm_missing_status }}</h4> <h4>{{ retailcrm_missing_status }}</h4>
<div class="retailcrm_unit"> <div class="retailcrm_unit">
<select id="retailcrm_missing_status" name="retailcrm_missing_status"> <select id="retailcrm_missing_status" name="module_retailcrm_missing_status">
<option></option> <option></option>
{% for k, v in statuses.retailcrm %} {% for k, v in statuses.retailcrm %}
<option value="{{ k }}" {% if saved_settings.retailcrm_missing_status is defined and k == saved_settings.retailcrm_missing_status %} selected="selected" {% endif %}> <option value="{{ k }}" {% if saved_settings.module_retailcrm_missing_status is defined and k == saved_settings.module_retailcrm_missing_status %} selected="selected" {% endif %}>
{{ v.name }} {{ v.name }}
</option> </option>
{% endfor %} {% endfor %}

View File

@ -81,6 +81,10 @@ class ModelExtensionRetailcrmOrder extends Model {
} }
} }
if (!empty($order_data['payment_iso_code_2'])) {
$order['countryIso'] = $order_data['payment_iso_code_2'];
}
$order['number'] = $order_data['order_id']; $order['number'] = $order_data['order_id'];
$order['externalId'] = $order_id; $order['externalId'] = $order_id;
$order['firstName'] = $order_data['firstname']; $order['firstName'] = $order_data['firstname'];