feat(4.1): add multi-supplier nat_sources, overwrite protection rules, history tracking and product events
This commit is contained in:
parent
6aa36eff9c
commit
59d4aee88c
|
|
@ -121,7 +121,7 @@ class EasyImportNat extends \Opencart\System\Engine\Controller {
|
||||||
'btn_catalog', 'btn_batch', 'btn_handy',
|
'btn_catalog', 'btn_batch', 'btn_handy',
|
||||||
'export_format', 'export_identifier', 'price_mode',
|
'export_format', 'export_identifier', 'price_mode',
|
||||||
'batch_export', 'batch_import', 'log_mode', 'log_lines',
|
'batch_export', 'batch_import', 'log_mode', 'log_lines',
|
||||||
'cron_secret', 'export_folder', 'export_path', 'inverse_special'
|
'cron_secret', 'export_folder', 'export_path', 'inverse_special', 'history_depth'
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($settings as $setting) {
|
foreach ($settings as $setting) {
|
||||||
|
|
@ -149,6 +149,7 @@ class EasyImportNat extends \Opencart\System\Engine\Controller {
|
||||||
if (empty($data['module_easy_import_nat_export_folder'])) $data['module_easy_import_nat_export_folder'] = 'import_nat';
|
if (empty($data['module_easy_import_nat_export_folder'])) $data['module_easy_import_nat_export_folder'] = 'import_nat';
|
||||||
if (empty($data['module_easy_import_nat_export_path'])) $data['module_easy_import_nat_export_path'] = 'root';
|
if (empty($data['module_easy_import_nat_export_path'])) $data['module_easy_import_nat_export_path'] = 'root';
|
||||||
if (!isset($data['module_easy_import_nat_inverse_special'])) $data['module_easy_import_nat_inverse_special'] = 0;
|
if (!isset($data['module_easy_import_nat_inverse_special'])) $data['module_easy_import_nat_inverse_special'] = 0;
|
||||||
|
if (!isset($data['module_easy_import_nat_history_depth']) || $data['module_easy_import_nat_history_depth'] === '') $data['module_easy_import_nat_history_depth'] = 5;
|
||||||
if ($data['module_easy_import_nat_status'] === null) $data['module_easy_import_nat_status'] = 1;
|
if ($data['module_easy_import_nat_status'] === null) $data['module_easy_import_nat_status'] = 1;
|
||||||
|
|
||||||
// Гарантированная передача переменных в шаблон:
|
// Гарантированная передача переменных в шаблон:
|
||||||
|
|
@ -288,6 +289,11 @@ class EasyImportNat extends \Opencart\System\Engine\Controller {
|
||||||
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD `import_batch` VARCHAR(64) NOT NULL DEFAULT '' AFTER `status`");
|
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD `import_batch` VARCHAR(64) NOT NULL DEFAULT '' AFTER `status`");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$query_sources = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "product` LIKE 'nat_sources'");
|
||||||
|
if (!$query_sources->num_rows) {
|
||||||
|
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD `nat_sources` VARCHAR(512) NOT NULL DEFAULT '' AFTER `import_batch`");
|
||||||
|
}
|
||||||
|
|
||||||
$query_model = $this->db->query("SHOW INDEX FROM `" . DB_PREFIX . "product` WHERE Key_name = 'model'");
|
$query_model = $this->db->query("SHOW INDEX FROM `" . DB_PREFIX . "product` WHERE Key_name = 'model'");
|
||||||
if (!$query_model->num_rows) {
|
if (!$query_model->num_rows) {
|
||||||
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD INDEX `model` (`model`)");
|
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD INDEX `model` (`model`)");
|
||||||
|
|
@ -335,6 +341,21 @@ class EasyImportNat extends \Opencart\System\Engine\Controller {
|
||||||
PRIMARY KEY (`history_id`)
|
PRIMARY KEY (`history_id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
|
||||||
|
|
||||||
|
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "easy_import_product_history` (
|
||||||
|
`history_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`product_id` INT(11) NOT NULL,
|
||||||
|
`batch_name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||||
|
`profile_id` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`price` DECIMAL(15,4) NOT NULL DEFAULT '0.0000',
|
||||||
|
`special` DECIMAL(15,4) NULL DEFAULT NULL,
|
||||||
|
`quantity` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`status` TINYINT(1) NOT NULL DEFAULT '1',
|
||||||
|
`date_added` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`history_id`),
|
||||||
|
KEY `idx_product_date` (`product_id`, `date_added`),
|
||||||
|
KEY `idx_batch` (`batch_name`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
|
||||||
|
|
||||||
// Clean up detailed text logs older than 30 days in DIR_CACHE
|
// Clean up detailed text logs older than 30 days in DIR_CACHE
|
||||||
if (is_dir(DIR_CACHE)) {
|
if (is_dir(DIR_CACHE)) {
|
||||||
$files = glob(DIR_CACHE . '*');
|
$files = glob(DIR_CACHE . '*');
|
||||||
|
|
@ -410,6 +431,9 @@ class EasyImportNat extends \Opencart\System\Engine\Controller {
|
||||||
if (isset($this->request->post['module_easy_import_nat_log_lines'])) {
|
if (isset($this->request->post['module_easy_import_nat_log_lines'])) {
|
||||||
$this->request->post['module_easy_import_nat_log_lines'] = max(1, (int)$this->request->post['module_easy_import_nat_log_lines']);
|
$this->request->post['module_easy_import_nat_log_lines'] = max(1, (int)$this->request->post['module_easy_import_nat_log_lines']);
|
||||||
}
|
}
|
||||||
|
if (isset($this->request->post['module_easy_import_nat_history_depth'])) {
|
||||||
|
$this->request->post['module_easy_import_nat_history_depth'] = max(1, min(50, (int)$this->request->post['module_easy_import_nat_history_depth']));
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($this->request->post['module_easy_import_nat_cron_secret'])) {
|
if (empty($this->request->post['module_easy_import_nat_cron_secret'])) {
|
||||||
$this->error['warning'] = $this->language->get('error_cron_secret');
|
$this->error['warning'] = $this->language->get('error_cron_secret');
|
||||||
|
|
@ -472,6 +496,30 @@ class EasyImportNat extends \Opencart\System\Engine\Controller {
|
||||||
'action' => 'extension/easy_import_nat/module/easy_import_nat' . $sep . 'eventProductListAfter',
|
'action' => 'extension/easy_import_nat/module/easy_import_nat' . $sep . 'eventProductListAfter',
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'sort_order' => 1
|
'sort_order' => 1
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'code' => 'easy_import_nat_product_form',
|
||||||
|
'description' => 'Easy Import/Export [NAT] Product Form Sources & History',
|
||||||
|
'trigger' => 'admin/view/catalog/product_form/after',
|
||||||
|
'action' => 'extension/easy_import_nat/module/easy_import_nat' . $sep . 'eventProductFormAfter',
|
||||||
|
'status' => 1,
|
||||||
|
'sort_order' => 1
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'code' => 'easy_import_nat_product_edit',
|
||||||
|
'description' => 'Easy Import/Export [NAT] Product Edit Sources',
|
||||||
|
'trigger' => 'admin/model/catalog/product.editProduct/after',
|
||||||
|
'action' => 'extension/easy_import_nat/module/easy_import_nat' . $sep . 'eventProductEditAfter',
|
||||||
|
'status' => 1,
|
||||||
|
'sort_order' => 1
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'code' => 'easy_import_nat_product_delete',
|
||||||
|
'description' => 'Easy Import/Export [NAT] Product Delete History',
|
||||||
|
'trigger' => 'admin/model/catalog/product.deleteProduct/after',
|
||||||
|
'action' => 'extension/easy_import_nat/module/easy_import_nat' . $sep . 'eventProductDeleteAfter',
|
||||||
|
'status' => 1,
|
||||||
|
'sort_order' => 1
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -495,6 +543,9 @@ class EasyImportNat extends \Opencart\System\Engine\Controller {
|
||||||
$this->model_setting_event->deleteEventByCode('easy_import_nat_column_left');
|
$this->model_setting_event->deleteEventByCode('easy_import_nat_column_left');
|
||||||
$this->model_setting_event->deleteEventByCode('easy_import_nat_header_after');
|
$this->model_setting_event->deleteEventByCode('easy_import_nat_header_after');
|
||||||
$this->model_setting_event->deleteEventByCode('easy_import_nat_product_list');
|
$this->model_setting_event->deleteEventByCode('easy_import_nat_product_list');
|
||||||
|
$this->model_setting_event->deleteEventByCode('easy_import_nat_product_form');
|
||||||
|
$this->model_setting_event->deleteEventByCode('easy_import_nat_product_edit');
|
||||||
|
$this->model_setting_event->deleteEventByCode('easy_import_nat_product_delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eventColumnLeft(string &$route, array &$args): void {
|
public function eventColumnLeft(string &$route, array &$args): void {
|
||||||
|
|
@ -1849,7 +1900,11 @@ public function importProcessChunk() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$simulate) {
|
if (!$simulate) {
|
||||||
$this->model_extension_easy_import_nat_module_easy_import_nat->updateProductBasic($product_id, $final_price, $final_quantity, $final_status, $batch_tag);
|
$new_sources = $this->model_extension_easy_import_nat_module_easy_import_nat->formatNewProductSources($batch_tag, isset($p['nat_sources']) ? $p['nat_sources'] : '');
|
||||||
|
$this->model_extension_easy_import_nat_module_easy_import_nat->updateProductBasic($product_id, $final_price, $final_quantity, $final_status, $batch_tag, $new_sources);
|
||||||
|
|
||||||
|
$active_profile_id = isset($this->request->post['profile_id']) ? (int)$this->request->post['profile_id'] : 0;
|
||||||
|
$this->model_extension_easy_import_nat_module_easy_import_nat->recordProductHistoryDelta($product_id, $batch_tag, $active_profile_id, $final_price, $raw_special, $final_quantity, $p, null, $final_status);
|
||||||
|
|
||||||
if ($name_val !== null) {
|
if ($name_val !== null) {
|
||||||
$this->model_extension_easy_import_nat_module_easy_import_nat->updateCustomField($product_id, DB_PREFIX . 'product_description', 'name', $name_val, $admin_lang_id);
|
$this->model_extension_easy_import_nat_module_easy_import_nat->updateCustomField($product_id, DB_PREFIX . 'product_description', 'name', $name_val, $admin_lang_id);
|
||||||
|
|
|
||||||
|
|
@ -570,3 +570,24 @@ $_['text_license_active'] = 'License Active';
|
||||||
$_['text_nat_domain_copied'] = 'Copied!';
|
$_['text_nat_domain_copied'] = 'Copied!';
|
||||||
$_['text_nat_support'] = 'Support:';
|
$_['text_nat_support'] = 'Support:';
|
||||||
$_['entry_license'] = 'License Key:';
|
$_['entry_license'] = 'License Key:';
|
||||||
|
|
||||||
|
// Supplier Overwrite Protection & Product History [NAT]
|
||||||
|
$_['text_supplier_conflict_title'] = 'Overwrite Protection (Supplier Priorities)';
|
||||||
|
$_['entry_supplier_conflict_action'] = 'Conflict Action';
|
||||||
|
$_['help_supplier_conflict_action'] = 'Action to take if product was previously updated by protected suppliers';
|
||||||
|
$_['text_conflict_action_none'] = 'Disabled (always update)';
|
||||||
|
$_['text_conflict_action_skip_all'] = 'Skip product completely (do not update)';
|
||||||
|
$_['text_conflict_action_protect_price'] = 'Protect Price & Specials (do not overwrite)';
|
||||||
|
$_['text_conflict_action_protect_stock'] = 'Protect Stock & Quantity (do not overwrite)';
|
||||||
|
$_['entry_supplier_conflict_scope'] = 'Check Scope';
|
||||||
|
$_['help_supplier_conflict_scope'] = 'Check against active supplier (import_batch) or any historical supplier (nat_sources)';
|
||||||
|
$_['text_conflict_scope_current'] = 'Current active supplier (import_batch)';
|
||||||
|
$_['text_conflict_scope_historical'] = 'Any historical supplier (nat_sources)';
|
||||||
|
$_['entry_supplier_conflict_batches'] = 'Protected Suppliers (Batch)';
|
||||||
|
$_['help_supplier_conflict_batches'] = 'Semicolon-separated supplier batch names protected from overwrite';
|
||||||
|
$_['help_supplier_conflict_batches_desc'] = 'E.g.: <code>merlion;erc;main_stock</code>';
|
||||||
|
$_['entry_history_depth'] = 'Product History Depth';
|
||||||
|
$_['help_history_depth'] = 'Number of recent price and stock snapshots displayed on the product form';
|
||||||
|
$_['entry_nat_sources'] = 'Sources [NAT]';
|
||||||
|
$_['help_nat_sources'] = 'All suppliers (imports) that have ever updated this product';
|
||||||
|
$_['text_nat_history_title'] = 'Recent Price & Stock Updates [NAT]';
|
||||||
|
|
|
||||||
|
|
@ -571,3 +571,24 @@ $_['text_license_active'] = 'Лицензия активна';
|
||||||
$_['text_nat_domain_copied'] = 'Скопировано!';
|
$_['text_nat_domain_copied'] = 'Скопировано!';
|
||||||
$_['text_nat_support'] = 'Поддержка:';
|
$_['text_nat_support'] = 'Поддержка:';
|
||||||
$_['entry_license'] = 'Лицензионный ключ:';
|
$_['entry_license'] = 'Лицензионный ключ:';
|
||||||
|
|
||||||
|
// Supplier Overwrite Protection & Product History [NAT]
|
||||||
|
$_['text_supplier_conflict_title'] = 'Защита от перезаписи (Приоритеты поставщиков)';
|
||||||
|
$_['entry_supplier_conflict_action'] = 'Действие при совпадении';
|
||||||
|
$_['help_supplier_conflict_action'] = 'Что делать, если товар уже обновлялся указанными защищёнными поставщиками';
|
||||||
|
$_['text_conflict_action_none'] = 'Отключено (обновлять всегда)';
|
||||||
|
$_['text_conflict_action_skip_all'] = 'Пропустить товар целиком (не обновлять)';
|
||||||
|
$_['text_conflict_action_protect_price'] = 'Защитить Цену и Акции (не перезаписывать)';
|
||||||
|
$_['text_conflict_action_protect_stock'] = 'Защитить Остаток (не перезаписывать)';
|
||||||
|
$_['entry_supplier_conflict_scope'] = 'Область проверки';
|
||||||
|
$_['help_supplier_conflict_scope'] = 'Проверять только текущего активного поставщика (import_batch) или любого из истории источников товара (nat_sources)';
|
||||||
|
$_['text_conflict_scope_current'] = 'Текущий активный поставщик (import_batch)';
|
||||||
|
$_['text_conflict_scope_historical'] = 'Любой поставщик из истории (nat_sources)';
|
||||||
|
$_['entry_supplier_conflict_batches'] = 'Защищённые поставщики (Batch)';
|
||||||
|
$_['help_supplier_conflict_batches'] = 'Имена поставщиков (import_batch) через точку с запятой, чьи товары защищены от перезаписи';
|
||||||
|
$_['help_supplier_conflict_batches_desc'] = 'Например: <code>merlion;erc;main_stock</code>';
|
||||||
|
$_['entry_history_depth'] = 'Глубина истории срезов на товар';
|
||||||
|
$_['help_history_depth'] = 'Количество последних изменений цен и остатков, отображаемых в карточке товара';
|
||||||
|
$_['entry_nat_sources'] = 'Источники [NAT]';
|
||||||
|
$_['help_nat_sources'] = 'Все поставщики (импорты), когда-либо обновлявшие этот товар';
|
||||||
|
$_['text_nat_history_title'] = 'Последние обновления цен и остатков [NAT]';
|
||||||
|
|
|
||||||
|
|
@ -572,3 +572,24 @@ $_['text_license_active'] = 'Ліцензія активна';
|
||||||
$_['text_nat_domain_copied'] = 'Скопійовано!';
|
$_['text_nat_domain_copied'] = 'Скопійовано!';
|
||||||
$_['text_nat_support'] = 'Підтримка:';
|
$_['text_nat_support'] = 'Підтримка:';
|
||||||
$_['entry_license'] = 'Ліцензійний ключ:';
|
$_['entry_license'] = 'Ліцензійний ключ:';
|
||||||
|
|
||||||
|
// Supplier Overwrite Protection & Product History [NAT]
|
||||||
|
$_['text_supplier_conflict_title'] = 'Захист від перезапису (Пріоритети постачальників)';
|
||||||
|
$_['entry_supplier_conflict_action'] = 'Дія при збігу';
|
||||||
|
$_['help_supplier_conflict_action'] = 'Що робити, якщо товар уже оновлювався вказаними захищеними постачальниками';
|
||||||
|
$_['text_conflict_action_none'] = 'Вимкнено (оновлювати завжди)';
|
||||||
|
$_['text_conflict_action_skip_all'] = 'Пропустити товар повністю (не оновлювати)';
|
||||||
|
$_['text_conflict_action_protect_price'] = 'Захистити Ціну та Акції (не перезаписувати)';
|
||||||
|
$_['text_conflict_action_protect_stock'] = 'Захистити Залишок (не перезаписувати)';
|
||||||
|
$_['entry_supplier_conflict_scope'] = 'Область перевірки';
|
||||||
|
$_['help_supplier_conflict_scope'] = 'Перевіряти лише поточного активного постачальника (import_batch) або будь-якого з історії джерел товару (nat_sources)';
|
||||||
|
$_['text_conflict_scope_current'] = 'Поточний активний постачальник (import_batch)';
|
||||||
|
$_['text_conflict_scope_historical'] = 'Будь-який постачальник з історії (nat_sources)';
|
||||||
|
$_['entry_supplier_conflict_batches'] = 'Захищені постачальники (Batch)';
|
||||||
|
$_['help_supplier_conflict_batches'] = 'Імена постачальників (import_batch) через крапку з комою, чиї товари захищені від перезапису';
|
||||||
|
$_['help_supplier_conflict_batches_desc'] = 'Наприклад: <code>merlion;erc;main_stock</code>';
|
||||||
|
$_['entry_history_depth'] = 'Глибина історії зрізів на товар';
|
||||||
|
$_['help_history_depth'] = 'Кількість останніх змін цін та залишків, що відображаються у картці товару';
|
||||||
|
$_['entry_nat_sources'] = 'Джерела [NAT]';
|
||||||
|
$_['help_nat_sources'] = 'Всі постачальники (імпорти), які коли-небудь оновлювали цей товар';
|
||||||
|
$_['text_nat_history_title'] = 'Останні оновлення цін та залишків [NAT]';
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class EasyImportNat extends \Opencart\System\Engine\Model {
|
||||||
}
|
}
|
||||||
$lang_id = $lang_q->num_rows ? (int)$lang_q->row['language_id'] : 1;
|
$lang_id = $lang_q->num_rows ? (int)$lang_q->row['language_id'] : 1;
|
||||||
}
|
}
|
||||||
$sql = "SELECT p.product_id, p.model, p.sku, pd.name, p.price, p.quantity, p.status, p.image, p.import_batch FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (p.product_id = pd.product_id AND pd.language_id = '" . (int)$lang_id . "')";
|
$sql = "SELECT p.product_id, p.model, p.sku, pd.name, p.price, p.quantity, p.status, p.image, p.import_batch, p.nat_sources FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (p.product_id = pd.product_id AND pd.language_id = '" . (int)$lang_id . "')";
|
||||||
|
|
||||||
if (!empty($data['filter_category']) && is_array($data['filter_category'])) {
|
if (!empty($data['filter_category']) && is_array($data['filter_category'])) {
|
||||||
$sql .= " LEFT JOIN `" . DB_PREFIX . "product_to_category` p2c ON (p.product_id = p2c.product_id)";
|
$sql .= " LEFT JOIN `" . DB_PREFIX . "product_to_category` p2c ON (p.product_id = p2c.product_id)";
|
||||||
|
|
@ -222,8 +222,14 @@ class EasyImportNat extends \Opencart\System\Engine\Model {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateProductBasic($product_id, $price, $quantity, $status, $batch) {
|
public function updateProductBasic($product_id, $price, $quantity, $status, $batch = null, $nat_sources = null) {
|
||||||
$sql = "UPDATE `" . DB_PREFIX . "product` SET price = '" . (float)$price . "', quantity = '" . (int)$quantity . "', status = '" . (int)$status . "', import_batch = '" . $this->db->escape($batch) . "'";
|
$sql = "UPDATE `" . DB_PREFIX . "product` SET price = '" . (float)$price . "', quantity = '" . (int)$quantity . "', status = '" . (int)$status . "'";
|
||||||
|
if ($batch !== null) {
|
||||||
|
$sql .= ", import_batch = '" . $this->db->escape($batch) . "'";
|
||||||
|
}
|
||||||
|
if ($nat_sources !== null) {
|
||||||
|
$sql .= ", nat_sources = '" . $this->db->escape($nat_sources) . "'";
|
||||||
|
}
|
||||||
if ((int)$quantity <= 0) {
|
if ((int)$quantity <= 0) {
|
||||||
$stock_status_out = (int)$this->config->get('config_stock_status_id') ?: 5;
|
$stock_status_out = (int)$this->config->get('config_stock_status_id') ?: 5;
|
||||||
$sql .= ", stock_status_id = '" . $stock_status_out . "'";
|
$sql .= ", stock_status_id = '" . $stock_status_out . "'";
|
||||||
|
|
@ -232,6 +238,136 @@ class EasyImportNat extends \Opencart\System\Engine\Model {
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function checkDb() {
|
||||||
|
$query_batch = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "product` LIKE 'import_batch'");
|
||||||
|
if (!$query_batch->num_rows) {
|
||||||
|
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD `import_batch` VARCHAR(64) NOT NULL DEFAULT '' AFTER `status`");
|
||||||
|
}
|
||||||
|
|
||||||
|
$query_sources = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "product` LIKE 'nat_sources'");
|
||||||
|
if (!$query_sources->num_rows) {
|
||||||
|
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD `nat_sources` VARCHAR(512) NOT NULL DEFAULT '' AFTER `import_batch`");
|
||||||
|
}
|
||||||
|
|
||||||
|
$query_model = $this->db->query("SHOW INDEX FROM `" . DB_PREFIX . "product` WHERE Key_name = 'model'");
|
||||||
|
if (!$query_model->num_rows) {
|
||||||
|
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD INDEX `model` (`model`)");
|
||||||
|
}
|
||||||
|
|
||||||
|
$query_sku = $this->db->query("SHOW INDEX FROM `" . DB_PREFIX . "product` WHERE Key_name = 'sku'");
|
||||||
|
if (!$query_sku->num_rows) {
|
||||||
|
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD INDEX `sku` (`sku`)");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "easy_import_nat_cron` (
|
||||||
|
`profile_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`type` VARCHAR(32) NOT NULL DEFAULT 'import',
|
||||||
|
`name` VARCHAR(128) NOT NULL,
|
||||||
|
`url` TEXT NOT NULL,
|
||||||
|
`mapping` MEDIUMTEXT NOT NULL,
|
||||||
|
`settings` MEDIUMTEXT NOT NULL,
|
||||||
|
`status` TINYINT(1) NOT NULL DEFAULT '1',
|
||||||
|
`date_last_run` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`profile_id`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
|
||||||
|
|
||||||
|
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "easy_import_product_history` (
|
||||||
|
`history_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`product_id` INT(11) NOT NULL,
|
||||||
|
`batch_name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||||
|
`profile_id` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`price` DECIMAL(15,4) NOT NULL DEFAULT '0.0000',
|
||||||
|
`special` DECIMAL(15,4) NULL DEFAULT NULL,
|
||||||
|
`quantity` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`status` TINYINT(1) NOT NULL DEFAULT '1',
|
||||||
|
`date_added` DATETIME NOT NULL,
|
||||||
|
PRIMARY KEY (`history_id`),
|
||||||
|
KEY `idx_product_date` (`product_id`, `date_added`),
|
||||||
|
KEY `idx_batch` (`batch_name`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function formatNewProductSources($batch_name, $existing_sources = '') {
|
||||||
|
$clean_batch = preg_replace('/[^a-zA-Z0-9_\-]/', '_', trim((string)$batch_name));
|
||||||
|
$clean_batch = trim($clean_batch, '_');
|
||||||
|
|
||||||
|
$sources = array();
|
||||||
|
if ($existing_sources !== '') {
|
||||||
|
$parts = explode(';', trim((string)$existing_sources, ';'));
|
||||||
|
foreach ($parts as $p) {
|
||||||
|
$p = trim($p);
|
||||||
|
if ($p !== '' && !in_array($p, $sources)) {
|
||||||
|
$sources[] = $p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($clean_batch !== '' && !in_array($clean_batch, $sources)) {
|
||||||
|
$sources[] = $clean_batch;
|
||||||
|
}
|
||||||
|
return ';' . implode(';', $sources) . ';';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function recordProductHistoryDelta($product_id, $batch_name, $profile_id, $price, $special, $quantity, $old_product, $old_special = null, $status = 1) {
|
||||||
|
$clean_batch = preg_replace('/[^a-zA-Z0-9_\-]/', '_', trim((string)$batch_name));
|
||||||
|
$clean_batch = trim($clean_batch, '_');
|
||||||
|
|
||||||
|
$old_p_price = isset($old_product['price']) ? (float)$old_product['price'] : 0.0;
|
||||||
|
$old_p_qty = isset($old_product['quantity']) ? (int)$old_product['quantity'] : 0;
|
||||||
|
$old_p_stat = isset($old_product['status']) ? (int)$old_product['status'] : 1;
|
||||||
|
$old_p_batch = isset($old_product['import_batch']) ? (string)$old_product['import_batch'] : '';
|
||||||
|
|
||||||
|
$new_price = ($price !== null) ? (float)$price : $old_p_price;
|
||||||
|
$new_qty = ($quantity !== null) ? (int)$quantity : $old_p_qty;
|
||||||
|
$new_stat = ($status !== null) ? (int)$status : $old_p_stat;
|
||||||
|
$new_special = ($special !== null && $special !== '') ? (float)$special : null;
|
||||||
|
|
||||||
|
$price_changed = abs($new_price - $old_p_price) > 0.0001;
|
||||||
|
$qty_changed = ($new_qty !== $old_p_qty);
|
||||||
|
$stat_changed = ($new_stat !== $old_p_stat);
|
||||||
|
$batch_changed = ($clean_batch !== '' && $clean_batch !== $old_p_batch);
|
||||||
|
|
||||||
|
$special_changed = false;
|
||||||
|
if ($new_special !== null) {
|
||||||
|
if ($old_special === null || abs($new_special - (float)$old_special) > 0.0001) {
|
||||||
|
$special_changed = true;
|
||||||
|
}
|
||||||
|
} elseif ($old_special !== null && (float)$old_special > 0) {
|
||||||
|
$special_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$price_changed && !$qty_changed && !$stat_changed && !$special_changed && !$batch_changed) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$special_sql = ($new_special !== null) ? "'" . (float)$new_special . "'" : "NULL";
|
||||||
|
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "easy_import_product_history` SET
|
||||||
|
product_id = '" . (int)$product_id . "',
|
||||||
|
batch_name = '" . $this->db->escape($clean_batch) . "',
|
||||||
|
profile_id = '" . (int)$profile_id . "',
|
||||||
|
price = '" . (float)$new_price . "',
|
||||||
|
special = " . $special_sql . ",
|
||||||
|
quantity = '" . (int)$new_qty . "',
|
||||||
|
status = '" . (int)$new_stat . "',
|
||||||
|
date_added = NOW()");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductHistory($product_id, $limit = 5) {
|
||||||
|
$limit = (int)$limit > 0 ? (int)$limit : 5;
|
||||||
|
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "easy_import_product_history`
|
||||||
|
WHERE product_id = '" . (int)$product_id . "'
|
||||||
|
ORDER BY date_added DESC, history_id DESC
|
||||||
|
LIMIT " . $limit);
|
||||||
|
return $query->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pruneProductHistory($days = 60) {
|
||||||
|
$days = (int)$days > 0 ? (int)$days : 60;
|
||||||
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "easy_import_product_history` WHERE date_added < DATE_SUB(NOW(), INTERVAL " . $days . " DAY)");
|
||||||
|
}
|
||||||
|
|
||||||
public function clearProductSpecials($product_id) {
|
public function clearProductSpecials($product_id) {
|
||||||
$this->db->query("DELETE FROM `" . DB_PREFIX . "product_special` WHERE product_id = '" . (int)$product_id . "'");
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "product_special` WHERE product_id = '" . (int)$product_id . "'");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3008,7 +3008,7 @@ function addModifierRow(context, existingData) {
|
||||||
html += ' </div>';
|
html += ' </div>';
|
||||||
html += '</td>';
|
html += '</td>';
|
||||||
|
|
||||||
html += '<td><button type="button" class="btn btn-danger" onclick="$(this).closest(\'tr\').remove(); updateVirtualFields();"><i class="fa fa-trash"></i></button></td>';
|
html += '<td><button type="button" class="btn btn-danger" onclick="$(this).closest("tr").remove(); updateVirtualFields();"><i class="fa fa-trash"></i></button></td>';
|
||||||
html += '</tr>';
|
html += '</tr>';
|
||||||
|
|
||||||
var $tr = $(html);
|
var $tr = $(html);
|
||||||
|
|
@ -3110,7 +3110,7 @@ function addCustomFieldRow(context, existingData) {
|
||||||
html += '<td><input type="text" class="cf-csv-export form-control" placeholder="{{ text_target_col_name|escape("js") }}" onkeyup="updateExportModifiers()"></td>';
|
html += '<td><input type="text" class="cf-csv-export form-control" placeholder="{{ text_target_col_name|escape("js") }}" onkeyup="updateExportModifiers()"></td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<td><button type="button" class="btn btn-danger" onclick="$(this).closest(\'tr\').remove(); updateExportModifiers();"><i class="fa fa-trash"></i></button></td>';
|
html += '<td><button type="button" class="btn btn-danger" onclick="$(this).closest("tr").remove(); updateExportModifiers();"><i class="fa fa-trash"></i></button></td>';
|
||||||
html += '</tr>';
|
html += '</tr>';
|
||||||
|
|
||||||
var $tr = $(html);
|
var $tr = $(html);
|
||||||
|
|
@ -3352,6 +3352,12 @@ function saveImportStateToSession() {
|
||||||
misc: {
|
misc: {
|
||||||
missing_action: $('#input-import-missing').val(),
|
missing_action: $('#input-import-missing').val(),
|
||||||
import_batch: $('input[name="import_batch_name"]').val(),
|
import_batch: $('input[name="import_batch_name"]').val(),
|
||||||
|
supplier_conflict_action: $('#input-supplier-conflict-action').val() || 'none',
|
||||||
|
supplier_conflict_scope: $('#input-supplier-conflict-scope').val() || 'current',
|
||||||
|
supplier_conflict_batches: $('#input-supplier-conflict-batches').val() || '',
|
||||||
|
supplier_conflict_action: $('#input-supplier-conflict-action').val() || 'none',
|
||||||
|
supplier_conflict_scope: $('#input-supplier-conflict-scope').val() || 'current',
|
||||||
|
supplier_conflict_batches: $('#input-supplier-conflict-batches').val() || '',
|
||||||
log_mode: $('select[name="module_easy_import_nat_log_mode"]').val(),
|
log_mode: $('select[name="module_easy_import_nat_log_mode"]').val(),
|
||||||
inverse_special: $('#input-import-inverse').is(':checked') ? '1' : '',
|
inverse_special: $('#input-import-inverse').is(':checked') ? '1' : '',
|
||||||
option_quantity_sync: $('#input-import-option-sync').is(':checked') ? '1' : '',
|
option_quantity_sync: $('#input-import-option-sync').is(':checked') ? '1' : '',
|
||||||
|
|
@ -3451,6 +3457,9 @@ function restoreImportStateFromSession() {
|
||||||
if (state.misc) {
|
if (state.misc) {
|
||||||
if (state.misc.missing_action) $('#input-import-missing').val(state.misc.missing_action);
|
if (state.misc.missing_action) $('#input-import-missing').val(state.misc.missing_action);
|
||||||
if (state.misc.import_batch) $('input[name="import_batch_name"]').val(state.misc.import_batch);
|
if (state.misc.import_batch) $('input[name="import_batch_name"]').val(state.misc.import_batch);
|
||||||
|
if (state.misc.supplier_conflict_action) $('#input-supplier-conflict-action').val(state.misc.supplier_conflict_action);
|
||||||
|
if (state.misc.supplier_conflict_scope) $('#input-supplier-conflict-scope').val(state.misc.supplier_conflict_scope);
|
||||||
|
if (state.misc.supplier_conflict_batches) $('#input-supplier-conflict-batches').val(state.misc.supplier_conflict_batches);
|
||||||
if (state.misc.log_mode) $('select[name="module_easy_import_nat_log_mode"]').val(state.misc.log_mode);
|
if (state.misc.log_mode) $('select[name="module_easy_import_nat_log_mode"]').val(state.misc.log_mode);
|
||||||
$('#input-import-inverse').prop('checked', state.misc.inverse_special === '1');
|
$('#input-import-inverse').prop('checked', state.misc.inverse_special === '1');
|
||||||
$('#input-import-option-sync').prop('checked', state.misc.option_quantity_sync === '1');
|
$('#input-import-option-sync').prop('checked', state.misc.option_quantity_sync === '1');
|
||||||
|
|
@ -4169,6 +4178,9 @@ $(document).ready(function() {
|
||||||
session_id: $('#input-import-file').data('session_id'),
|
session_id: $('#input-import-file').data('session_id'),
|
||||||
missing_action: $('#input-import-missing').val(),
|
missing_action: $('#input-import-missing').val(),
|
||||||
import_batch_name: $('input[name="import_batch_name"]').val(),
|
import_batch_name: $('input[name="import_batch_name"]').val(),
|
||||||
|
supplier_conflict_action: $('#input-supplier-conflict-action').val() || 'none',
|
||||||
|
supplier_conflict_scope: $('#input-supplier-conflict-scope').val() || 'current',
|
||||||
|
supplier_conflict_batches: $('#input-supplier-conflict-batches').val() || '',
|
||||||
batch_size: $('input[name="module_easy_import_nat_batch_import"]').val(),
|
batch_size: $('input[name="module_easy_import_nat_batch_import"]').val(),
|
||||||
log_mode: $('select[name="module_easy_import_nat_log_mode"]').val(),
|
log_mode: $('select[name="module_easy_import_nat_log_mode"]').val(),
|
||||||
inverse_special: $('#input-import-inverse').is(':checked') ? 1 : 0,
|
inverse_special: $('#input-import-inverse').is(':checked') ? 1 : 0,
|
||||||
|
|
@ -4805,6 +4817,9 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$('#cron-missing-action').val('skip');
|
$('#cron-missing-action').val('skip');
|
||||||
$('#cron-batch-name').val('');
|
$('#cron-batch-name').val('');
|
||||||
|
$('#cron-conflict-action').val('none');
|
||||||
|
$('#cron-conflict-scope').val('current');
|
||||||
|
$('#cron-conflict-batches').val('');
|
||||||
$('#cron-log-mode').val('changes');
|
$('#cron-log-mode').val('changes');
|
||||||
$('#cron-inverse-special').prop('checked', false);
|
$('#cron-inverse-special').prop('checked', false);
|
||||||
$('#cron-empty-special-action').val('skip');
|
$('#cron-empty-special-action').val('skip');
|
||||||
|
|
@ -5006,6 +5021,9 @@ $(document).ready(function() {
|
||||||
if (typeof settings === 'string') settings = JSON.parse(settings.replace(/"/g,'"'));
|
if (typeof settings === 'string') settings = JSON.parse(settings.replace(/"/g,'"'));
|
||||||
$('#cron-missing-action').val(settings.missing_action);
|
$('#cron-missing-action').val(settings.missing_action);
|
||||||
$('#cron-batch-name').val(settings.import_batch_name);
|
$('#cron-batch-name').val(settings.import_batch_name);
|
||||||
|
$('#cron-conflict-action').val(settings.supplier_conflict_action || 'none');
|
||||||
|
$('#cron-conflict-scope').val(settings.supplier_conflict_scope || 'current');
|
||||||
|
$('#cron-conflict-batches').val(settings.supplier_conflict_batches || '');
|
||||||
$('#cron-log-mode').val(settings.log_mode);
|
$('#cron-log-mode').val(settings.log_mode);
|
||||||
$('#cron-import-format').val(settings.format || 'auto');
|
$('#cron-import-format').val(settings.format || 'auto');
|
||||||
$('#cron-inverse-special').prop('checked', settings.inverse_special === 1);
|
$('#cron-inverse-special').prop('checked', settings.inverse_special === 1);
|
||||||
|
|
@ -5282,6 +5300,9 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
settingsData.missing_action = $('#cron-missing-action').val();
|
settingsData.missing_action = $('#cron-missing-action').val();
|
||||||
settingsData.import_batch_name = $('#cron-batch-name').val();
|
settingsData.import_batch_name = $('#cron-batch-name').val();
|
||||||
|
settingsData.supplier_conflict_action = $('#cron-conflict-action').val() || 'none';
|
||||||
|
settingsData.supplier_conflict_scope = $('#cron-conflict-scope').val() || 'current';
|
||||||
|
settingsData.supplier_conflict_batches = $('#cron-conflict-batches').val() || '';
|
||||||
settingsData.cron_alert_threshold = $('#cron-alert-threshold').val();
|
settingsData.cron_alert_threshold = $('#cron-alert-threshold').val();
|
||||||
settingsData.log_mode = $('#cron-log-mode').val();
|
settingsData.log_mode = $('#cron-log-mode').val();
|
||||||
settingsData.inverse_special = $('#cron-inverse-special').is(':checked') ? 1 : 0;
|
settingsData.inverse_special = $('#cron-inverse-special').is(':checked') ? 1 : 0;
|
||||||
|
|
@ -5646,6 +5667,9 @@ $(document).ready(function() {
|
||||||
if (json.settings.misc) {
|
if (json.settings.misc) {
|
||||||
if (json.settings.misc.missing_action) $('#input-import-missing').val(json.settings.misc.missing_action);
|
if (json.settings.misc.missing_action) $('#input-import-missing').val(json.settings.misc.missing_action);
|
||||||
if (json.settings.misc.import_batch) $('input[name="import_batch_name"]').val(json.settings.misc.import_batch);
|
if (json.settings.misc.import_batch) $('input[name="import_batch_name"]').val(json.settings.misc.import_batch);
|
||||||
|
if (json.settings.misc.supplier_conflict_action) $('#input-supplier-conflict-action').val(json.settings.misc.supplier_conflict_action);
|
||||||
|
if (json.settings.misc.supplier_conflict_scope) $('#input-supplier-conflict-scope').val(json.settings.misc.supplier_conflict_scope);
|
||||||
|
if (json.settings.misc.supplier_conflict_batches) $('#input-supplier-conflict-batches').val(json.settings.misc.supplier_conflict_batches);
|
||||||
if (json.settings.misc.log_mode) $('select[name="module_easy_import_nat_log_mode"]').val(json.settings.misc.log_mode);
|
if (json.settings.misc.log_mode) $('select[name="module_easy_import_nat_log_mode"]').val(json.settings.misc.log_mode);
|
||||||
$('#input-import-inverse').prop('checked', json.settings.misc.inverse_special === '1');
|
$('#input-import-inverse').prop('checked', json.settings.misc.inverse_special === '1');
|
||||||
$('#input-import-option-sync').prop('checked', json.settings.misc.option_quantity_sync === '1');
|
$('#input-import-option-sync').prop('checked', json.settings.misc.option_quantity_sync === '1');
|
||||||
|
|
|
||||||
|
|
@ -858,7 +858,69 @@ class EasyImportNatCron extends \Opencart\System\Engine\Controller {
|
||||||
|
|
||||||
foreach ($product_ids as $product_id) {
|
foreach ($product_ids as $product_id) {
|
||||||
$current_data = $model->getProducts(array('filter_identifier' => $product_id));
|
$current_data = $model->getProducts(array('filter_identifier' => $product_id));
|
||||||
$p = !empty($current_data) ? $current_data[0] : array('price' => '0.00', 'quantity' => 0, 'status' => 1, 'model' => '', 'sku' => '', 'name' => '');
|
$p = !empty($current_data) ? $current_data[0] : array('price' => '0.00', 'quantity' => 0, 'status' => 1, 'model' => '', 'sku' => '', 'name' => '', 'import_batch' => '', 'nat_sources' => '');
|
||||||
|
|
||||||
|
// Supplier Conflict / Overwrite Protection
|
||||||
|
$supplier_conflict_action = isset($settings['supplier_conflict_action']) ? (string)$settings['supplier_conflict_action'] : 'none';
|
||||||
|
$supplier_conflict_scope = isset($settings['supplier_conflict_scope']) ? (string)$settings['supplier_conflict_scope'] : 'current';
|
||||||
|
$supplier_conflict_batches = isset($settings['supplier_conflict_batches']) ? $settings['supplier_conflict_batches'] : array();
|
||||||
|
if (is_string($supplier_conflict_batches)) {
|
||||||
|
$supplier_conflict_batches = preg_split('/[,;\s]+/', $supplier_conflict_batches);
|
||||||
|
}
|
||||||
|
if (!is_array($supplier_conflict_batches)) {
|
||||||
|
$supplier_conflict_batches = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($supplier_conflict_action !== 'none' && !empty($supplier_conflict_batches)) {
|
||||||
|
$has_conflict = false;
|
||||||
|
$matched_batch = '';
|
||||||
|
|
||||||
|
if ($supplier_conflict_scope === 'historical') {
|
||||||
|
$prod_sources = isset($p['nat_sources']) ? array_filter(explode(';', trim($p['nat_sources'], ';'))) : array();
|
||||||
|
foreach ($supplier_conflict_batches as $cb) {
|
||||||
|
$clean_cb = trim((string)$cb);
|
||||||
|
if ($clean_cb !== '' && in_array($clean_cb, $prod_sources)) {
|
||||||
|
$has_conflict = true;
|
||||||
|
$matched_batch = $clean_cb;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$current_batch = isset($p['import_batch']) ? trim((string)$p['import_batch']) : '';
|
||||||
|
if ($current_batch !== '') {
|
||||||
|
foreach ($supplier_conflict_batches as $cb) {
|
||||||
|
$clean_cb = trim((string)$cb);
|
||||||
|
if ($clean_cb !== '' && $clean_cb === $current_batch) {
|
||||||
|
$has_conflict = true;
|
||||||
|
$matched_batch = $clean_cb;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($has_conflict) {
|
||||||
|
if ($supplier_conflict_action === 'skip_all') {
|
||||||
|
if ($log_mode !== 'off') {
|
||||||
|
$log_entries[] = "ID:{$product_id} ({$ident_value}): SKIPPED: Protected from overwrite (supplier: {$matched_batch})";
|
||||||
|
}
|
||||||
|
$totalSkipped++;
|
||||||
|
continue;
|
||||||
|
} elseif ($supplier_conflict_action === 'protect_price') {
|
||||||
|
$base_price = null;
|
||||||
|
$raw_special = null;
|
||||||
|
$raw_discount_simple = null;
|
||||||
|
if ($log_mode === 'full') {
|
||||||
|
$log_entries[] = "ID:{$product_id} ({$ident_value}): Price Protected: skipped price/special overwrite (supplier: {$matched_batch})";
|
||||||
|
}
|
||||||
|
} elseif ($supplier_conflict_action === 'protect_stock') {
|
||||||
|
$quantity = null;
|
||||||
|
if ($log_mode === 'full') {
|
||||||
|
$log_entries[] = "ID:{$product_id} ({$ident_value}): Stock Protected: skipped quantity overwrite (supplier: {$matched_batch})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$price = $base_price;
|
$price = $base_price;
|
||||||
|
|
||||||
|
|
@ -911,7 +973,9 @@ class EasyImportNatCron extends \Opencart\System\Engine\Controller {
|
||||||
if ($log_mode === 'full') $log_entries[] = "ID:{$product_id} ({$ident_value}): No changes";
|
if ($log_mode === 'full') $log_entries[] = "ID:{$product_id} ({$ident_value}): No changes";
|
||||||
}
|
}
|
||||||
|
|
||||||
$model->updateProductBasic($product_id, $final_price, $final_quantity, $final_status, $batch_tag);
|
$new_sources = $model->formatNewProductSources($batch_tag, isset($p['nat_sources']) ? $p['nat_sources'] : '');
|
||||||
|
$model->updateProductBasic($product_id, $final_price, $final_quantity, $final_status, $batch_tag, $new_sources);
|
||||||
|
$model->recordProductHistoryDelta($product_id, $batch_tag, (int)$profile['profile_id'], $final_price, $raw_special, $final_quantity, $p, null, $final_status);
|
||||||
|
|
||||||
if ($name_val !== null) {
|
if ($name_val !== null) {
|
||||||
$model->updateCustomField($product_id, DB_PREFIX . 'product_description', 'name', $name_val, $cron_language_id);
|
$model->updateCustomField($product_id, DB_PREFIX . 'product_description', 'name', $name_val, $cron_language_id);
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue