Тексты товаров в разные ячейки и 404 страница
This commit is contained in:
@@ -23,11 +23,6 @@ class ControllerCatalogProduct extends Controller {
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
|
||||
$this->request->post['product_description'] = array_map(function($description){
|
||||
|
||||
$description['description'] = implode("__NEWLINE__", $description['description']);
|
||||
return $description;
|
||||
}, $this->request->post['product_description']);
|
||||
$this->model_catalog_product->addProduct($this->request->post);
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
@@ -111,11 +106,6 @@ $this->request->post['product_description'] = array_map(function($description){
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
|
||||
$this->request->post['product_description'] = array_map(function($description){
|
||||
|
||||
$description['description'] = implode("__NEWLINE__", $description['description']);
|
||||
return $description;
|
||||
}, $this->request->post['product_description']);
|
||||
$this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
@@ -1,570 +0,0 @@
|
||||
<?php
|
||||
class ControllerExtensionExportImport extends Controller {
|
||||
private $error = array();
|
||||
private $ssl = 'SSL';
|
||||
|
||||
public function __construct( $registry ) {
|
||||
parent::__construct( $registry );
|
||||
$this->ssl = true;
|
||||
}
|
||||
|
||||
|
||||
public function index() {
|
||||
$this->load->language('extension/export_import');
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
$this->load->model('extension/export_import');
|
||||
$this->getForm();
|
||||
}
|
||||
|
||||
|
||||
public function upload() {
|
||||
$this->load->language('extension/export_import');
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
$this->load->model('extension/export_import');
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validateUploadForm())) {
|
||||
if ((isset( $this->request->files['upload'] )) && (is_uploaded_file($this->request->files['upload']['tmp_name']))) {
|
||||
$file = $this->request->files['upload']['tmp_name'];
|
||||
$incremental = ($this->request->post['incremental']) ? true : false;
|
||||
if ($this->model_extension_export_import->upload($file,$this->request->post['incremental'])==true) {
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
$this->response->redirect($this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], $this->ssl));
|
||||
}
|
||||
else {
|
||||
$this->session->data['warning'] = $this->language->get('error_upload');
|
||||
$href = $this->url->link( 'tool/log', 'user_token='.$this->session->data['user_token'], $this->ssl );
|
||||
$this->session->data['warning'] .= "<br />\n".str_replace('%1',$href,$this->language->get( 'text_log_details_3_x' ));
|
||||
$this->response->redirect($this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], $this->ssl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->getForm();
|
||||
}
|
||||
|
||||
|
||||
protected function return_bytes($val)
|
||||
{
|
||||
$val = trim($val);
|
||||
|
||||
switch (strtolower(substr($val, -1)))
|
||||
{
|
||||
case 'm': $val = (int)substr($val, 0, -1) * 1048576; break;
|
||||
case 'k': $val = (int)substr($val, 0, -1) * 1024; break;
|
||||
case 'g': $val = (int)substr($val, 0, -1) * 1073741824; break;
|
||||
case 'b':
|
||||
switch (strtolower(substr($val, -2, 1)))
|
||||
{
|
||||
case 'm': $val = (int)substr($val, 0, -2) * 1048576; break;
|
||||
case 'k': $val = (int)substr($val, 0, -2) * 1024; break;
|
||||
case 'g': $val = (int)substr($val, 0, -2) * 1073741824; break;
|
||||
default : break;
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
||||
public function download() {
|
||||
$this->load->language( 'extension/export_import' );
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
$this->load->model( 'extension/export_import' );
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateDownloadForm()) {
|
||||
$export_type = $this->request->post['export_type'];
|
||||
switch ($export_type) {
|
||||
case 'c':
|
||||
case 'p':
|
||||
case 'u':
|
||||
$min = null;
|
||||
if (isset( $this->request->post['min'] ) && ($this->request->post['min']!='')) {
|
||||
$min = $this->request->post['min'];
|
||||
}
|
||||
$max = null;
|
||||
if (isset( $this->request->post['max'] ) && ($this->request->post['max']!='')) {
|
||||
$max = $this->request->post['max'];
|
||||
}
|
||||
if (($min==null) || ($max==null)) {
|
||||
$this->model_extension_export_import->download($export_type, null, null, null, null);
|
||||
} else if ($this->request->post['range_type'] == 'id') {
|
||||
$this->model_extension_export_import->download($export_type, null, null, $min, $max);
|
||||
} else {
|
||||
$this->model_extension_export_import->download($export_type, $min*($max-1-1), $min, null, null);
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
$this->model_extension_export_import->download('o', null, null, null, null);
|
||||
break;
|
||||
case 'a':
|
||||
$this->model_extension_export_import->download('a', null, null, null, null);
|
||||
break;
|
||||
case 'f':
|
||||
if ($this->model_extension_export_import->existFilter()) {
|
||||
$this->model_extension_export_import->download('f', null, null, null, null);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$this->response->redirect( $this->url->link( 'extension/export_import', 'user_token='.$this->request->get['user_token'], $this->ssl) );
|
||||
}
|
||||
|
||||
$this->getForm();
|
||||
}
|
||||
|
||||
|
||||
public function settings() {
|
||||
$this->load->language('extension/export_import');
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
$this->load->model('extension/export_import');
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validateSettingsForm())) {
|
||||
$this->load->model('setting/setting');
|
||||
$this->model_setting_setting->editSetting('export_import', $this->request->post);
|
||||
$this->session->data['success'] = $this->language->get('text_success_settings');
|
||||
$this->response->redirect($this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], $this->ssl));
|
||||
}
|
||||
$this->getForm();
|
||||
}
|
||||
|
||||
|
||||
protected function getForm() {
|
||||
$data = array();
|
||||
$data['heading_title'] = $this->language->get('heading_title');
|
||||
|
||||
$data['exist_filter'] = $this->model_extension_export_import->existFilter();
|
||||
|
||||
$data['text_export_type_category'] = ($data['exist_filter']) ? $this->language->get('text_export_type_category') : $this->language->get('text_export_type_category_old');
|
||||
$data['text_export_type_product'] = ($data['exist_filter']) ? $this->language->get('text_export_type_product') : $this->language->get('text_export_type_product_old');
|
||||
$data['text_export_type_poa'] = $this->language->get('text_export_type_poa');
|
||||
$data['text_export_type_option'] = $this->language->get('text_export_type_option');
|
||||
$data['text_export_type_attribute'] = $this->language->get('text_export_type_attribute');
|
||||
$data['text_export_type_filter'] = $this->language->get('text_export_type_filter');
|
||||
$data['text_export_type_customer'] = $this->language->get('text_export_type_customer');
|
||||
$data['text_yes'] = $this->language->get('text_yes');
|
||||
$data['text_no'] = $this->language->get('text_no');
|
||||
$data['text_loading_notifications'] = $this->language->get( 'text_loading_notifications' );
|
||||
$data['text_retry'] = $this->language->get('text_retry');
|
||||
$data['text_license'] = $this->language->get('text_license');
|
||||
|
||||
$data['entry_export'] = $this->language->get( 'entry_export' );
|
||||
$data['entry_import'] = $this->language->get( 'entry_import' );
|
||||
$data['entry_export_type'] = $this->language->get( 'entry_export_type' );
|
||||
$data['entry_range_type'] = $this->language->get( 'entry_range_type' );
|
||||
$data['entry_category_filter'] = $this->language->get( 'entry_category_filter' );
|
||||
$data['entry_category'] = $this->language->get( 'entry_category' );
|
||||
$data['entry_start_id'] = $this->language->get( 'entry_start_id' );
|
||||
$data['entry_start_index'] = $this->language->get( 'entry_start_index' );
|
||||
$data['entry_end_id'] = $this->language->get( 'entry_end_id' );
|
||||
$data['entry_end_index'] = $this->language->get( 'entry_end_index' );
|
||||
$data['entry_incremental'] = $this->language->get( 'entry_incremental' );
|
||||
$data['entry_upload'] = $this->language->get( 'entry_upload' );
|
||||
$data['entry_settings_use_option_id'] = $this->language->get( 'entry_settings_use_option_id' );
|
||||
$data['entry_settings_use_option_value_id'] = $this->language->get( 'entry_settings_use_option_value_id' );
|
||||
$data['entry_settings_use_attribute_group_id'] = $this->language->get( 'entry_settings_use_attribute_group_id' );
|
||||
$data['entry_settings_use_attribute_id'] = $this->language->get( 'entry_settings_use_attribute_id' );
|
||||
$data['entry_settings_use_filter_group_id'] = $this->language->get( 'entry_settings_use_filter_group_id' );
|
||||
$data['entry_settings_use_filter_id'] = $this->language->get( 'entry_settings_use_filter_id' );
|
||||
$data['entry_version'] = $this->language->get('entry_version');
|
||||
$data['entry_oc_version'] = $this->language->get('entry_oc_version');
|
||||
$data['entry_license'] = $this->language->get('entry_license');
|
||||
|
||||
$data['tab_export'] = $this->language->get( 'tab_export' );
|
||||
$data['tab_import'] = $this->language->get( 'tab_import' );
|
||||
$data['tab_settings'] = $this->language->get( 'tab_settings' );
|
||||
$data['tab_support'] = $this->language->get( 'tab_support' );
|
||||
|
||||
$data['button_export'] = $this->language->get( 'button_export' );
|
||||
$data['button_import'] = $this->language->get( 'button_import' );
|
||||
$data['button_settings'] = $this->language->get( 'button_settings' );
|
||||
$data['button_export_id'] = $this->language->get( 'button_export_id' );
|
||||
$data['button_export_page'] = $this->language->get( 'button_export_page' );
|
||||
|
||||
$data['help_range_type'] = $this->language->get( 'help_range_type' );
|
||||
$data['help_category_filter'] = $this->language->get( 'help_category_filter' );
|
||||
$data['help_incremental_yes'] = $this->language->get( 'help_incremental_yes' );
|
||||
$data['help_incremental_no'] = $this->language->get( 'help_incremental_no' );
|
||||
$data['help_import'] = ($data['exist_filter']) ? $this->language->get( 'help_import' ) : $this->language->get( 'help_import_old' );
|
||||
$data['help_format'] = $this->language->get( 'help_format' );
|
||||
|
||||
$data['error_select_file'] = $this->language->get('error_select_file');
|
||||
$data['error_post_max_size'] = str_replace( '%1', ini_get('post_max_size'), $this->language->get('error_post_max_size') );
|
||||
$data['error_upload_max_filesize'] = str_replace( '%1', ini_get('upload_max_filesize'), $this->language->get('error_upload_max_filesize') );
|
||||
$data['error_id_no_data'] = $this->language->get('error_id_no_data');
|
||||
$data['error_page_no_data'] = $this->language->get('error_page_no_data');
|
||||
$data['error_param_not_number'] = $this->language->get('error_param_not_number');
|
||||
$data['error_notifications'] = $this->language->get('error_notifications');
|
||||
$data['error_no_news'] = $this->language->get('error_no_news');
|
||||
$data['error_batch_number'] = $this->language->get('error_batch_number');
|
||||
$data['error_min_item_id'] = $this->language->get('error_min_item_id');
|
||||
|
||||
if (!empty($this->session->data['export_import_error']['errstr'])) {
|
||||
$this->error['warning'] = $this->session->data['export_import_error']['errstr'];
|
||||
} else if (isset($this->session->data['warning'])) {
|
||||
$this->error['warning'] = $this->session->data['warning'];
|
||||
}
|
||||
|
||||
if (isset($this->error['warning'])) {
|
||||
$data['error_warning'] = $this->error['warning'];
|
||||
if (!empty($this->session->data['export_import_nochange'])) {
|
||||
$data['error_warning'] .= "<br />\n".$this->language->get( 'text_nochange' );
|
||||
}
|
||||
} else {
|
||||
$data['error_warning'] = '';
|
||||
}
|
||||
|
||||
unset($this->session->data['warning']);
|
||||
unset($this->session->data['export_import_error']);
|
||||
unset($this->session->data['export_import_nochange']);
|
||||
|
||||
if (isset($this->session->data['success'])) {
|
||||
$data['success'] = $this->session->data['success'];
|
||||
|
||||
unset($this->session->data['success']);
|
||||
} else {
|
||||
$data['success'] = '';
|
||||
}
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], $this->ssl)
|
||||
);
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('extension/export_import', 'user_token=' . $this->session->data['user_token'], $this->ssl)
|
||||
);
|
||||
|
||||
$data['back'] = $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], $this->ssl);
|
||||
$data['button_back'] = $this->language->get( 'button_back' );
|
||||
$data['import'] = $this->url->link('extension/export_import/upload', 'user_token=' . $this->session->data['user_token'], $this->ssl);
|
||||
$data['export'] = $this->url->link('extension/export_import/download', 'user_token=' . $this->session->data['user_token'], $this->ssl);
|
||||
$data['settings'] = $this->url->link('extension/export_import/settings', 'user_token=' . $this->session->data['user_token'], $this->ssl);
|
||||
$data['post_max_size'] = $this->return_bytes( ini_get('post_max_size') );
|
||||
$data['upload_max_filesize'] = $this->return_bytes( ini_get('upload_max_filesize') );
|
||||
|
||||
if (isset($this->request->post['export_type'])) {
|
||||
$data['export_type'] = $this->request->post['export_type'];
|
||||
} else {
|
||||
$data['export_type'] = 'p';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['range_type'])) {
|
||||
$data['range_type'] = $this->request->post['range_type'];
|
||||
} else {
|
||||
$data['range_type'] = 'id';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['min'])) {
|
||||
$data['min'] = $this->request->post['min'];
|
||||
} else {
|
||||
$data['min'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['max'])) {
|
||||
$data['max'] = $this->request->post['max'];
|
||||
} else {
|
||||
$data['max'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['incremental'])) {
|
||||
$data['incremental'] = $this->request->post['incremental'];
|
||||
} else {
|
||||
$data['incremental'] = '1';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['export_import_settings_use_option_id'])) {
|
||||
$data['settings_use_option_id'] = $this->request->post['export_import_settings_use_option_id'];
|
||||
} else if ($this->config->get( 'export_import_settings_use_option_id' )) {
|
||||
$data['settings_use_option_id'] = '1';
|
||||
} else {
|
||||
$data['settings_use_option_id'] = '0';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['export_import_settings_use_option_value_id'])) {
|
||||
$data['settings_use_option_value_id'] = $this->request->post['export_import_settings_use_option_value_id'];
|
||||
} else if ($this->config->get( 'export_import_settings_use_option_value_id' )) {
|
||||
$data['settings_use_option_value_id'] = '1';
|
||||
} else {
|
||||
$data['settings_use_option_value_id'] = '0';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['export_import_settings_use_attribute_group_id'])) {
|
||||
$data['settings_use_attribute_group_id'] = $this->request->post['export_import_settings_use_attribute_group_id'];
|
||||
} else if ($this->config->get( 'export_import_settings_use_attribute_group_id' )) {
|
||||
$data['settings_use_attribute_group_id'] = '1';
|
||||
} else {
|
||||
$data['settings_use_attribute_group_id'] = '0';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['export_import_settings_use_attribute_id'])) {
|
||||
$data['settings_use_attribute_id'] = $this->request->post['export_import_settings_use_attribute_id'];
|
||||
} else if ($this->config->get( 'export_import_settings_use_attribute_id' )) {
|
||||
$data['settings_use_attribute_id'] = '1';
|
||||
} else {
|
||||
$data['settings_use_attribute_id'] = '0';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['export_import_settings_use_filter_group_id'])) {
|
||||
$data['settings_use_filter_group_id'] = $this->request->post['export_import_settings_use_filter_group_id'];
|
||||
} else if ($this->config->get( 'export_import_settings_use_filter_group_id' )) {
|
||||
$data['settings_use_filter_group_id'] = '1';
|
||||
} else {
|
||||
$data['settings_use_filter_group_id'] = '0';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['export_import_settings_use_filter_id'])) {
|
||||
$data['settings_use_filter_id'] = $this->request->post['export_import_settings_use_filter_id'];
|
||||
} else if ($this->config->get( 'export_import_settings_use_filter_id' )) {
|
||||
$data['settings_use_filter_id'] = '1';
|
||||
} else {
|
||||
$data['settings_use_filter_id'] = '0';
|
||||
}
|
||||
|
||||
$data['categories'] = array();
|
||||
$data['manufacturers'] = array();
|
||||
|
||||
$min_product_id = $this->model_extension_export_import->getMinProductId();
|
||||
$max_product_id = $this->model_extension_export_import->getMaxProductId();
|
||||
$count_product = $this->model_extension_export_import->getCountProduct();
|
||||
$min_category_id = $this->model_extension_export_import->getMinCategoryId();
|
||||
$max_category_id = $this->model_extension_export_import->getMaxCategoryId();
|
||||
$count_category = $this->model_extension_export_import->getCountCategory();
|
||||
$min_customer_id = $this->model_extension_export_import->getMinCustomerId();
|
||||
$max_customer_id = $this->model_extension_export_import->getMaxCustomerId();
|
||||
$count_customer = $this->model_extension_export_import->getCountCustomer();
|
||||
|
||||
$data['text_welcome'] = str_replace('%1',$this->model_extension_export_import->getVersion(),$this->language->get('text_welcome'));
|
||||
$data['text_used_category_ids'] = $this->language->get('text_used_category_ids');
|
||||
$data['text_used_category_ids'] = str_replace('%1',$min_category_id,$data['text_used_category_ids']);
|
||||
$data['text_used_category_ids'] = str_replace('%2',$max_category_id,$data['text_used_category_ids']);
|
||||
$data['text_used_product_ids'] = $this->language->get('text_used_product_ids');
|
||||
$data['text_used_product_ids'] = str_replace('%1',$min_product_id,$data['text_used_product_ids']);
|
||||
$data['text_used_product_ids'] = str_replace('%2',$max_product_id,$data['text_used_product_ids']);
|
||||
|
||||
$data['version_export_import'] = $this->model_extension_export_import->getVersion();
|
||||
$data['version_opencart'] = VERSION;
|
||||
|
||||
$data['min_product_id'] = $min_product_id;
|
||||
$data['max_product_id'] = $max_product_id;
|
||||
$data['count_product'] = $count_product;
|
||||
$data['min_category_id'] = $min_category_id;
|
||||
$data['max_category_id'] = $max_category_id;
|
||||
$data['count_category'] = $count_category;
|
||||
$data['min_customer_id'] = $min_customer_id;
|
||||
$data['max_customer_id'] = $max_customer_id;
|
||||
$data['count_customer'] = $count_customer;
|
||||
|
||||
$data['user_token'] = $this->session->data['user_token'];
|
||||
|
||||
$this->document->addStyle('view/stylesheet/export_import.css');
|
||||
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
|
||||
$this->response->setOutput($this->load->view( 'extension/export_import', $data));
|
||||
}
|
||||
|
||||
|
||||
protected function validateDownloadForm() {
|
||||
if (!$this->user->hasPermission('access', 'extension/export_import')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->config->get( 'export_import_settings_use_option_id' )) {
|
||||
$option_names = $this->model_extension_export_import->getOptionNameCounts();
|
||||
foreach ($option_names as $option_name) {
|
||||
if ($option_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $option_name['name'], $this->language->get( 'error_option_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->config->get( 'export_import_settings_use_option_value_id' )) {
|
||||
$option_value_names = $this->model_extension_export_import->getOptionValueNameCounts();
|
||||
foreach ($option_value_names as $option_value_name) {
|
||||
if ($option_value_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $option_value_name['name'], $this->language->get( 'error_option_value_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->config->get( 'export_import_settings_use_attribute_group_id' )) {
|
||||
$attribute_group_names = $this->model_extension_export_import->getAttributeGroupNameCounts();
|
||||
foreach ($attribute_group_names as $attribute_group_name) {
|
||||
if ($attribute_group_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $attribute_group_name['name'], $this->language->get( 'error_attribute_group_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->config->get( 'export_import_settings_use_attribute_id' )) {
|
||||
$attribute_names = $this->model_extension_export_import->getAttributeNameCounts();
|
||||
foreach ($attribute_names as $attribute_name) {
|
||||
if ($attribute_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $attribute_name['name'], $this->language->get( 'error_attribute_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->config->get( 'export_import_settings_use_filter_group_id' )) {
|
||||
$filter_group_names = $this->model_extension_export_import->getFilterGroupNameCounts();
|
||||
foreach ($filter_group_names as $filter_group_name) {
|
||||
if ($filter_group_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $filter_group_name['name'], $this->language->get( 'error_filter_group_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->config->get( 'export_import_settings_use_filter_id' )) {
|
||||
$filter_names = $this->model_extension_export_import->getFilterNameCounts();
|
||||
foreach ($filter_names as $filter_name) {
|
||||
if ($filter_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $filter_name['name'], $this->language->get( 'error_filter_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected function validateUploadForm() {
|
||||
if (!$this->user->hasPermission('modify', 'extension/export_import')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
} else if (!isset( $this->request->post['incremental'] )) {
|
||||
$this->error['warning'] = $this->language->get( 'error_incremental' );
|
||||
} else if ($this->request->post['incremental'] != '0') {
|
||||
if ($this->request->post['incremental'] != '1') {
|
||||
$this->error['warning'] = $this->language->get( 'error_incremental' );
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($this->request->files['upload']['name'])) {
|
||||
if (isset($this->error['warning'])) {
|
||||
$this->error['warning'] .= "<br /\n" . $this->language->get( 'error_upload_name' );
|
||||
} else {
|
||||
$this->error['warning'] = $this->language->get( 'error_upload_name' );
|
||||
}
|
||||
} else {
|
||||
$ext = strtolower(pathinfo($this->request->files['upload']['name'], PATHINFO_EXTENSION));
|
||||
if (($ext != 'xls') && ($ext != 'xlsx') && ($ext != 'ods')) {
|
||||
if (isset($this->error['warning'])) {
|
||||
$this->error['warning'] .= "<br /\n" . $this->language->get( 'error_upload_ext' );
|
||||
} else {
|
||||
$this->error['warning'] = $this->language->get( 'error_upload_ext' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->error) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function validateSettingsForm() {
|
||||
if (!$this->user->hasPermission('access', 'extension/export_import')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($this->request->post['export_import_settings_use_option_id'])) {
|
||||
$option_names = $this->model_extension_export_import->getOptionNameCounts();
|
||||
foreach ($option_names as $option_name) {
|
||||
if ($option_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $option_name['name'], $this->language->get( 'error_option_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->request->post['export_import_settings_use_option_value_id'])) {
|
||||
$option_value_names = $this->model_extension_export_import->getOptionValueNameCounts();
|
||||
foreach ($option_value_names as $option_value_name) {
|
||||
if ($option_value_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $option_value_name['name'], $this->language->get( 'error_option_value_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->request->post['export_import_settings_use_attribute_group_id'])) {
|
||||
$attribute_group_names = $this->model_extension_export_import->getAttributeGroupNameCounts();
|
||||
foreach ($attribute_group_names as $attribute_group_name) {
|
||||
if ($attribute_group_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $attribute_group_name['name'], $this->language->get( 'error_attribute_group_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->request->post['export_import_settings_use_attribute_id'])) {
|
||||
$attribute_names = $this->model_extension_export_import->getAttributeNameCounts();
|
||||
foreach ($attribute_names as $attribute_name) {
|
||||
if ($attribute_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $attribute_name['name'], $this->language->get( 'error_attribute_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->request->post['export_import_settings_use_filter_group_id'])) {
|
||||
$filter_group_names = $this->model_extension_export_import->getFilterGroupNameCounts();
|
||||
foreach ($filter_group_names as $filter_group_name) {
|
||||
if ($filter_group_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $filter_group_name['name'], $this->language->get( 'error_filter_group_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->request->post['export_import_settings_use_filter_id'])) {
|
||||
$filter_names = $this->model_extension_export_import->getFilterNameCounts();
|
||||
foreach ($filter_names as $filter_name) {
|
||||
if ($filter_name['count'] > 1) {
|
||||
$this->error['warning'] = str_replace( '%1', $filter_name['name'], $this->language->get( 'error_filter_name' ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function getNotifications() {
|
||||
sleep(1); // give the data some "feel" that its not in our system
|
||||
$this->load->model('extension/export_import');
|
||||
$this->load->language( 'extension/export_import' );
|
||||
$response = $this->model_extension_export_import->getNotifications();
|
||||
$json = array();
|
||||
if ($response===false) {
|
||||
$json['message'] = '';
|
||||
$json['error'] = $this->language->get( 'error_notifications' );
|
||||
} else {
|
||||
$json['message'] = $response;
|
||||
$json['error'] = '';
|
||||
}
|
||||
$this->response->setOutput(json_encode($json));
|
||||
}
|
||||
|
||||
|
||||
public function getCountProduct() {
|
||||
$this->load->model('extension/export_import');
|
||||
$count = $this->model_extension_export_import->getCountProduct();
|
||||
$json = array( 'count'=>$count );
|
||||
$this->response->addHeader('Content-Type: application/json');
|
||||
$this->response->setOutput(json_encode($json));
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -37,6 +37,10 @@ $_['column_action'] = 'Действие';
|
||||
// Entry
|
||||
$_['entry_name'] = 'Название товара';
|
||||
$_['entry_description'] = 'Описание';
|
||||
$_['entry_description_first_rental'] = 'Первый прокат';
|
||||
$_['entry_description_second_rental'] = 'Второй прокат';
|
||||
$_['entry_description_purchase'] = 'Покупка';
|
||||
$_['entry_description_terms'] = 'Условия';
|
||||
$_['entry_description_mini'] = 'Краткое Описание:';
|
||||
$_['entry_meta_title'] = 'Мета-тег Title';
|
||||
$_['entry_meta_h1'] = 'HTML-тег H1';
|
||||
@@ -136,4 +140,4 @@ $_['error_meta_title'] = 'Мета-тег Title должен содерж
|
||||
$_['error_meta_h1'] = 'HTML-тег H1 должен содержать от 0 до 255 символов!';
|
||||
$_['error_model'] = 'Код Товара товара должна содержать от 3 до 64 символов!';
|
||||
$_['error_keyword'] = 'SEO URL уже используется!';
|
||||
$_['error_tab'] = 'Необходимо название таба!';
|
||||
$_['error_tab'] = 'Необходимо название таба!';
|
||||
|
||||
@@ -13,7 +13,7 @@ class ModelCatalogProduct extends Model {
|
||||
}
|
||||
|
||||
foreach ($data['product_description'] as $language_id => $value) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', description_first_rental = '" . $this->db->escape($value['description_first_rental']) . "', description_second_rental = '" . $this->db->escape($value['description_second_rental']) . "', description_purchase = '" . $this->db->escape($value['description_purchase']) . "', description_terms = '" . $this->db->escape($value['description_terms']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
|
||||
}
|
||||
|
||||
if (isset($data['product_store'])) {
|
||||
@@ -170,7 +170,7 @@ class ModelCatalogProduct extends Model {
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");
|
||||
|
||||
foreach ($data['product_description'] as $language_id => $value) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', description_first_rental = '" . $this->db->escape($value['description_first_rental']) . "', description_second_rental = '" . $this->db->escape($value['description_second_rental']) . "', description_purchase = '" . $this->db->escape($value['description_purchase']) . "', description_terms = '" . $this->db->escape($value['description_terms']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
|
||||
}
|
||||
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_store WHERE product_id = '" . (int)$product_id . "'");
|
||||
@@ -558,6 +558,10 @@ class ModelCatalogProduct extends Model {
|
||||
$product_description_data[$result['language_id']] = array(
|
||||
'name' => $result['name'],
|
||||
'description' => $result['description'],
|
||||
'description_first_rental' => $result['description_first_rental'],
|
||||
'description_second_rental' => $result['description_second_rental'],
|
||||
'description_purchase' => $result['description_purchase'],
|
||||
'description_terms' => $result['description_terms'],
|
||||
'meta_title' => $result['meta_title'],
|
||||
'meta_h1' => $result['meta_h1'],
|
||||
'meta_description' => $result['meta_description'],
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -129,7 +129,7 @@ class ModelLocalisationLanguage extends Model {
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_description WHERE language_id = '" . (int)$this->config->get('config_language_id') . "'");
|
||||
|
||||
foreach ($query->rows as $product) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product['product_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($product['name']) . "', description = '" . $this->db->escape($product['description']) . "', tag = '" . $this->db->escape($product['tag']) . "', meta_title = '" . $this->db->escape($product['meta_title']) . "', meta_description = '" . $this->db->escape($product['meta_description']) . "', meta_keyword = '" . $this->db->escape($product['meta_keyword']) . "'");
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product['product_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($product['name']) . "', description = '" . $this->db->escape($product['description']) . "', description_first_rental = '" . $this->db->escape($product['description_first_rental']) . "', description_second_rental = '" . $this->db->escape($product['description_second_rental']) . "', description_purchase = '" . $this->db->escape($product['description_purchase']) . "', description_terms = '" . $this->db->escape($product['description_terms']) . "', tag = '" . $this->db->escape($product['tag']) . "', meta_title = '" . $this->db->escape($product['meta_title']) . "', meta_description = '" . $this->db->escape($product['meta_description']) . "', meta_keyword = '" . $this->db->escape($product['meta_keyword']) . "'");
|
||||
}
|
||||
|
||||
$this->cache->delete('product');
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
.tab-pane form {
|
||||
color: #000000;
|
||||
}
|
||||
.tab-pane form b {
|
||||
color: navy;
|
||||
}
|
||||
span.help {
|
||||
display: block;
|
||||
color:gray;
|
||||
}
|
||||
.fa-info-circle:after {
|
||||
content: "\00A0\00A0";
|
||||
}
|
||||
#export_import_loading {
|
||||
display: inline-block;
|
||||
}
|
||||
@@ -80,29 +80,25 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-description{{ language.language_id }}">{{ entry_description }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="product_description[{{ language.language_id }}][description][]" placeholder="{{ entry_description }}" id="input-description{{ language.language_id }}" data-toggle="summernote" data-lang="{{ summernote }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].description|split('__NEWLINE__')[0] }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
{% for item in range(1,4) %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-description{{ language.language_id }}">
|
||||
{% if item == 1 %}
|
||||
Первый прокат
|
||||
{% elseif item == 2 %}
|
||||
Второй прокат
|
||||
{% elseif item == 3 %}
|
||||
Покупка
|
||||
{% elseif item == 4 %}
|
||||
Условия
|
||||
{% endif %}
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="product_description[{{ language.language_id }}][description][]" placeholder="{{ entry_description }}" id="input-description{{ language.language_id }}" data-toggle="summernote" data-lang="{{ summernote }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].description|split('__NEWLINE__')[item] }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<label class="col-sm-2 control-label" for="input-description{{ language.language_id }}">{{ entry_description }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="product_description[{{ language.language_id }}][description]" placeholder="{{ entry_description }}" id="input-description{{ language.language_id }}" data-toggle="summernote" data-lang="{{ summernote }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].description }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
{% set description_fields = {
|
||||
'description_first_rental': entry_description_first_rental,
|
||||
'description_second_rental': entry_description_second_rental,
|
||||
'description_purchase': entry_description_purchase,
|
||||
'description_terms': entry_description_terms
|
||||
} %}
|
||||
{% for field, label in description_fields %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-{{ field }}{{ language.language_id }}">{{ label }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="product_description[{{ language.language_id }}][{{ field }}]" placeholder="{{ label }}" id="input-{{ field }}{{ language.language_id }}" data-toggle="summernote" data-lang="{{ summernote }}" class="form-control">{{ product_description[language.language_id] ? attribute(product_description[language.language_id], field) }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-tag{{ language.language_id }}"><span data-toggle="tooltip" title="{{ help_tag }}">{{ entry_tag }}</span></label>
|
||||
<div class="col-sm-10">
|
||||
|
||||
@@ -1,619 +0,0 @@
|
||||
{{ header }}{{ column_left }}
|
||||
<div id="content">
|
||||
<div class="page-header">
|
||||
<div class="container-fluid">
|
||||
<div class="pull-right">
|
||||
<a href="{{ back }}" data-toggle="tooltip" title="{{ button_back }}" class="btn btn-default"><i class="fa fa-reply"></i></a>
|
||||
</div>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb['href'] }}">{{ breadcrumb['text'] }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
{% if (error_warning) %}
|
||||
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if (success) %}
|
||||
<div class="alert alert-success"><i class="fa fa-check-circle"></i> {{ success }}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if ((not error_warning) and (not success)) %}
|
||||
<div id="export_import_welcome" class="alert alert-info">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{{ text_welcome }}<br /><br />{{ text_used_category_ids}} {{ text_used_product_ids }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#tab-export" data-toggle="tab">{{ tab_export }}</a></li>
|
||||
<li><a href="#tab-import" data-toggle="tab">{{ tab_import }}</a></li>
|
||||
<li><a href="#tab-settings" data-toggle="tab">{{ tab_settings }}</a></li>
|
||||
<li><a href="#tab-support" data-toggle="tab">{{ tab_support }}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane active" id="tab-export">
|
||||
<form action="{{ export }}" method="post" enctype="multipart/form-data" id="export" class="form-horizontal">
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<div class="col-sm-12">{{ entry_export }}</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<div class="col-sm-12">{{ entry_export_type }}
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<label class="radio-inline">
|
||||
{% if (export_type=='c') %}
|
||||
<input type="radio" name="export_type" value="c" checked="checked" />
|
||||
{% else %}
|
||||
<input type="radio" name="export_type" value="c" />
|
||||
{% endif %}
|
||||
{{ text_export_type_category }}
|
||||
</label>
|
||||
<br />
|
||||
<label class="radio-inline">
|
||||
{% if (export_type=='p') %}
|
||||
<input type="radio" name="export_type" value="p" checked="checked" />
|
||||
{% else %}
|
||||
<input type="radio" name="export_type" value="p" />
|
||||
{% endif %}
|
||||
{{ text_export_type_product }}
|
||||
</label>
|
||||
<br />
|
||||
<label class="radio-inline">
|
||||
{% if (export_type=='o') %}
|
||||
<input type="radio" name="export_type" value="o" checked="checked" />
|
||||
{% else %}
|
||||
<input type="radio" name="export_type" value="o" />
|
||||
{% endif %}
|
||||
{{ text_export_type_option }}
|
||||
</label>
|
||||
<br />
|
||||
<label class="radio-inline">
|
||||
{% if (export_type=='a') %}
|
||||
<input type="radio" name="export_type" value="a" checked="checked" />
|
||||
{% else %}
|
||||
<input type="radio" name="export_type" value="a" />
|
||||
{% endif %}
|
||||
{{ text_export_type_attribute }}
|
||||
</label>
|
||||
<br />
|
||||
{% if (exist_filter) %}
|
||||
<label class="radio-inline">
|
||||
{% if (export_type=='f') %}
|
||||
<input type="radio" name="export_type" value="f" checked="checked" />
|
||||
{% else %}
|
||||
<input type="radio" name="export_type" value="f" />
|
||||
{% endif %}
|
||||
{{ text_export_type_filter }}
|
||||
</label>
|
||||
<br />
|
||||
{% endif %}
|
||||
<label class="radio-inline">
|
||||
{% if (export_type=='u') %}
|
||||
<input type="radio" name="export_type" value="u" checked="checked" />
|
||||
{% else %}
|
||||
<input type="radio" name="export_type" value="u" />
|
||||
{% endif %}
|
||||
{{ text_export_type_customer }}
|
||||
</label>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;" id="export_filter">
|
||||
<div class="col-sm-6">
|
||||
{{ entry_category_filter }}
|
||||
<span class="help">{{ help_category_filter }}</span>
|
||||
<br />
|
||||
<input type="text" name="category" value="" placeholder="{{ entry_category }}" id="input-category" class="form-control" />
|
||||
<div id="categories" class="well well-sm" style="height: 100px; overflow: auto;">
|
||||
{% for category in categories %}
|
||||
<div id="category{{ category.category_id }}"><i class="fa fa-minus-circle"></i> {{ category.name }}
|
||||
<input type="hidden" name="categories[]" value="{{ category.category_id }}" />
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
{{ entry_manufacturer_filter }}
|
||||
<span class="help">{{ help_manufacturer_filter }}</span>
|
||||
<br />
|
||||
<input type="text" name="manufacturer" value="" placeholder="{{ entry_manufacturer }}" id="input-manufacturer" class="form-control" />
|
||||
<div id="manufacturers" class="well well-sm" style="height: 100px; overflow: auto;">
|
||||
{% for manufacturer in manufacturers %}
|
||||
<div id="manufacturer{{ manufacturer.manufacturer_id }}"><i class="fa fa-minus-circle"></i> {{ manufacturer.name }}
|
||||
<input type="hidden" name="manufacturers[]" value="{{ manufacturer.manufacturer_id }}" />
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;" id="range_type">
|
||||
<div class="col-sm-12">
|
||||
{{ entry_range_type }}
|
||||
<span class="help">{{ help_range_type }}</span>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="range_type" value="id" id="range_type_id">{{ button_export_id }}
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="range_type" value="page" id="range_type_page">{{ button_export_page }}
|
||||
</label>
|
||||
<br /><br />
|
||||
<span class="id">{{ entry_start_id }}</span>
|
||||
<span class="page">{{ entry_start_index }}</span>
|
||||
<br />
|
||||
<input type="text" name="min" value="{{ min }}" />
|
||||
<br />
|
||||
<span class="id">{{ entry_end_id }}</span>
|
||||
<span class="page">{{ entry_end_index }}</span>
|
||||
<br />
|
||||
<input type="text" name="max" value="{{ max }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<div class="col-sm-12">
|
||||
<a onclick="downloadData();" class="btn btn-primary"><span>{{ button_export }}</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="tab-import">
|
||||
<form action="{{ import }}" method="post" enctype="multipart/form-data" id="import" class="form-horizontal">
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<div class="col-sm-12">
|
||||
{{ entry_import }}
|
||||
<span class="help">{{ help_import }}</span>
|
||||
<span class="help">{{ help_format }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<div class="col-sm-12">
|
||||
{{ entry_incremental }}
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
{% if (incremental) %}
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="incremental" value="1" checked="checked" />
|
||||
{{ text_yes }} {{ help_incremental_yes }}
|
||||
</label>
|
||||
<br />
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="incremental" value="0" />
|
||||
{{ text_no }} {{ help_incremental_no }}
|
||||
</label>
|
||||
{% else %}
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="incremental" value="1" />
|
||||
{{ text_yes }} {{ help_incremental_yes }}
|
||||
</label>
|
||||
<br />
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="incremental" value="0" checked="checked" />
|
||||
{{ text_no }} {{ help_incremental_no }}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<div class="col-sm-12">
|
||||
{{ entry_upload }}<br /><br />
|
||||
<input type="file" name="upload" id="upload" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<div class="col-sm-12">
|
||||
<a onclick="uploadData();" class="btn btn-primary"><span>{{ button_import }}</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="tab-settings">
|
||||
<form action="{{ settings }}" method="post" enctype="multipart/form-data" id="settings" class="form-horizontal">
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<label class="radio-inline">
|
||||
{% if (settings_use_option_id) %}
|
||||
<input type="checkbox" name="export_import_settings_use_option_id" value="1" checked="checked" /> {{ entry_settings_use_option_id }}
|
||||
{% else %}
|
||||
<input type="checkbox" name="export_import_settings_use_option_id" value="1" /> {{ entry_settings_use_option_id }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<label class="radio-inline">
|
||||
{% if (settings_use_option_value_id) %}
|
||||
<input type="checkbox" name="export_import_settings_use_option_value_id" value="1" checked="checked" /> {{ entry_settings_use_option_value_id }}
|
||||
{% else %}
|
||||
<input type="checkbox" name="export_import_settings_use_option_value_id" value="1" /> {{ entry_settings_use_option_value_id }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<label class="radio-inline">
|
||||
{% if (settings_use_attribute_group_id) %}
|
||||
<input type="checkbox" name="export_import_settings_use_attribute_group_id" value="1" checked="checked" /> {{ entry_settings_use_attribute_group_id }}
|
||||
{% else %}
|
||||
<input type="checkbox" name="export_import_settings_use_attribute_group_id" value="1" /> {{ entry_settings_use_attribute_group_id }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<label class="radio-inline">
|
||||
{% if (settings_use_attribute_id) %}
|
||||
<input type="checkbox" name="export_import_settings_use_attribute_id" value="1" checked="checked" /> {{ entry_settings_use_attribute_id }}
|
||||
{% else %}
|
||||
<input type="checkbox" name="export_import_settings_use_attribute_id" value="1" /> {{ entry_settings_use_attribute_id }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
{% if (exist_filter) %}
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<label class="radio-inline">
|
||||
{% if (settings_use_filter_group_id) %}
|
||||
<input type="checkbox" name="export_import_settings_use_filter_group_id" value="1" checked="checked" /> {{ entry_settings_use_filter_group_id }}
|
||||
{% else %}
|
||||
<input type="checkbox" name="export_import_settings_use_filter_group_id" value="1" /> {{ entry_settings_use_filter_group_id }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<label class="radio-inline">
|
||||
{% if (settings_use_filter_id) %}
|
||||
<input type="checkbox" name="export_import_settings_use_filter_id" value="1" checked="checked" /> {{ entry_settings_use_filter_id }}
|
||||
{% else %}
|
||||
<input type="checkbox" name="export_import_settings_use_filter_id" value="1" /> {{ entry_settings_use_filter_id }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-group" style="margin:0px;">
|
||||
<div class="col-sm-12">
|
||||
<a onclick="updateSettings();" class="btn btn-primary"><span>{{ button_settings }}</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="tab-support">
|
||||
<div id="export_import_notification" class="alert alert-info"><i class="fa fa-info-circle"></i>
|
||||
<div id="export_import_loading"><img src="view/image/export-import/loading.gif" />{{ text_loading_notifications }}</div>
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
<table class="table table-bordered table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-nowrap">{{ entry_version }}</td>
|
||||
<td>{{ version_export_import }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-nowrap">{{ entry_oc_version }}</td>
|
||||
<td>{{ version_opencart }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-nowrap" style="vertical-align:top;">{{ entry_license }}</td>
|
||||
<td class="text-wrap">{{ text_license }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
function getNotifications() {
|
||||
$('#export_import_notification').html('<i class="fa fa-info-circle"></i><button type="button" class="close" data-dismiss="alert">×</button> <div id="export_import_loading"><img src="view/image/export-import/loading.gif" />{{ text_loading_notifications }}</div>');
|
||||
setTimeout(
|
||||
function(){
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'index.php?route=extension/export_import/getNotifications&user_token={{ user_token }}',
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
if (json['error']) {
|
||||
$('#export_import_notification').html('<i class="fa fa-info-circle"></i><button type="button" class="close" data-dismiss="alert">×</button> '+json['error']+' <span style="cursor:pointer;font-weight:bold;text-decoration:underline;float:right;" onclick="getNotifications();">{{ text_retry }}</span>');
|
||||
} else if (json['message']) {
|
||||
$('#export_import_notification').html('<i class="fa fa-info-circle"></i><button type="button" class="close" data-dismiss="alert">×</button> '+json['message']);
|
||||
} else {
|
||||
$('#export_import_notification').html('<i class="fa fa-info-circle"></i><button type="button" class="close" data-dismiss="alert">×</button> '+'{{ error_no_news }}');
|
||||
}
|
||||
},
|
||||
failure: function(){
|
||||
$('#export_import_notification').html('<i class="fa fa-info-circle"></i><button type="button" class="close" data-dismiss="alert">×</button> '+'{{ error_notifications }} <span style="cursor:pointer;font-weight:bold;text-decoration:underline;float:right;" onclick="getNotifications();">{{ text_retry }}</span>');
|
||||
},
|
||||
error: function() {
|
||||
$('#export_import_notification').html('<i class="fa fa-info-circle"></i><button type="button" class="close" data-dismiss="alert">×</button> '+'{{ error_notifications }} <span style="cursor:pointer;font-weight:bold;text-decoration:underline;float:right;" onclick="getNotifications();">{{ text_retry }}</span>');
|
||||
}
|
||||
});
|
||||
},
|
||||
500
|
||||
);
|
||||
}
|
||||
|
||||
function check_export_filter(export_type) {
|
||||
if (export_type=='p') {
|
||||
$('#export_filter').show();
|
||||
} else {
|
||||
$('#export_filter').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function check_range_type(export_type) {
|
||||
if ((export_type=='p') || (export_type=='c') || (export_type=='u')) {
|
||||
$('#range_type').show();
|
||||
$('#range_type_id').prop('checked',true);
|
||||
$('#range_type_page').prop('checked',false);
|
||||
$('.id').show();
|
||||
$('.page').hide();
|
||||
} else {
|
||||
$('#range_type').hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
check_export_filter($('input[name=export_type]:checked').val());
|
||||
check_range_type($('input[name=export_type]:checked').val());
|
||||
|
||||
$("#range_type_id").click(function() {
|
||||
$(".page").hide();
|
||||
$(".id").show();
|
||||
});
|
||||
|
||||
$("#range_type_page").click(function() {
|
||||
$(".id").hide();
|
||||
$(".page").show();
|
||||
});
|
||||
|
||||
$('input[name=export_type]').click(function() {
|
||||
check_export_filter($(this).val());
|
||||
check_range_type($(this).val());
|
||||
});
|
||||
|
||||
$('span.close').click(function() {
|
||||
$(this).parent().remove();
|
||||
});
|
||||
|
||||
$('a[data-toggle="tab"]').click(function() {
|
||||
$('#export_import_welcome').remove();
|
||||
});
|
||||
|
||||
$('a[href="#tab-support"').click(function() {
|
||||
if ($(this).parent().attr('class')!='active') {
|
||||
getNotifications();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function checkFileSize(id) {
|
||||
// See also http://stackoverflow.com/questions/3717793/javascript-file-upload-size-validation for details
|
||||
var input, file, file_size;
|
||||
|
||||
if (!window.FileReader) {
|
||||
// The file API isn't yet supported on user's browser
|
||||
return true;
|
||||
}
|
||||
|
||||
input = document.getElementById(id);
|
||||
if (!input) {
|
||||
// couldn't find the file input element
|
||||
return true;
|
||||
}
|
||||
else if (!input.files) {
|
||||
// browser doesn't seem to support the `files` property of file inputs
|
||||
return true;
|
||||
}
|
||||
else if (!input.files[0]) {
|
||||
// no file has been selected for the upload
|
||||
alert( "{{ error_select_file }}" );
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
file = input.files[0];
|
||||
file_size = file.size;
|
||||
{% if ((post_max_size is defined) and (post_max_size)) %}
|
||||
// check against PHP's post_max_size
|
||||
post_max_size = {{ post_max_size }};
|
||||
if (file_size > post_max_size) {
|
||||
alert( "{{ error_post_max_size }}" );
|
||||
return false;
|
||||
}
|
||||
{% endif %}
|
||||
{% if ((upload_max_filesize is defined) and (upload_max_filesize)) %}
|
||||
// check against PHP's upload_max_filesize
|
||||
upload_max_filesize = {{ upload_max_filesize }};
|
||||
if (file_size > upload_max_filesize) {
|
||||
alert( "{{ error_upload_max_filesize }}" );
|
||||
return false;
|
||||
}
|
||||
{% endif %}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function uploadData() {
|
||||
if (checkFileSize('upload')) {
|
||||
$('#import').submit();
|
||||
}
|
||||
}
|
||||
|
||||
function isNumber(txt){
|
||||
var regExp=/^[\d]{1,}$/;
|
||||
return regExp.test(txt);
|
||||
}
|
||||
|
||||
count_product = {{ count_product }};
|
||||
|
||||
function updateCountProducts() {
|
||||
$.ajax({
|
||||
url: 'index.php?route=extension/export_import/getCountProduct&user_token={{ user_token }}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: $("input[name='categories[]'],input[name='manufacturers[]']").serialize(),
|
||||
success: function(json) {
|
||||
if (json['count']) {
|
||||
count_product = json['count'];
|
||||
} else {
|
||||
}
|
||||
},
|
||||
error: function(xhr, ajaxOptions, thrownError) {
|
||||
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateExportForm(id) {
|
||||
var export_type = $('input[name=export_type]:checked').val();
|
||||
if ((export_type!='c') && (export_type!='p') && (export_type!='u')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var val = $("input[name=range_type]:checked").val();
|
||||
var min = $("input[name=min]").val();
|
||||
var max = $("input[name=max]").val();
|
||||
|
||||
if ((min=='') && (max=='')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isNumber(min) || !isNumber(max)) {
|
||||
alert("{{ error_param_not_number }}");
|
||||
return false;
|
||||
}
|
||||
|
||||
var count_item;
|
||||
switch (export_type) {
|
||||
case 'p': count_item = count_product-1; break;
|
||||
case 'c': count_item = {{ count_category-1 }}; break;
|
||||
default: count_item = {{ count_customer-1 }}; break;
|
||||
}
|
||||
var batchNo = parseInt(count_item/parseInt(min))+1; // Maximum number of item-batches, namely, item number/min, and then rounded up (that is, integer plus 1)
|
||||
var minItemId;
|
||||
switch (export_type) {
|
||||
case 'p': minItemId = parseInt( {{ min_product_id }} ); break;
|
||||
case 'c': minItemId = parseInt( {{ min_category_id }} ); break;
|
||||
default: minItemId = parseInt( {{ min_customer_id }} ); break;
|
||||
|
||||
}
|
||||
var maxItemId;
|
||||
switch (export_type) {
|
||||
case 'p': maxItemId = parseInt( {{ max_product_id }} ); break;
|
||||
case 'c': maxItemId = parseInt( {{ max_category_id }} ); break;
|
||||
default: maxItemId = parseInt( {{ max_customer_id }} ); break;
|
||||
|
||||
}
|
||||
|
||||
if (val=="page") { // Min for the batch size, Max for the batch number
|
||||
if (parseInt(max) <= 0) {
|
||||
alert("{{ error_batch_number }}");
|
||||
return false;
|
||||
}
|
||||
if (parseInt(max) > batchNo) {
|
||||
alert("{{ error_page_no_data }}");
|
||||
return false;
|
||||
} else {
|
||||
$("input[name=max]").val(parseInt(max)+1);
|
||||
}
|
||||
} else {
|
||||
if (minItemId <= 0) {
|
||||
alert("{{ error_min_item_id }}");
|
||||
return false;
|
||||
}
|
||||
if (parseInt(min) > maxItemId || parseInt(max) < minItemId || parseInt(min) > parseInt(max)) {
|
||||
alert("{{ error_id_no_data }}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function downloadData() {
|
||||
if (validateExportForm('export')) {
|
||||
$('#export').submit();
|
||||
}
|
||||
}
|
||||
|
||||
function updateSettings() {
|
||||
$('#settings').submit();
|
||||
}
|
||||
|
||||
// Category
|
||||
$('input[name=\'category\']').autocomplete({
|
||||
'source': function(request, response) {
|
||||
$.ajax({
|
||||
url: 'index.php?route=catalog/category/autocomplete&user_token={{ user_token }}&filter_name=' + encodeURIComponent(request),
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
response($.map(json, function(item) {
|
||||
return {
|
||||
label: item['name'],
|
||||
value: item['category_id']
|
||||
}
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
'select': function(item) {
|
||||
$('input[name=\'category\']').val('');
|
||||
$('#category' + item['value']).remove();
|
||||
$('#categories').append('<div id="category' + item['value'] + '"><i class="fa fa-minus-circle"></i> ' + item['label'] + '<input type="hidden" name="categories[]" value="' + item['value'] + '" /></div>');
|
||||
updateCountProducts();
|
||||
}
|
||||
});
|
||||
|
||||
$('#categories').delegate('.fa-minus-circle', 'click', function() {
|
||||
$(this).parent().remove();
|
||||
updateCountProducts();
|
||||
});
|
||||
|
||||
// Manufacturer
|
||||
$('input[name=\'manufacturer\']').autocomplete({
|
||||
'source': function(request, response) {
|
||||
$.ajax({
|
||||
url: 'index.php?route=catalog/manufacturer/autocomplete&user_token={{ user_token }}&filter_name=' + encodeURIComponent(request),
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
response($.map(json, function(item) {
|
||||
return {
|
||||
label: item['name'],
|
||||
value: item['manufacturer_id']
|
||||
}
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
'select': function(item) {
|
||||
$('input[name=\'manufacturer\']').val('');
|
||||
$('#manufacturer' + item['value']).remove();
|
||||
$('#manufacturers').append('<div id="manufacturer' + item['value'] + '"><i class="fa fa-minus-circle"></i> ' + item['label'] + '<input type="hidden" name="manufacturers[]" value="' + item['value'] + '" /></div>');
|
||||
updateCountProducts();
|
||||
}
|
||||
});
|
||||
|
||||
$('#manufacturers').delegate('.fa-minus-circle', 'click', function() {
|
||||
$(this).parent().remove();
|
||||
updateCountProducts();
|
||||
});
|
||||
//--></script>
|
||||
|
||||
</div>
|
||||
{{ footer }}
|
||||
Reference in New Issue
Block a user