add stocks

This commit is contained in:
ellynoize 2025-01-23 16:10:00 +03:00
parent 5f6d2480c4
commit a2309e3a5b
5 changed files with 60 additions and 1 deletions

View file

@ -305,6 +305,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
'text_summ_around',
'stock_upload',
'text_stock_upload',
'store_select',
'icml_settings',
'icml_service_enabled_label',
'icml_service_description',
@ -360,6 +361,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
$_data['priceTypes'] = $this->model_extension_retailcrm_references
->getPriceTypes();
$_data['customerGroups'] = $this->model_customer_customer_group->getCustomerGroups();
$_data['crmStocks'] = $this->model_extension_retailcrm_references->getApiStores();
}
$config_data = [$this->moduleTitle . '_status'];

View file

@ -105,7 +105,9 @@ $_['text_no'] = 'Нет';
$_['stock_from_crm'] = 'Из CRM в Opencart';
$_['stock_from_cms'] = 'Из Opencart в CRM';
$_['stock_not_upload'] = 'Не выгружать остатки';
$_['stock_not_upload'] = 'Не выгружать остатки';
$_['store_select'] = 'Склад для выгрузки остатков в CRM';
$_['text_store'] = 'Склад: ';
// Errors
$_['error_permission'] = 'У вас недостаточно прав на изменение настроек модуля';

View file

@ -204,6 +204,21 @@ class ModelExtensionRetailcrmReferences extends Model
return (!$response->isSuccessful()) ? array() : $response->paymentTypes;
}
/**
* Get RetailCRM stores
*
* @return array
*/
public function getApiStores()
{
$response = $this->retailcrmApiClient->StoresList();
if (!$response) {
return array();
}
return (!$response->isSuccessful()) ? array() : $response->stores;
}
/**
* Get RetailCRM custom fields
*

View file

@ -271,6 +271,25 @@
</div>
</div>
</fieldset>
<fieldset>
<legend><?php echo $store_select; ?></legend>
<div class="form-group retailcrm_unit">
<div class="row retailcrm_unit">
<label class="col-sm-2 control-label" style="text-align:right!important;" for="retailcrm_store_select"><?php echo $text_store; ?></label>
<div class="col-md-4 col-sm-10">
<select id="retailcrm_store_select" name="retailcrm_store_select" class="form-control">
<?php foreach ($crmStocks as $crmStock): ?>
<?php if ($crmStock['active'] == true :?>
<option value="<?php echo $$crmStock['code'];?>">
<?php echo $$crmStock['name'];?>
</option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend><?php echo $text_retailcrm_discount; ?></legend>
<div class="form-group">

View file

@ -286,6 +286,27 @@
</label>
</div>
</div>
</fieldset>
<fieldset>
{% if saved_settings.module_retailcrm_stock_upload is defined and saved_settings.module_retailcrm_stock_upload == 1 %}
<legend>{{ store_select }}</legend>
<div class="form-group retailcrm_unit">
<div class="row retailcrm_unit">
<label class="col-sm-2 control-label" class="col-sm-2 control-label" for="module_retailcrm_store_select">{{ text_store }}</label>
<div class="col-md-4 col-sm-10">
<select id="module_retailcrm_store_select" name="module_retailcrm_store_select}" class="form-control">
{% for crmStock in crmStocks %}
{% if crmStock.active == true %}
<option value ="{{ crmStock.code }}">
{{ crmStock.name }}
</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
</div>
{% endif %}
</fieldset>
<fieldset>
<legend>{{ text_retailcrm_discount }}</legend>