mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-22 05:06:07 +03:00
Добавление габаритов в генерации каталога
This commit is contained in:
parent
0b478bc596
commit
5e6c308375
@ -1,3 +1,6 @@
|
||||
## v.3.1.5
|
||||
* Добавлена генерация габаритов в катало
|
||||
|
||||
## v.3.1.4
|
||||
* Добавлено удаление типа цены для неустановленных акционных цен
|
||||
|
||||
|
@ -96,6 +96,7 @@ class ControllerExtensionModuleRetailcrm extends Controller {
|
||||
$this->load->model('setting/setting');
|
||||
$this->load->model('extension/retailcrm/references');
|
||||
$this->load->model('customer/customer_group');
|
||||
$this->load->model('localisation/length_class');
|
||||
$this->load->language('extension/module/retailcrm');
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
$this->document->addStyle('/admin/view/stylesheet/retailcrm.css');
|
||||
@ -219,7 +220,9 @@ class ControllerExtensionModuleRetailcrm extends Controller {
|
||||
'order_number',
|
||||
'text_order_number',
|
||||
'debug',
|
||||
'text_debug'
|
||||
'text_debug',
|
||||
'text_lenght',
|
||||
'text_lenght_label'
|
||||
);
|
||||
|
||||
foreach ($text_strings as $text) {
|
||||
@ -250,8 +253,9 @@ class ControllerExtensionModuleRetailcrm extends Controller {
|
||||
$_data['customFields'] = $this->model_extension_retailcrm_references
|
||||
->getCustomFields($retailcrm_api_client);
|
||||
$_data['priceTypes'] = $this->model_extension_retailcrm_references
|
||||
->getPriceTypes();
|
||||
->getPriceTypes($retailcrm_api_client);
|
||||
$_data['customerGroups'] = $this->model_customer_customer_group->getCustomerGroups();
|
||||
$_data['lenghts'] = $this->model_localisation_length_class->getLengthClasses();
|
||||
}
|
||||
|
||||
$config_data = array(
|
||||
|
@ -59,6 +59,8 @@ $_['text_error_save'] = 'Error when saving settings';
|
||||
$_['text_error_log'] = 'Log size is more than 2MB';
|
||||
$_['text_error_delivery'] = 'Delivery types are not found';
|
||||
$_['text_confirm_log'] = 'Are you sure that you want to clear the log?';
|
||||
$_['text_lenght'] = 'Setting of the unit of measurement';
|
||||
$_['text_lenght_label'] = 'Unit of measurement in ICML';
|
||||
|
||||
$_['retailcrm_dict_delivery'] = 'Delivery types';
|
||||
$_['retailcrm_dict_status'] = 'Statuses';
|
||||
|
@ -58,6 +58,8 @@ $_['text_error_save'] = 'Error al guardar la configuración';
|
||||
$_['text_error_log'] = 'El Tamaño del registro es más de 2MB';
|
||||
$_['text_error_delivery'] = 'No se encontraron los métodos de envío';
|
||||
$_['text_confirm_log'] = '¿Estás seguro de que quieres borrar el registro?';
|
||||
$_['text_lenght_label'] = 'Ajustar unidad de medida';
|
||||
$_['status_changes'] = 'Unidad de medida en ICML';
|
||||
|
||||
$_['retailcrm_dict_delivery'] = 'Métodos de envío';
|
||||
$_['retailcrm_dict_status'] = 'Estados';
|
||||
|
@ -58,6 +58,8 @@ $_['text_error_save'] = 'Ошибка сохранения настр
|
||||
$_['text_error_log'] = 'Размер лога более 2MB';
|
||||
$_['text_error_delivery'] = 'Не найдены типы доставки';
|
||||
$_['text_confirm_log'] = 'Вы уверены, что хотите очистить лог?';
|
||||
$_['text_lenght'] = 'Единица измерения в ICML';
|
||||
$_['text_lenght_label'] = 'История изменений';
|
||||
|
||||
$_['retailcrm_dict_delivery'] = 'Способы доставки';
|
||||
$_['retailcrm_dict_status'] = 'Статусы';
|
||||
|
@ -31,6 +31,7 @@ class ModelExtensionRetailcrmIcml extends Model
|
||||
$this->load->model('catalog/product');
|
||||
$this->load->model('catalog/option');
|
||||
$this->load->model('catalog/manufacturer');
|
||||
$this->load->model('localisation/length_class');
|
||||
|
||||
$string = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
<yml_catalog date="'.date('Y-m-d H:i:s').'">
|
||||
@ -101,6 +102,15 @@ class ModelExtensionRetailcrmIcml extends Model
|
||||
|
||||
$manufacturers = $this->model_catalog_manufacturer
|
||||
->getManufacturers(array());
|
||||
$settingLenght = $this->retailcrm->getLenghtForIcml();
|
||||
$leghtsArray = $this->model_localisation_length_class
|
||||
->getLengthClasses();
|
||||
|
||||
foreach ($leghtsArray as $lenght) {
|
||||
if ($lenght['value'] == 1) {
|
||||
$defaultLenght = $lenght;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($manufacturers as $manufacturer) {
|
||||
$offerManufacturers[
|
||||
@ -203,6 +213,44 @@ class ModelExtensionRetailcrmIcml extends Model
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dimensions
|
||||
*/
|
||||
if ((!empty($product['length']) && $product['length'] > 0) &&
|
||||
(!empty($product['width'] && $product['width'] > 0))
|
||||
&& !empty($product['height']))
|
||||
{
|
||||
$lenghtArray = $this->model_localisation_length_class->getLengthClass($product['length_class_id']);
|
||||
|
||||
if ($defaultLenght['length_class_id'] != $lenghtArray['length_class_id']) {
|
||||
$productLength = $product['length'] / $lenghtArray['value'];
|
||||
$productWidth = $product['width'] / $lenghtArray['value'];
|
||||
$productHeight = $product['height'] / $lenghtArray['value'];
|
||||
} else {
|
||||
$productLength = $product['length'];
|
||||
$productWidth = $product['width'];
|
||||
$productHeight = $product['height'];
|
||||
}
|
||||
|
||||
if ($defaultLenght['length_class_id'] != $settingLenght) {
|
||||
$unit = $this->model_localisation_length_class->getLengthClass($settingLenght);
|
||||
$productLength = $productLength * $unit['value'];
|
||||
$productWidth = $productWidth * $unit['value'];
|
||||
$productHeight = $productHeight * $unit['value'];
|
||||
}
|
||||
|
||||
$dimensions = sprintf(
|
||||
'%01.3f/%01.3f/%01.3f',
|
||||
$productLength,
|
||||
$productWidth,
|
||||
$productHeight
|
||||
);
|
||||
|
||||
$e->appendChild($this->dd->createElement('dimensions'))
|
||||
->appendChild($this->dd->createTextNode($dimensions));
|
||||
}
|
||||
|
||||
/**
|
||||
* Image
|
||||
*/
|
||||
|
@ -113,6 +113,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{{ text_lenght }}</legend>
|
||||
<div class="form-group retailcrm_unit">
|
||||
<label class="col-sm-2 control-label">{{ text_lenght_label }}</label>
|
||||
<div class="col-md-4 col-sm-10">
|
||||
<select id="module_retailcrm_lenght" name="module_retailcrm_lenght" class="form-control">
|
||||
{% for unit in lenghts %}
|
||||
<option value="{{ unit.length_class_id }}" {% if saved_settings.module_retailcrm_lenght is defined and saved_settings.module_retailcrm_lenght == unit.length_class_id %} selected="selected" {% endif %}>
|
||||
{{ unit.title }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
{% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion != 'v3' %}
|
||||
<fieldset>
|
||||
<legend>{{ special_price_settings }}</legend>
|
||||
|
@ -171,4 +171,19 @@ class Retailcrm {
|
||||
|
||||
return $haystack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLenghtForIcml() {
|
||||
$this->load->model('setting/setting');
|
||||
|
||||
$setting = $this->model_setting_setting->getSetting(self::MODULE);
|
||||
|
||||
if (isset($setting[self::MODULE . '_lenght'])) {
|
||||
return $setting[self::MODULE . '_lenght'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user