v3.2.4 Добавлена возможность передачи фкционных цен нескольких групп пользователей

This commit is contained in:
Sergey 2019-02-27 16:05:35 +03:00
parent 24c6de76ec
commit 6443e10330
7 changed files with 394 additions and 328 deletions

View File

@ -1,3 +1,6 @@
## v.3.2.4
* Изменена передача типов цен с учетом групп пользователей на сайте
## v.3.2.2 ## v.3.2.2
* Убрана генерация externalId покупателя при заказе без регистрации на сайте. * Убрана генерация externalId покупателя при заказе без регистрации на сайте.

View File

@ -1 +1 @@
3.2.2 3.2.4

View File

@ -119,6 +119,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
$this->load->model('setting/setting'); $this->load->model('setting/setting');
$this->load->model('extension/retailcrm/references'); $this->load->model('extension/retailcrm/references');
$this->load->model('localisation/currency'); $this->load->model('localisation/currency');
$this->load->model('customer/customer_group');
$this->load->language('extension/module/retailcrm'); $this->load->language('extension/module/retailcrm');
$this->document->setTitle($this->language->get('heading_title')); $this->document->setTitle($this->language->get('heading_title'));
$this->document->addStyle('/admin/view/stylesheet/retailcrm.css'); $this->document->addStyle('/admin/view/stylesheet/retailcrm.css');
@ -344,6 +345,7 @@ class ControllerExtensionModuleRetailcrm extends Controller
if ($apiVersion != 'v3') { if ($apiVersion != 'v3') {
$_data['priceTypes'] = $this->model_extension_retailcrm_references $_data['priceTypes'] = $this->model_extension_retailcrm_references
->getPriceTypes(); ->getPriceTypes();
$_data['customerGroups'] = $this->model_customer_customer_group->getCustomerGroups();
} }
} }

View File

@ -9,7 +9,7 @@ class ModelExtensionRetailcrmPrices extends Model
/** /**
* Constructor * Constructor
* *
* @param Registry $registry * @param Registry $registry
*/ */
public function __construct($registry) public function __construct($registry)
@ -18,6 +18,7 @@ class ModelExtensionRetailcrmPrices extends Model
$this->load->library('retailcrm/retailcrm'); $this->load->library('retailcrm/retailcrm');
$this->load->model('catalog/option'); $this->load->model('catalog/option');
$this->load->model('setting/setting'); $this->load->model('setting/setting');
$this->load->model('customer/customer_group');
$this->moduleTitle = $this->retailcrm->getModuleTitle(); $this->moduleTitle = $this->retailcrm->getModuleTitle();
$this->settings = $this->model_setting_setting->getSetting($this->moduleTitle); $this->settings = $this->model_setting_setting->getSetting($this->moduleTitle);
@ -25,9 +26,9 @@ class ModelExtensionRetailcrmPrices extends Model
/** /**
* Upload prices to CRM * Upload prices to CRM
* *
* @param array $products * @param array $products
* @param \RetailcrmProxy $retailcrmApiClient * @param RetailcrmProxy $retailcrmApiClient
* @return mixed bool | array * @return mixed bool | array
*/ */
public function uploadPrices($products, $retailcrmApiClient) public function uploadPrices($products, $retailcrmApiClient)
@ -44,14 +45,15 @@ class ModelExtensionRetailcrmPrices extends Model
$retailcrmApiClient->storePricesUpload($priceUpload); $retailcrmApiClient->storePricesUpload($priceUpload);
} }
return $pricesUpload; return $pricesUpload;
} }
/** /**
* Get prices * Get prices
* *
* @param array $products * @param array $products
* *
* @return mixed * @return mixed
*/ */
protected function getPrices($products, $retailcrmApiClient) protected function getPrices($products, $retailcrmApiClient)
@ -59,9 +61,7 @@ class ModelExtensionRetailcrmPrices extends Model
$prices = array(); $prices = array();
$site = $this->getSite($retailcrmApiClient); $site = $this->getSite($retailcrmApiClient);
if (!isset($this->settings[$this->moduleTitle . '_special']) if ($this->settings[$this->moduleTitle . '_apiversion'] == 'v3') {
|| $this->settings[$this->moduleTitle . '_apiversion'] == 'v3'
) {
return false; return false;
} }
@ -72,12 +72,14 @@ class ModelExtensionRetailcrmPrices extends Model
continue; continue;
} }
$productPrice = array();
if (is_array($specials) && count($specials)) { if (is_array($specials) && count($specials)) {
$productPrice = $this->getSpecialPrice($specials); $productPrice = $this->getSpecialPrice($specials);
}
if (!$productPrice) { if (empty($productPrice)) {
continue; continue;
}
} }
$offers = $this->retailcrm->getOffers($product); $offers = $this->retailcrm->getOffers($product);
@ -109,17 +111,23 @@ class ModelExtensionRetailcrmPrices extends Model
} }
$offerId = implode('_', $offerId); $offerId = implode('_', $offerId);
$price = array();
foreach($productPrice as $k => $v) {
if (isset($this->settings[$this->moduleTitle . '_special_' . $k])) {
$price[] = array(
'code' => $this->settings[$this->moduleTitle . '_special_' . $k],
'price' => $v + $optionsValues['price']
);
}
}
$prices[] = array( $prices[] = array(
'externalId' => $offerId ? $product['product_id'] . '#' . $offerId : $product['product_id'], 'externalId' => $offerId ? $product['product_id'] . '#' . $offerId : $product['product_id'],
'site' => $site, 'site' => $site,
'prices' => array( 'prices' => $price
array(
'code' => $this->settings[$this->moduleTitle . '_special'],
'price' => $productPrice + $optionsValues['price']
)
)
); );
} }
} }
@ -128,26 +136,32 @@ class ModelExtensionRetailcrmPrices extends Model
/** /**
* Get actual special * Get actual special
* *
* @param array $specials * @param array $specials
* *
* @return float $productPrice * @return array $productPrice
*/ */
private function getSpecialPrice($specials) private function getSpecialPrice($specials)
{ {
$date = date('Y-m-d'); $date = date('Y-m-d');
$always = '0000-00-00'; $always = '0000-00-00';
$productPrice = 0; $productPrice = array();
foreach ($specials as $special) { foreach ($specials as $special) {
if (($special['date_start'] == $always && $special['date_end'] == $always) if (($special['date_start'] == $always && $special['date_end'] == $always)
|| ($special['date_start'] <= $date && $special['date_end'] >= $date) || ($special['date_start'] <= $date && $special['date_end'] >= $date)
) { ) {
if ((isset($priority) && $priority > $special['priority']) if ((isset($groupId) && $groupId == $special['customer_group_id']) || !isset($groupId)) {
|| !isset($priority) if ((isset($priority) && $priority > $special['priority'])
) { || !isset($priority)
$productPrice = $special['price']; ) {
$priority = $special['priority']; $productPrice[$special['customer_group_id']] = $special['price'];
$priority = $special['priority'];
$groupId = $special['customer_group_id'];
}
} else {
$productPrice[$special['customer_group_id']] = $special['price'];
$groupId = $special['customer_group_id'];
} }
} }
} }
@ -157,10 +171,10 @@ class ModelExtensionRetailcrmPrices extends Model
/** /**
* Get data option * Get data option
* *
* @param int $optionId * @param int $optionId
* @param int $optionValueId * @param int $optionValueId
* *
* @return array * @return array
*/ */
private function getOptionData($optionId, $optionValueId) { private function getOptionData($optionId, $optionValueId) {

View File

@ -5,7 +5,7 @@
<div class="pull-right"> <div class="pull-right">
<?php if ($export_file) : ?> <?php if ($export_file) : ?>
<button type="button" id="export" data-toggle="tooltip" title="<?php echo $text_button_export; ?>" class="btn btn-success"><i class="fa fa-download"></i></button> <button type="button" id="export" data-toggle="tooltip" title="<?php echo $text_button_export; ?>" class="btn btn-success"><i class="fa fa-download"></i></button>
<?php endif; ?> <?php endif; ?>
<button type="button" id="icml" data-toggle="tooltip" title="<?php echo $text_button_catalog; ?>" class="btn btn-success"><i class="fa fa-file-text-o"></i></button> <button type="button" id="icml" data-toggle="tooltip" title="<?php echo $text_button_catalog; ?>" class="btn btn-success"><i class="fa fa-file-text-o"></i></button>
<button type="submit" form="form-retailcrm" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button> <button type="submit" form="form-retailcrm" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
<a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a> <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a>
@ -73,7 +73,7 @@
<input id="retailcrm_apikey" type="text" name="retailcrm_apikey" value="<?php if (isset($saved_settings['retailcrm_apikey'])): echo $saved_settings['retailcrm_apikey']; endif;?>" class="form-control" /> <input id="retailcrm_apikey" type="text" name="retailcrm_apikey" value="<?php if (isset($saved_settings['retailcrm_apikey'])): echo $saved_settings['retailcrm_apikey']; endif;?>" class="form-control" />
</div> </div>
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend><?php echo $retailcrm_countries_settings; ?></legend> <legend><?php echo $retailcrm_countries_settings; ?></legend>
<div class="form-group retailcrm_unit"> <div class="form-group retailcrm_unit">
@ -90,7 +90,7 @@
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
</div> </div>
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend><?php echo $text_currency; ?></legend> <legend><?php echo $text_currency; ?></legend>
@ -101,7 +101,7 @@
<?php foreach ($currencies as $currency) :?> <?php foreach ($currencies as $currency) :?>
<?php if ($currency['status']) :?> <?php if ($currency['status']) :?>
<option value="<?php echo $currency['code']; ?>" <?php if(isset($saved_settings['retailcrm_currency']) && $saved_settings['retailcrm_currency'] == $currency['code']):?>selected="selected"<?php endif;?>> <option value="<?php echo $currency['code']; ?>" <?php if(isset($saved_settings['retailcrm_currency']) && $saved_settings['retailcrm_currency'] == $currency['code']):?>selected="selected"<?php endif;?>>
<?php echo $currency['title']; ?> <?php echo $currency['title']; ?>
</option> </option>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
@ -122,7 +122,7 @@
<div class="col-sm-10"> <div class="col-sm-10">
<div class="row"> <div class="row">
<div class="col-lg-3 col-md-6 col-sm-6"> <div class="col-lg-3 col-md-6 col-sm-6">
<input type="text" name="order_id" class="form-control" /> <input type="text" name="order_id" class="form-control" />
</div> </div>
<div class="col-lg-3 col-md-4 col-sm-6"> <div class="col-lg-3 col-md-4 col-sm-6">
<button type="button" id="export_order" class="btn btn-success"><i class="fa fa-download"></i> <?php echo $text_button_export_order; ?></button> <button type="button" id="export_order" class="btn btn-success"><i class="fa fa-download"></i> <?php echo $text_button_export_order; ?></button>
@ -135,19 +135,24 @@
<fieldset> <fieldset>
<legend><?php echo $special_price_settings; ?></legend> <legend><?php echo $special_price_settings; ?></legend>
<div class="form-group retailcrm_unit"> <div class="form-group retailcrm_unit">
<label class="col-sm-2 control-label"><?php echo $special_price_settings; ?></label> <?php foreach ($customerGroups as $customerGroup) :?>
<div class="col-md-4 col-sm-10"> <?php $cid = $customerGroup['customer_group_id']?>
<select id="retailcrm_special" name="retailcrm_special" class="form-control"> <div class="row retailcrm_unit">
<?php foreach ($priceTypes as $priceType) :?> <label class="col-sm-2 control-label" style="text-align:right!important;" for="opencart_customer_group_<?php echo $customerGroup['customer_group_id']; ?>"><?php echo $customerGroup['name']; ?></label>
<?php if ($priceType['active'] == true) :?> <div class="col-md-4 col-sm-10">
<option value="<?php echo $priceType['code']; ?>" <?php if(isset($saved_settings['retailcrm_special']) && $saved_settings['retailcrm_special'] == $priceType['code']):?>selected="selected"<?php endif;?>> <select id="retailcrm_special_<?php echo $uid; ?>" name="retailcrm_special_<?php echo $uid; ?>" class="form-control">
<?php echo $priceType['name']; ?> <?php foreach ($priceTypes as $k => $priceType): ?>
</option> <?php if ($priceType['active'] == true) :?>
<?php endif; ?> <option value="<?php echo $priceType['code'];?>" <?php if(isset($saved_settings['retailcrm_special_' . $cid]) && $priceType['code'] == $saved_settings['retailcrm_special_' . $cid]):?>selected="selected"<?php endif;?>>
<?php endforeach; ?> <?php echo $priceType['name'];?>
</select> </option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
</div> </div>
</div> <?php endforeach; ?>
</div>
</fieldset> </fieldset>
<?php endif; ?> <?php endif; ?>
<fieldset> <fieldset>
@ -189,7 +194,7 @@
<select id="retailcrm_delivery_<?php echo $val['code']; ?>" name="retailcrm_delivery[<?php echo $val['code']; ?>]" class="form-control"> <select id="retailcrm_delivery_<?php echo $val['code']; ?>" name="retailcrm_delivery[<?php echo $val['code']; ?>]" class="form-control">
<?php foreach ($delivery['retailcrm'] as $k => $v): ?> <?php foreach ($delivery['retailcrm'] as $k => $v): ?>
<option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_delivery'][$key]) && $v['code'] == $saved_settings['retailcrm_delivery'][$key]):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_delivery'][$key]) && $v['code'] == $saved_settings['retailcrm_delivery'][$key]):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@ -220,7 +225,7 @@
<select id="retailcrm_status_<?php echo $uid; ?>" name="retailcrm_status[<?php echo $uid; ?>]" class="form-control"> <select id="retailcrm_status_<?php echo $uid; ?>" name="retailcrm_status[<?php echo $uid; ?>]" class="form-control">
<?php foreach ($statuses['retailcrm'] as $k => $v): ?> <?php foreach ($statuses['retailcrm'] as $k => $v): ?>
<option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_status'][$uid]) && $v['code'] == $saved_settings['retailcrm_status'][$uid]):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_status'][$uid]) && $v['code'] == $saved_settings['retailcrm_status'][$uid]):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@ -241,7 +246,7 @@
<select id="retailcrm_payment_<?php echo $key; ?>" name="retailcrm_payment[<?php echo $key; ?>]" class="form-control"> <select id="retailcrm_payment_<?php echo $key; ?>" name="retailcrm_payment[<?php echo $key; ?>]" class="form-control">
<?php foreach ($payments['retailcrm'] as $k => $v): ?> <?php foreach ($payments['retailcrm'] as $k => $v): ?>
<option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_payment'][$key]) && $v['code'] == $saved_settings['retailcrm_payment'][$key]):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_payment'][$key]) && $v['code'] == $saved_settings['retailcrm_payment'][$key]):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@ -256,25 +261,25 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label"><?php echo $retailcrm_dict_default; ?></label> <label class="col-sm-2 control-label"><?php echo $retailcrm_dict_default; ?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<div class="row"> <div class="row">
<div class="retailcrm_unit col-sm-12"> <div class="retailcrm_unit col-sm-12">
<div class="row"> <div class="row">
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<select id="retailcrm_default_payment" name="retailcrm_default_payment" class="form-control"> <select id="retailcrm_default_payment" name="retailcrm_default_payment" class="form-control">
<?php foreach ($payments['opencart'] as $k => $v): ?> <?php foreach ($payments['opencart'] as $k => $v): ?>
<option value="<?php echo $k;?>" <?php if(isset($saved_settings['retailcrm_default_payment']) && $k == $saved_settings['retailcrm_default_payment']):?>selected="selected"<?php endif;?>> <option value="<?php echo $k;?>" <?php if(isset($saved_settings['retailcrm_default_payment']) && $k == $saved_settings['retailcrm_default_payment']):?>selected="selected"<?php endif;?>>
<?php echo $v;?> <?php echo $v;?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<label class="control-label" for="retailcrm_default_payment"><?php echo $text_payment; ?></label> <label class="control-label" for="retailcrm_default_payment"><?php echo $text_payment; ?></label>
</div> </div>
</div> </div>
</div> </div>
<div class="retailcrm_unit col-sm-12"> <div class="retailcrm_unit col-sm-12">
<div class="row"> <div class="row">
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<select id="retailcrm_default_shipping" name="retailcrm_default_shipping" class="form-control"> <select id="retailcrm_default_shipping" name="retailcrm_default_shipping" class="form-control">
<?php foreach ($delivery['opencart'] as $key => $value): ?> <?php foreach ($delivery['opencart'] as $key => $value): ?>
@ -282,7 +287,7 @@
<?php unset($value['title']); ?> <?php unset($value['title']); ?>
<?php foreach ($value as $v): ?> <?php foreach ($value as $v): ?>
<option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_default_shipping']) && $v['code'] == $saved_settings['retailcrm_default_shipping']):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_default_shipping']) && $v['code'] == $saved_settings['retailcrm_default_shipping']):?>selected="selected"<?php endif;?>>
<?php echo $v['title'];?> <?php echo $v['title'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</optgroup> </optgroup>
@ -294,7 +299,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -306,7 +311,7 @@
<option>-- Выберите --</option> <option>-- Выберите --</option>
<?php foreach ($statuses['retailcrm'] as $k => $v): ?> <?php foreach ($statuses['retailcrm'] as $k => $v): ?>
<option value="<?php echo $k;?>" <?php if(isset($saved_settings['retailcrm_missing_status']) && $k == $saved_settings['retailcrm_missing_status']):?>selected="selected"<?php endif;?>> <option value="<?php echo $k;?>" <?php if(isset($saved_settings['retailcrm_missing_status']) && $k == $saved_settings['retailcrm_missing_status']):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@ -325,13 +330,13 @@
<label class="col-sm-2 control-label" for="retailcrm_collector_active"><?php echo $text_collector_activity; ?></label> <label class="col-sm-2 control-label" for="retailcrm_collector_active"><?php echo $text_collector_activity; ?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="retailcrm_collector_active" value="1" <?php if (isset($saved_settings['retailcrm_collector_active']) && <input type="radio" name="retailcrm_collector_active" value="1" <?php if (isset($saved_settings['retailcrm_collector_active']) &&
$saved_settings['retailcrm_collector_active'] == 1) : $saved_settings['retailcrm_collector_active'] == 1) :
echo 'checked'; endif; ?> /> echo 'checked'; endif; ?> />
<?php echo $text_yes; ?> <?php echo $text_yes; ?>
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="retailcrm_collector_active" value="0" <?php if (!isset($saved_settings['retailcrm_collector_active']) || <input type="radio" name="retailcrm_collector_active" value="0" <?php if (!isset($saved_settings['retailcrm_collector_active']) ||
$saved_settings['retailcrm_collector_active'] == 0) : $saved_settings['retailcrm_collector_active'] == 0) :
echo 'checked'; endif; ?> /> echo 'checked'; endif; ?> />
<?php echo $text_no; ?> <?php echo $text_no; ?>
@ -348,17 +353,17 @@
<label class="col-sm-2 control-label" for="retailcrm_collector"><?php echo $text_collector_form_capture; ?></label> <label class="col-sm-2 control-label" for="retailcrm_collector"><?php echo $text_collector_form_capture; ?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="retailcrm_collector[form_capture]" value="1" <?php if (isset($saved_settings['retailcrm_collector']['form_capture']) && <input type="radio" name="retailcrm_collector[form_capture]" value="1" <?php if (isset($saved_settings['retailcrm_collector']['form_capture']) &&
$saved_settings['retailcrm_collector']['form_capture'] == 1) : $saved_settings['retailcrm_collector']['form_capture'] == 1) :
echo 'checked'; endif; ?>> echo 'checked'; endif; ?>>
<?php echo $text_yes; ?> <?php echo $text_yes; ?>
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="retailcrm_collector[form_capture]" value="0" <?php if (!isset($saved_settings['retailcrm_collector']['form_capture']) || <input type="radio" name="retailcrm_collector[form_capture]" value="0" <?php if (!isset($saved_settings['retailcrm_collector']['form_capture']) ||
$saved_settings['retailcrm_collector']['form_capture'] == 0) : $saved_settings['retailcrm_collector']['form_capture'] == 0) :
echo 'checked'; endif; ?>> echo 'checked'; endif; ?>>
<?php echo $text_no; ?> <?php echo $text_no; ?>
</label> </label>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -383,13 +388,13 @@
<label class="col-sm-2 control-label" for="retailcrm_collector"><?php echo $collector_custom_text; ?></label> <label class="col-sm-2 control-label" for="retailcrm_collector"><?php echo $collector_custom_text; ?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="retailcrm_collector[custom_form]" value="1" <?php if (isset($saved_settings['retailcrm_collector']['custom_form']) && <input type="radio" name="retailcrm_collector[custom_form]" value="1" <?php if (isset($saved_settings['retailcrm_collector']['custom_form']) &&
$saved_settings['retailcrm_collector']['custom_form'] == 1) : $saved_settings['retailcrm_collector']['custom_form'] == 1) :
echo 'checked'; endif; ?>> echo 'checked'; endif; ?>>
<?php echo $text_yes; ?> <?php echo $text_yes; ?>
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="retailcrm_collector[custom_form]" value="0" <?php if (!isset($saved_settings['retailcrm_collector']['custom_form']) || <input type="radio" name="retailcrm_collector[custom_form]" value="0" <?php if (!isset($saved_settings['retailcrm_collector']['custom_form']) ||
$saved_settings['retailcrm_collector']['custom_form'] == 0) : $saved_settings['retailcrm_collector']['custom_form'] == 0) :
echo 'checked'; endif; ?>> echo 'checked'; endif; ?>>
<?php echo $text_no; ?> <?php echo $text_no; ?>
@ -418,24 +423,24 @@
<div class="tab-pane" id="tab-custom_fields"> <div class="tab-pane" id="tab-custom_fields">
<fieldset> <fieldset>
<legend><?php echo $retailcrm_dict_custom_fields; ?></legend> <legend><?php echo $retailcrm_dict_custom_fields; ?></legend>
<?php if ($customFields['retailcrm'] && $customFields['opencart']) : ?> <?php if ($customFields['retailcrm'] && $customFields['opencart']) : ?>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label" for="retailcrm_custom_field_active"><?php echo $text_custom_field_activity; ?></label> <label class="col-sm-2 control-label" for="retailcrm_custom_field_active"><?php echo $text_custom_field_activity; ?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="retailcrm_custom_field_active" value="1" <?php if (isset($saved_settings['retailcrm_custom_field_active']) && <input type="radio" name="retailcrm_custom_field_active" value="1" <?php if (isset($saved_settings['retailcrm_custom_field_active']) &&
$saved_settings['retailcrm_custom_field_active'] == 1) : $saved_settings['retailcrm_custom_field_active'] == 1) :
echo 'checked'; endif; ?> /> echo 'checked'; endif; ?> />
<?php echo $text_yes; ?> <?php echo $text_yes; ?>
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="retailcrm_custom_field_active" value="0" <?php if (!isset($saved_settings['retailcrm_custom_field_active']) || <input type="radio" name="retailcrm_custom_field_active" value="0" <?php if (!isset($saved_settings['retailcrm_custom_field_active']) ||
$saved_settings['retailcrm_custom_field_active'] == 0) : $saved_settings['retailcrm_custom_field_active'] == 0) :
echo 'checked'; endif; ?> /> echo 'checked'; endif; ?> />
<?php echo $text_no; ?> <?php echo $text_no; ?>
</label> </label>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label"><?php echo $text_customers_custom_fields; ?></label> <label class="col-sm-2 control-label"><?php echo $text_customers_custom_fields; ?></label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -448,7 +453,7 @@
<select id="retailcrm_custom_field_<?php echo $fid; ?>" name="retailcrm_custom_field[<?php echo $fid; ?>]" class="form-control"> <select id="retailcrm_custom_field_<?php echo $fid; ?>" name="retailcrm_custom_field[<?php echo $fid; ?>]" class="form-control">
<?php foreach ($customFields['retailcrm']['customers'] as $v): ?> <?php foreach ($customFields['retailcrm']['customers'] as $v): ?>
<option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_custom_field'][$fid]) && $v['code'] == $saved_settings['retailcrm_custom_field'][$fid]):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_custom_field'][$fid]) && $v['code'] == $saved_settings['retailcrm_custom_field'][$fid]):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@ -458,10 +463,10 @@
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label"><?php echo $text_orders_custom_fields; ?></label> <label class="col-sm-2 control-label"><?php echo $text_orders_custom_fields; ?></label>
<div class="col-sm-10"> <div class="col-sm-10">
<div class="row"> <div class="row">
<?php foreach ($customFields['opencart'] as $customField) : ?> <?php foreach ($customFields['opencart'] as $customField) : ?>
@ -472,7 +477,7 @@
<select id="retailcrm_custom_field_<?php echo $fid; ?>" name="retailcrm_custom_field[<?php echo $fid; ?>]" class="form-control"> <select id="retailcrm_custom_field_<?php echo $fid; ?>" name="retailcrm_custom_field[<?php echo $fid; ?>]" class="form-control">
<?php foreach ($customFields['retailcrm']['orders'] as $v): ?> <?php foreach ($customFields['retailcrm']['orders'] as $v): ?>
<option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_custom_field'][$fid]) && $v['code'] == $saved_settings['retailcrm_custom_field'][$fid]):?>selected="selected"<?php endif;?>> <option value="<?php echo $v['code'];?>" <?php if(isset($saved_settings['retailcrm_custom_field'][$fid]) && $v['code'] == $saved_settings['retailcrm_custom_field'][$fid]):?>selected="selected"<?php endif;?>>
<?php echo $v['name'];?> <?php echo $v['name'];?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@ -482,8 +487,8 @@
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
</div> </div>
</div> </div>
<?php elseif (!$customFields['retailcrm'] && !$customFields['opencart']) : ?> <?php elseif (!$customFields['retailcrm'] && !$customFields['opencart']) : ?>
<div class="alert alert-info"><i class="fa fa-exclamation-circle"></i> <div class="alert alert-info"><i class="fa fa-exclamation-circle"></i>
<button type="button" class="close" data-dismiss="alert">&times;</button> <button type="button" class="close" data-dismiss="alert">&times;</button>
@ -526,18 +531,18 @@
<div class="retailcrm_unit"> <div class="retailcrm_unit">
<a onclick="confirm('<?php echo $text_confirm_log; ?>') ? location.href='<?php echo $clear_opencart; ?>' : false;" data-toggle="tooltip" title="<?php echo $button_clear; ?>" class="btn btn-danger"><i class="fa fa-eraser"></i> <span class="hidden-xs"><?php echo $button_clear; ?></span></a> <a onclick="confirm('<?php echo $text_confirm_log; ?>') ? location.href='<?php echo $clear_opencart; ?>' : false;" data-toggle="tooltip" title="<?php echo $button_clear; ?>" class="btn btn-danger"><i class="fa fa-eraser"></i> <span class="hidden-xs"><?php echo $button_clear; ?></span></a>
</div> </div>
<?php if (isset($logs['oc_api_log'])) : ?> <?php if (isset($logs['oc_api_log'])) : ?>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<textarea wrap="off" rows="15" readonly class="form-control"><?php echo $logs['oc_api_log']; ?></textarea> <textarea wrap="off" rows="15" readonly class="form-control"><?php echo $logs['oc_api_log']; ?></textarea>
</div> </div>
</div> </div>
<?php elseif (isset($logs['oc_error'])) : ?> <?php elseif (isset($logs['oc_error'])) : ?>
<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> <?php echo $logs['oc_error']; ?> <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> <?php echo $logs['oc_error']; ?>
<button type="button" class="close" data-dismiss="alert">&times;</button> <button type="button" class="close" data-dismiss="alert">&times;</button>
</div> </div>
<?php endif; ?> <?php endif; ?>
</fieldset> </fieldset>
</div> </div>
</div> </div>
</form> </form>
@ -548,70 +553,70 @@
<?php echo $footer; ?> <?php echo $footer; ?>
<script type="text/javascript"> <script type="text/javascript">
var token = '<?php echo $token; ?>'; var token = '<?php echo $token; ?>';
$('#icml').on('click', function() { $('#icml').on('click', function() {
$.ajax({ $.ajax({
url: '<?php echo $catalog; ?>' + 'admin/index.php?route=extension/module/retailcrm/icml&token=' + token, url: '<?php echo $catalog; ?>' + 'admin/index.php?route=extension/module/retailcrm/icml&token=' + token,
beforeSend: function() { beforeSend: function() {
$('#icml').button('loading'); $('#icml').button('loading');
}, },
complete: function() { complete: function() {
$('.alert-success').remove(); $('.alert-success').remove();
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> <?php echo $text_success_catalog; ?></div>'); $('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> <?php echo $text_success_catalog; ?></div>');
$('#icml').button('reset'); $('#icml').button('reset');
}, },
error: function(){ error: function(){
alert('error'); alert('error');
} }
});
}); });
});
$('#export').on('click', function() { $('#export').on('click', function() {
$.ajax({ $.ajax({
url: '<?php echo $catalog; ?>' + 'admin/index.php?route=extension/module/retailcrm/export&token=' + token, url: '<?php echo $catalog; ?>' + 'admin/index.php?route=extension/module/retailcrm/export&token=' + token,
beforeSend: function() { beforeSend: function() {
$('#export').button('loading'); $('#export').button('loading');
}, },
complete: function() { complete: function() {
$('.alert-success').remove(); $('.alert-success').remove();
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> <?php echo $text_success_export; ?></div>'); $('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> <?php echo $text_success_export; ?></div>');
$('#export').button('reset'); $('#export').button('reset');
}, },
error: function(){ error: function(){
alert('error'); alert('error');
} }
});
}); });
});
$('#export_order').on('click', function() { $('#export_order').on('click', function() {
var order_id = $('input[name=\'order_id\']').val(); var order_id = $('input[name=\'order_id\']').val();
if (order_id && order_id > 0) { if (order_id && order_id > 0) {
$.ajax({ $.ajax({
url: '<?php echo $catalog; ?>' + 'admin/index.php?route=extension/module/retailcrm/exportOrder&token=' + token + '&order_id=' + order_id, 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');
}, },
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) { success: function(data, textStatus, jqXHR) {
response = JSON.parse(jqXHR['responseText']); response = JSON.parse(jqXHR['responseText']);
if (response['status_code'] == '400') { if (response['status_code'] == '400') {
$('.alert-danger').remove();
$('#content > .container-fluid').prepend('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i><?php echo $text_error_order; ?>' + response['error_msg'] + '</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-danger').remove(); $('.alert-danger').remove();
$('#content > .container-fluid').prepend('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $text_error_order_id; ?></div>'); $('#content > .container-fluid').prepend('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i><?php echo $text_error_order; ?>' + response['error_msg'] + '</div>');
$('#export_order').button('reset'); $('#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-danger').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>

View File

@ -3,33 +3,33 @@
<div class="page-header"> <div class="page-header">
<div class="container-fluid"> <div class="container-fluid">
<div class="pull-right"> <div class="pull-right">
{% if export_file %} {% if export_file %}
<button type="button" id="export" data-toggle="tooltip" title="{{ text_button_export }}" class="btn btn-success"><i class="fa fa-download"></i></button> <button type="button" id="export" data-toggle="tooltip" title="{{ text_button_export }}" class="btn btn-success"><i class="fa fa-download"></i></button>
{% endif %} {% endif %}
<button type="button" id="icml" data-toggle="tooltip" title="{{ text_button_catalog }}" class="btn btn-success"><i class="fa fa-file-text-o"></i></button> <button type="button" id="icml" data-toggle="tooltip" title="{{ text_button_catalog }}" class="btn btn-success"><i class="fa fa-file-text-o"></i></button>
<button type="submit" form="form-module" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button> <button type="submit" form="form-module" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
<a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div> <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
<h1>{{ heading_title }}</h1> <h1>{{ heading_title }}</h1>
<ul class="breadcrumb"> <ul class="breadcrumb">
{% for breadcrumb in breadcrumbs %} {% for breadcrumb in breadcrumbs %}
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
</div> </div>
<div class="container-fluid"> <div class="container-fluid">
{% if error_warning %} {% if error_warning %}
<div class="alert alert-danger"> <div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">&times;</button> <button type="button" class="close" data-dismiss="alert">&times;</button>
<i class="fa fa-exclamation-circle"></i> {{ error_warning }} <i class="fa fa-exclamation-circle"></i> {{ error_warning }}
</div> </div>
{% endif %} {% endif %}
{% if saved_settings.module_retailcrm_url is defined %} {% if saved_settings.module_retailcrm_url is defined %}
<div class="alert alert-info"><i class="fa fa-exclamation-circle"></i> <div class="alert alert-info"><i class="fa fa-exclamation-circle"></i>
<button type="button" class="close" data-dismiss="alert">&times;</button> <button type="button" class="close" data-dismiss="alert">&times;</button>
{{ text_notice }} {{ text_notice }}
<a href="{{ saved_settings.module_retailcrm_url }}/admin/settings#t-main">{{ saved_settings.module_retailcrm_url }}/admin/settings#t-main</a> <a href="{{ saved_settings.module_retailcrm_url }}/admin/settings#t-main">{{ saved_settings.module_retailcrm_url }}/admin/settings#t-main</a>
</div> </div>
{% endif %} {% endif %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
@ -37,13 +37,13 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="#tab-general" data-toggle="tab">{{ general_tab_text }}</a></li> <li class="active"><a href="#tab-general" data-toggle="tab">{{ general_tab_text }}</a></li>
{% if saved_settings.module_retailcrm_apikey is defined and saved_settings.module_retailcrm_apikey and saved_settings.module_retailcrm_url is defined and saved_settings.module_retailcrm_url %} {% if saved_settings.module_retailcrm_apikey is defined and saved_settings.module_retailcrm_apikey and saved_settings.module_retailcrm_url is defined and saved_settings.module_retailcrm_url %}
<li><a href="#tab-references" data-toggle="tab">{{ references_tab_text }}</a></li> <li><a href="#tab-references" data-toggle="tab">{{ references_tab_text }}</a></li>
<li><a href="#tab-collector" data-toggle="tab">{{ collector_tab_text }}</a></li> <li><a href="#tab-collector" data-toggle="tab">{{ collector_tab_text }}</a></li>
{% if saved_settings.module_retailcrm_apiversion == 'v5' %} {% if saved_settings.module_retailcrm_apiversion == 'v5' %}
<li><a href="#tab-custom_fields" data-toggle="tab"> {{ custom_fields_tab_text }} </a></li> <li><a href="#tab-custom_fields" data-toggle="tab"> {{ custom_fields_tab_text }} </a></li>
{% endif %}
<li><a href="#tab-logs" data-toggle="tab">{{ logs_tab_text }}</a></li>
{% endif %} {% endif %}
<li><a href="#tab-logs" data-toggle="tab">{{ logs_tab_text }}</a></li>
{% endif %}
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="tab-general"> <div class="tab-pane active" id="tab-general">
@ -79,14 +79,14 @@
<label class="col-sm-2 control-label"></label> <label class="col-sm-2 control-label"></label>
<div class="col-lg-4 col-md-6 col-sm-10"> <div class="col-lg-4 col-md-6 col-sm-10">
<div class="well well-sm" style="height: 150px; overflow: auto;"> <div class="well well-sm" style="height: 150px; overflow: auto;">
{% for country in countries %} {% for country in countries %}
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="module_retailcrm_country[]" value="{{ country.country_id }}" {% if saved_settings.module_retailcrm_country is defined and country.country_id in saved_settings.module_retailcrm_country %} {{ 'checked' }} {% endif %}"> <input type="checkbox" name="module_retailcrm_country[]" value="{{ country.country_id }}" {% if saved_settings.module_retailcrm_country is defined and country.country_id in saved_settings.module_retailcrm_country %} {{ 'checked' }} {% endif %}">
{{ country.name }} {{ country.name }}
</label> </label>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> </div>
@ -110,8 +110,8 @@
</fieldset> </fieldset>
{% if saved_settings.module_retailcrm_apikey is defined and saved_settings.module_retailcrm_apikey and saved_settings.module_retailcrm_url is defined and saved_settings.module_retailcrm_url %} {% if saved_settings.module_retailcrm_apikey is defined and saved_settings.module_retailcrm_apikey and saved_settings.module_retailcrm_url is defined and saved_settings.module_retailcrm_url %}
{% if retailcrm_errors|length %} {% if retailcrm_errors|length %}
{% for retailcrm_error in retailcrm_errors %} {% for retailcrm_error in retailcrm_errors %}
<div class="warning">{{ retailcrm_error }}</div> <div class="warning">{{ retailcrm_error }}</div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<fieldset> <fieldset>
@ -131,23 +131,28 @@
</div> </div>
</fieldset> </fieldset>
{% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion != 'v3' %} {% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion != 'v3' %}
<fieldset> <fieldset>
<legend>{{ special_price_settings }}</legend> <legend>{{ special_price_settings }}</legend>
<div class="form-group retailcrm_unit"> <div class="form-group retailcrm_unit">
<label class="col-sm-2 control-label">{{ special_price_settings }}</label> {% for customerGroup in customerGroups %}
<div class="col-md-4 col-sm-10"> {% set cud = customerGroup.customer_group_id %}
<select id="module_retailcrm_special" name="module_retailcrm_special" class="form-control"> <div class="row retailcrm_unit">
{% for priceType in priceTypes %} <label class="col-sm-2 control-label" for="opencart_customer_group_{{ cud }}">{{ customerGroup.name }}</label>
{% if priceType.active == true %} <div class="col-md-4 col-sm-10">
<option value="{{priceType.code }}" {% if saved_settings.module_retailcrm_special is defined and saved_settings.module_retailcrm_special == priceType.code %} selected="selected" {% endif %}> <select id="module_retailcrm_special_{{ cud }}" name="module_retailcrm_special_{{ cud }}" class="form-control">
{{ priceType.name }} {% for priceType in priceTypes %}
</option> {% if priceType.active == true %}
{% endif %} <option value ="{{ priceType.code }}" {% if saved_settings['module_retailcrm_special_'~cud] is defined and priceType.code == saved_settings['module_retailcrm_special_'~cud] %} selected="selected" {% endif %}>
{% endfor %} {{ priceType.name }}
</select> </option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
{% endfor %}
</div> </div>
</div> </fieldset>
</fieldset>
{% endif %} {% endif %}
<fieldset> <fieldset>
<legend>{{ order_number }}</legend> <legend>{{ order_number }}</legend>
@ -156,16 +161,16 @@
<div class="col-sm-10"> <div class="col-sm-10">
<label class="control-label" class="radio-inline"> <label class="control-label" class="radio-inline">
<input type="radio" name="module_retailcrm_order_number" value="1" <input type="radio" name="module_retailcrm_order_number" value="1"
{% if saved_settings.module_retailcrm_order_number is defined and saved_settings.module_retailcrm_order_number == 1 %} {% if saved_settings.module_retailcrm_order_number is defined and saved_settings.module_retailcrm_order_number == 1 %}
checked checked
{% endif %} /> {% endif %} />
{{ text_yes }} {{ text_yes }}
</label> </label>
<label class="control-label" class="radio-inline"> <label class="control-label" class="radio-inline">
<input type="radio" name="module_retailcrm_order_number" value="0" <input type="radio" name="module_retailcrm_order_number" value="0"
{% if saved_settings.module_retailcrm_order_number is not defined or saved_settings.module_retailcrm_order_number == 0 %} {% if saved_settings.module_retailcrm_order_number is not defined or saved_settings.module_retailcrm_order_number == 0 %}
checked checked
{% endif %} /> {% endif %} />
{{ text_no }} {{ text_no }}
</label> </label>
</div> </div>
@ -179,36 +184,36 @@
<label class="col-sm-2 control-label"> {{ retailcrm_dict_delivery }}</label> <label class="col-sm-2 control-label"> {{ retailcrm_dict_delivery }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<div class="row"> <div class="row">
{% if delivery.opencart is not empty %} {% if delivery.opencart is not empty %}
{% for value in delivery.opencart %} {% for value in delivery.opencart %}
<div class="col-sm-12" style="margin-bottom:10px;"> <div class="col-sm-12" style="margin-bottom:10px;">
<div class="pm">{{ value.title ~ ':' }}</div> <div class="pm">{{ value.title ~ ':' }}</div>
{% for key, val in value %} {% for key, val in value %}
{% if key != 'title' %} {% if key != 'title' %}
<div class="form-group retailcrm_unit"> <div class="form-group retailcrm_unit">
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<select id="retailcrm_delivery_{{ val.code }}" name="module_retailcrm_delivery[{{ val.code }}]" class="form-control"> <select id="retailcrm_delivery_{{ val.code }}" name="module_retailcrm_delivery[{{ val.code }}]" class="form-control">
{% for k, v in delivery.retailcrm %} {% for k, v in delivery.retailcrm %}
<option value="{{ v.code }}" {% if saved_settings.module_retailcrm_delivery[key] is defined and v.code == saved_settings.module_retailcrm_delivery[key] %} selected="selected" {% endif %}> <option value="{{ v.code }}" {% if saved_settings.module_retailcrm_delivery[key] is defined and v.code == saved_settings.module_retailcrm_delivery[key] %} selected="selected" {% endif %}>
{{ v.name }} {{ v.name }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<label class="control-label" for="retailcrm_pm_{{ val.code }}">{{ val.title }}</label> <label class="control-label" for="retailcrm_pm_{{ val.code }}">{{ val.title }}</label>
</div> </div>
</div>
{% endif %}
{% endfor %}
</div> </div>
{% endif %} {% endfor %}
{% endfor %} {% else %}
<div class="alert alert-info"><i class="fa fa-exclamation-circle"></i>
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ text_error_delivery }}
</div> </div>
{% endfor %} {% endif %}
{% else %}
<div class="alert alert-info"><i class="fa fa-exclamation-circle"></i>
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ text_error_delivery }}
</div>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
@ -216,21 +221,21 @@
<label class="col-sm-2 control-label">{{ retailcrm_dict_status }}</label> <label class="col-sm-2 control-label">{{ retailcrm_dict_status }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
{% for status in statuses.opencart %} {% for status in statuses.opencart %}
{% set uid = status.order_status_id %} {% set uid = status.order_status_id %}
<div class="row retailcrm_unit"> <div class="row retailcrm_unit">
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<select id="retailcrm_status_{{ uid }}" name="module_retailcrm_status[{{ status.order_status_id }}]" class="form-control"> <select id="retailcrm_status_{{ uid }}" name="module_retailcrm_status[{{ status.order_status_id }}]" class="form-control">
{% for k, v in statuses.retailcrm %} {% for k, v in statuses.retailcrm %}
<option value="{{ v.code }}" {% if saved_settings.module_retailcrm_status[uid] is defined and v.code == saved_settings.module_retailcrm_status[uid] %} selected="selected" {% endif %}> <option value="{{ v.code }}" {% if saved_settings.module_retailcrm_status[uid] is defined and v.code == saved_settings.module_retailcrm_status[uid] %} selected="selected" {% endif %}>
{{ v.name }} {{ v.name }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
</div>
<div class="col-lg-4 col-md-6 col-sm-6">
<label class="control-label" for="retailcrm_status_{{ status.order_status_id }} ">{{ status.name }}</label>
</div>
</div> </div>
<div class="col-lg-4 col-md-6 col-sm-6">
<label class="control-label" for="retailcrm_status_{{ status.order_status_id }} ">{{ status.name }}</label>
</div>
</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
@ -238,20 +243,20 @@
<label class="col-sm-2 control-label">{{ retailcrm_dict_payment }}</label> <label class="col-sm-2 control-label">{{ retailcrm_dict_payment }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
{% for key, value in payments.opencart %} {% for key, value in payments.opencart %}
<div class="row retailcrm_unit"> <div class="row retailcrm_unit">
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<select id="retailcrm_payment_{{ key }}" name="module_retailcrm_payment[{{ key }}]" class="form-control"> <select id="retailcrm_payment_{{ key }}" name="module_retailcrm_payment[{{ key }}]" class="form-control">
{% for k, v in payments.retailcrm %} {% for k, v in payments.retailcrm %}
<option value="{{ v.code }}" {% if saved_settings.module_retailcrm_payment[key] is defined and v.code == saved_settings.module_retailcrm_payment[key] %} selected="selected" {% endif %}> <option value="{{ v.code }}" {% if saved_settings.module_retailcrm_payment[key] is defined and v.code == saved_settings.module_retailcrm_payment[key] %} selected="selected" {% endif %}>
{{ v.name }} {{ v.name }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
</div>
<div class="col-lg-4 col-md-6 col-sm-6">
<label class="control-label" for="retailcrm_payment_{{ key }}">{{ value }}</label>
</div>
</div> </div>
<div class="col-lg-4 col-md-6 col-sm-6">
<label class="control-label" for="retailcrm_payment_{{ key }}">{{ value }}</label>
</div>
</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
@ -264,9 +269,9 @@
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<select id="module_retailcrm_default_payment" name="module_retailcrm_default_payment" class="form-control"> <select id="module_retailcrm_default_payment" name="module_retailcrm_default_payment" class="form-control">
{% for k, v in payments.opencart %} {% for k, v in payments.opencart %}
<option value="{{ k }}" {% if saved_settings.module_retailcrm_default_payment is defined and k == saved_settings.module_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 %}
</select> </select>
</div> </div>
@ -280,15 +285,15 @@
<div class="col-lg-4 col-md-6 col-sm-6"> <div class="col-lg-4 col-md-6 col-sm-6">
<select id="module_retailcrm_default_shipping" name="module_retailcrm_default_shipping" class="form-control"> <select id="module_retailcrm_default_shipping" name="module_retailcrm_default_shipping" class="form-control">
{% for key, value in delivery.opencart %} {% for key, value in delivery.opencart %}
<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.module_retailcrm_default_shipping is defined and v.code == saved_settings.module_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 %}
{% endfor %} {% endfor %}
</optgroup> </optgroup>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
@ -308,9 +313,9 @@
<select id="retailcrm_missing_status" name="module_retailcrm_missing_status" class="form-control"> <select id="retailcrm_missing_status" name="module_retailcrm_missing_status" class="form-control">
<option></option> <option></option>
{% for k, v in statuses.retailcrm %} {% for k, v in statuses.retailcrm %}
<option value="{{ k }}" {% if saved_settings.module_retailcrm_missing_status is defined and k == saved_settings.module_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 %}
</select> </select>
</div> </div>
@ -325,17 +330,17 @@
<fieldset> <fieldset>
<legend>{{ daemon_collector }}</legend> <legend>{{ daemon_collector }}</legend>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label" for="retailcrm_collector_active" class="col-md-4">{{ text_collector_activity }}</label> <label class="col-sm-2 control-label" for="retailcrm_collector_active" class="col-md-4">{{ text_collector_activity }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<label class="control-label" class="radio-inline"> <label class="control-label" class="radio-inline">
<input type="radio" name="module_retailcrm_collector_active" value="1" {% if saved_settings.module_retailcrm_collector_active is defined and <input type="radio" name="module_retailcrm_collector_active" value="1" {% if saved_settings.module_retailcrm_collector_active is defined and
saved_settings.module_retailcrm_collector_active == 1 %} {{ 'checked' }} saved_settings.module_retailcrm_collector_active == 1 %} {{ 'checked' }}
{% endif %}> {% endif %}>
{{ text_yes }} {{ text_yes }}
</label> </label>
<label class="control-label" class="radio-inline"> <label class="control-label" class="radio-inline">
<input type="radio" name="module_retailcrm_collector_active" value="0" {% if not saved_settings.module_retailcrm_collector_active or <input type="radio" name="module_retailcrm_collector_active" value="0" {% if not saved_settings.module_retailcrm_collector_active or
saved_settings.module_retailcrm_collector_active == 0 %} {{ 'checked' }} saved_settings.module_retailcrm_collector_active == 0 %} {{ 'checked' }}
{% endif %}> {% endif %}>
{{ text_no }} {{ text_no }}
</label> </label>
@ -352,13 +357,13 @@
<div class="col-sm-10"> <div class="col-sm-10">
<label class="control-label" class="radio-inline"> <label class="control-label" class="radio-inline">
<input type="radio" name="module_retailcrm_collector[form_capture]" value="1" {% if saved_settings.module_retailcrm_collector.form_capture is defined and <input type="radio" name="module_retailcrm_collector[form_capture]" value="1" {% if saved_settings.module_retailcrm_collector.form_capture is defined and
saved_settings.module_retailcrm_collector.form_capture == 1 %} {{ 'checked' }} saved_settings.module_retailcrm_collector.form_capture == 1 %} {{ 'checked' }}
{% endif %}> {% endif %}>
{{ text_yes }} {{ text_yes }}
</label> </label>
<label class="control-label" class="radio-inline"> <label class="control-label" class="radio-inline">
<input type="radio" name="module_retailcrm_collector[form_capture]" value="0" {% if saved_settings.module_retailcrm_collector.form_capture is not defined or <input type="radio" name="module_retailcrm_collector[form_capture]" value="0" {% if saved_settings.module_retailcrm_collector.form_capture is not defined or
saved_settings.module_retailcrm_collector.form_capture == 0 %} {{ 'checked' }} saved_settings.module_retailcrm_collector.form_capture == 0 %} {{ 'checked' }}
{% endif %}> {% endif %}>
{{ text_no }} {{ text_no }}
</label> </label>
@ -383,37 +388,37 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label" for="module_retailcrm_collector" class="col-md-4">{{ collector_custom_text }}</label> <label class="col-sm-2 control-label" for="module_retailcrm_collector" class="col-md-4">{{ collector_custom_text }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="module_retailcrm_collector[custom_form]" value="1" {% if saved_settings.module_retailcrm_collector.custom_form is defined and <input type="radio" name="module_retailcrm_collector[custom_form]" value="1" {% if saved_settings.module_retailcrm_collector.custom_form is defined and
saved_settings.module_retailcrm_collector.custom_form == 1 %} {{ 'checked' }} saved_settings.module_retailcrm_collector.custom_form == 1 %} {{ 'checked' }}
{% endif %}> {% endif %}>
{{ text_yes }} {{ text_yes }}
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="module_retailcrm_collector[custom_form]" value="0" {% if saved_settings.module_retailcrm_collector.custom_form is not defined or <input type="radio" name="module_retailcrm_collector[custom_form]" value="0" {% if saved_settings.module_retailcrm_collector.custom_form is not defined or
saved_settings.module_retailcrm_collector.custom_form == 0 %} {{ 'checked' }} saved_settings.module_retailcrm_collector.custom_form == 0 %} {{ 'checked' }}
{% endif %}> {% endif %}>
{{ text_no }} {{ text_no }}
</label> </label>
</div> </div>
</div> </div>
{% for field, label in collectorFields %} {% for field, label in collectorFields %}
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label" for="retailcrm_collector">{{ label }}</label> <label class="col-sm-2 control-label" for="retailcrm_collector">{{ label }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
<div class="row"> <div class="row">
<div class="col-md-4 col-sm-6"> <div class="col-md-4 col-sm-6">
<input class="form-control" id="module_retailcrm_collector" type="text" name="module_retailcrm_collector[custom][{{ field }}]" value="{% if saved_settings.module_retailcrm_collector.custom[field] is defined %} {{ saved_settings.module_retailcrm_collector.custom[field] }} {% endif %}"> <input class="form-control" id="module_retailcrm_collector" type="text" name="module_retailcrm_collector[custom][{{ field }}]" value="{% if saved_settings.module_retailcrm_collector.custom[field] is defined %} {{ saved_settings.module_retailcrm_collector.custom[field] }} {% endif %}">
</div> </div>
<div class="col-md-8 col-sm-6" style="margin-top: 8px;"> <div class="col-md-8 col-sm-6" style="margin-top: 8px;">
<input input style="margin-top: 0; vertical-align: middle;" type="checkbox" name="module_retailcrm_collector[require][{{ field }}_require]" value="1" {% if saved_settings.module_retailcrm_collector.require[field ~'_require'] %} checked {% endif %}> <input input style="margin-top: 0; vertical-align: middle;" type="checkbox" name="module_retailcrm_collector[require][{{ field }}_require]" value="1" {% if saved_settings.module_retailcrm_collector.require[field ~'_require'] %} checked {% endif %}>
<label style="margin-bottom: 0; vertical-align: middle; margin-left: 5px;" for="retailcrm_collector">{{ text_require }}</label> <label style="margin-bottom: 0; vertical-align: middle; margin-left: 5px;" for="retailcrm_collector">{{ text_require }}</label>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
{% endfor %} {% endfor %}
</fieldset> </fieldset>
</div> </div>
@ -427,14 +432,14 @@
<div class="col-sm-10"> <div class="col-sm-10">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="module_retailcrm_custom_field_active" value="1" {% if saved_settings.module_retailcrm_custom_field_active is defined and <input type="radio" name="module_retailcrm_custom_field_active" value="1" {% if saved_settings.module_retailcrm_custom_field_active is defined and
saved_settings.module_retailcrm_custom_field_active == 1 %} saved_settings.module_retailcrm_custom_field_active == 1 %}
checked {% endif %} > checked {% endif %} >
{{ text_yes }} {{ text_yes }}
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="module_retailcrm_custom_field_active" value="0" {% if saved_settings.module_retailcrm_custom_field_active is not defined or <input type="radio" name="module_retailcrm_custom_field_active" value="0" {% if saved_settings.module_retailcrm_custom_field_active is not defined or
saved_settings.module_retailcrm_custom_field_active == 0 %} saved_settings.module_retailcrm_custom_field_active == 0 %}
checked {% endif %} > checked {% endif %} >
{{ text_no }} {{ text_no }}
</label> </label>
</div> </div>
@ -444,21 +449,21 @@
<div class="col-sm-10"> <div class="col-sm-10">
<div class="row"> <div class="row">
{% for customField in customFields.opencart %} {% for customField in customFields.opencart %}
<div class="col-sm-12" style="margin-bottom:5px;"> <div class="col-sm-12" style="margin-bottom:5px;">
<div class="row"> <div class="row">
{% set fid = 'c_' ~ customField.custom_field_id %} {% set fid = 'c_' ~ customField.custom_field_id %}
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-control" id="module_retailcrm_custom_field_{{ fid }}" name="module_retailcrm_custom_field[{{ fid }}]" > <select class="form-control" id="module_retailcrm_custom_field_{{ fid }}" name="module_retailcrm_custom_field[{{ fid }}]" >
{% for v in customFields.retailcrm.customers %} {% for v in customFields.retailcrm.customers %}
<option value="{{ v.code }}" {% if saved_settings.module_retailcrm_custom_field[fid] is defined and v.code == saved_settings.module_retailcrm_custom_field[fid] %} selected="selected" {% endif %}> <option value="{{ v.code }}" {% if saved_settings.module_retailcrm_custom_field[fid] is defined and v.code == saved_settings.module_retailcrm_custom_field[fid] %} selected="selected" {% endif %}>
{{ v.name }} {{ v.name }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
</div>
<label style="padding-top: 9px;" for="module_retailcrm_custom_field_{{ fid }}">{{ customField.name }}</label>
</div> </div>
<label style="padding-top: 9px;" for="module_retailcrm_custom_field_{{ fid }}">{{ customField.name }}</label>
</div> </div>
</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
@ -468,21 +473,21 @@
<div class="col-sm-10"> <div class="col-sm-10">
<div class="row"> <div class="row">
{% for customField in customFields.opencart %} {% for customField in customFields.opencart %}
<div class="col-sm-12" style="margin-bottom:5px;"> <div class="col-sm-12" style="margin-bottom:5px;">
<div class="row"> <div class="row">
{% set fid = 'o_' ~ customField.custom_field_id %} {% set fid = 'o_' ~ customField.custom_field_id %}
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-control" id="module_retailcrm_custom_field_{{ fid }}" name="module_retailcrm_custom_field[{{ fid }}]" > <select class="form-control" id="module_retailcrm_custom_field_{{ fid }}" name="module_retailcrm_custom_field[{{ fid }}]" >
{% for v in customFields.retailcrm.orders %} {% for v in customFields.retailcrm.orders %}
<option value="{{ v.code }}" {% if saved_settings.module_retailcrm_custom_field[fid] is defined and v.code == saved_settings.module_retailcrm_custom_field[fid] %} selected="selected" {% endif %}> <option value="{{ v.code }}" {% if saved_settings.module_retailcrm_custom_field[fid] is defined and v.code == saved_settings.module_retailcrm_custom_field[fid] %} selected="selected" {% endif %}>
{{ v.name }} {{ v.name }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
</div>
<label style="padding-top: 9px;" for="module_retailcrm_custom_field_{{ fid }}">{{ customField.name }}</label>
</div> </div>
<label style="padding-top: 9px;" for="module_retailcrm_custom_field_{{ fid }}">{{ customField.name }}</label>
</div> </div>
</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
@ -513,11 +518,11 @@
<a onclick="confirm('{{ text_confirm_log }}') ? location.href='{{ clear_retailcrm }}' : false;" data-toggle="tooltip" title="{{ button_clear }}" class="btn btn-danger"><i class="fa fa-eraser"></i></a> <a onclick="confirm('{{ text_confirm_log }}') ? location.href='{{ clear_retailcrm }}' : false;" data-toggle="tooltip" title="{{ button_clear }}" class="btn btn-danger"><i class="fa fa-eraser"></i></a>
</div> </div>
{% if logs.retailcrm_log is defined %} {% if logs.retailcrm_log is defined %}
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<textarea wrap="off" rows="15" readonly class="form-control">{{ logs.retailcrm_log }}</textarea> <textarea wrap="off" rows="15" readonly class="form-control">{{ logs.retailcrm_log }}</textarea>
</div>
</div> </div>
</div>
{% elseif logs.retailcrm_error is defined %} {% elseif logs.retailcrm_error is defined %}
<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ logs.retailcrm_error }} <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ logs.retailcrm_error }}
<button type="button" class="close" data-dismiss="alert">&times;</button> <button type="button" class="close" data-dismiss="alert">&times;</button>
@ -530,11 +535,11 @@
<a onclick="confirm('{{ text_confirm_log }}') ? location.href='{{ clear_opencart }}' : false;" data-toggle="tooltip" title="{{ button_clear }}" class="btn btn-danger"><i class="fa fa-eraser"></i></a> <a onclick="confirm('{{ text_confirm_log }}') ? location.href='{{ clear_opencart }}' : false;" data-toggle="tooltip" title="{{ button_clear }}" class="btn btn-danger"><i class="fa fa-eraser"></i></a>
</div> </div>
{% if logs.oc_api_log is defined %} {% if logs.oc_api_log is defined %}
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<textarea wrap="off" rows="15" readonly class="form-control">{{ logs.oc_api_log }}</textarea> <textarea wrap="off" rows="15" readonly class="form-control">{{ logs.oc_api_log }}</textarea>
</div>
</div> </div>
</div>
{% elseif logs.oc_error is defined %} {% elseif logs.oc_error is defined %}
<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ logs.oc_error }} <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ logs.oc_error }}
<button type="button" class="close" data-dismiss="alert">&times;</button> <button type="button" class="close" data-dismiss="alert">&times;</button>

View File

@ -17,7 +17,8 @@ class ModelRetailcrmPricesAdminTest extends OpenCartTest
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(array( ->setMethods(array(
'storePricesUpload', 'storePricesUpload',
'sitesList' 'sitesList',
'isSuccessful'
)) ))
->getMock(); ->getMock();
@ -28,13 +29,23 @@ class ModelRetailcrmPricesAdminTest extends OpenCartTest
$this->retailcrm->getModuleTitle(), $this->retailcrm->getModuleTitle(),
array( array(
$this->retailcrm->getModuleTitle() . '_apiversion' => 'v5', $this->retailcrm->getModuleTitle() . '_apiversion' => 'v5',
$this->retailcrm->getModuleTitle() . '_special' => 'special' $this->retailcrm->getModuleTitle() . '_special_1' => 'special1',
$this->retailcrm->getModuleTitle() . '_special_2' => 'special2'
) )
); );
} }
public function testUploadPrices() public function testUploadPrices()
{ {
$response = new \RetailcrmApiResponse(
201,
json_encode(
$this->sites()
)
);
$this->apiClientMock->expects($this->any())->method('sitesList')->willReturn($response);
$productModel = $this->loadModel('catalog/product'); $productModel = $this->loadModel('catalog/product');
$products = $productModel->getProducts(); $products = $productModel->getProducts();
$prices = $this->pricesModel->uploadPrices($products, $this->apiClientMock); $prices = $this->pricesModel->uploadPrices($products, $this->apiClientMock);
@ -48,4 +59,30 @@ class ModelRetailcrmPricesAdminTest extends OpenCartTest
$this->assertArrayHasKey('prices', $price); $this->assertArrayHasKey('prices', $price);
$this->assertInternalType('array', $price['prices']); $this->assertInternalType('array', $price['prices']);
} }
private function sites(){
return array(
"success"=> true,
"sites"=> array(
"BitrixMod"=> array(
"name"=> "site",
"url"=> "http://site.ru",
"code"=> "site",
"defaultForCrm"=> false,
"ymlUrl"=> "http://site.ru/retailcrm.xml",
"loadFromYml"=> false,
"catalogUpdatedAt"=> "2019-02-08 13:30:37",
"catalogLoadingAt"=> "2019-02-11 09:12:18",
"contragent"=> array(
"contragentType"=> "legal-entity",
"legalName"=> "code",
"code"=> "code",
"countryIso"=> "RU",
"vatRate"=> "",
),
"countryIso"=> "",
)
),
);
}
} }