mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-22 13:16:07 +03:00
Fix bugs in twig template, fix saving settings with empty history. Fixes #93
This commit is contained in:
parent
4ba6f6ce83
commit
6506dc716f
@ -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')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -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'],
|
||||||
|
@ -97,14 +97,14 @@
|
|||||||
<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 %}
|
||||||
@ -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 %}
|
||||||
|
@ -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'];
|
||||||
|
Loading…
Reference in New Issue
Block a user