Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.1
- * @ Author : DeZender
- * @ Release on : 29.08.2020
- * @ Official site : http://DeZender.Net
- *
- */
- class ModelToolNeoSeoExchange1c extends NeoSeoModel
- {
- private $categories_to_1c = [];
- private $categories_parents = [];
- private $hasCategoryPath = false;
- private $hasRelatedImages = false;
- private $hasManufacturerDescription = false;
- private $hasManufacturerDescriptionName = false;
- private $hasManufacturerName = false;
- private $hasRelatedOptionsVariantProductId = false;
- private $hasAttributeProductSortorder = false;
- private $hasProductMultycurr = false;
- private $properties1c = [];
- private $properties1cLng = [];
- private $properties1c_values = [];
- private $properties1c_valuesLng = [];
- private $options1c = [];
- private $option_1c_values_array = [];
- private $option_1c_values = [];
- private $stockStatusesByName = [];
- private $languages = [];
- private $languageCodes = [];
- private $category_links = [];
- private $attribute_links = [];
- private $warehouses = [];
- private $warehouses_name = [];
- private $hasOcFilter;
- private $thirdOpencart;
- private $hasNaclad;
- private $hasNeoSeoFilter;
- private $hasNeoSeoWarehouse;
- private $hasModuleNMP;
- private $getAllProducts = false;
- private $use_filter = '';
- private $journal_labels = [];
- private $attribute_labels = [];
- static public $REPL = [
- 'search' => ["\n", "\r", "\t"],
- 'replace' => ['[~nl~]', '[~nr~]', '[~nt~]']
- ];
- private $decimal_sep = '.';
- private $system_decimal_sep = '.';
- private $hasOptionsPro = false;
- private $hasMultiStore = false;
- private $customerGroups = [];
- private $hasOptionsCombinations = false;
- private $octFilterAttribute = [];
- private $attribute_routing_download_files = [];
- private $hasCpriceModule = false;
- private $productDescriptionFieldsList = [];
- private $relatedoptions_variant_to_option_id = [];
- private $option_not_requered_name_list = [];
- private $product_tags_agree_languages = [];
- public function __construct($registry)
- {
- parent::__construct($registry);
- $this->_moduleSysName = 'neoseo_exchange1c';
- $this->_logFile = $this->_moduleSysName() . '.log';
- $this->debug = $this->config->get($this->_moduleSysName() . '_debug') == 1;
- $sql = 'show tables like \'' . DB_PREFIX . 'ocfilter_option\'';
- $query = $this->query($sql);
- $this->hasOcFilter = false;
- $this->OcFilterVersion = 'old';
- $this->hasOcFilter = 0 < $query->num_rows;
- if (!$this->hasOcFilter) {
- $sql = 'show tables like \'' . DB_PREFIX . 'ocfilter_filter\'';
- $query = $this->query($sql);
- $this->OcFilterVersion = 'new';
- $this->hasOcFilter = 0 < $query->num_rows;
- }
- $sql = 'show tables like \'' . DB_PREFIX . 'seo_url\'';
- $query = $this->query($sql);
- $this->thirdOpencart = 0 < $query->num_rows;
- $sql = 'show tables like \'' . DB_PREFIX . 'naclad\'';
- $query = $this->query($sql);
- $this->hasNaclad = 0 < $query->num_rows;
- $sql = 'SHOW TABLES LIKE \'' . DB_PREFIX . 'filter_option\'';
- $query = $this->db->query($sql);
- $this->hasNeoSeoFilter = 0 < $query->num_rows;
- $sql = 'SHOW TABLES LIKE \'' . DB_PREFIX . 'warehouse\'';
- $query = $this->db->query($sql);
- $this->hasNeoSeoWarehouse = 0 < $query->num_rows;
- $sql = 'SHOW TABLES LIKE \'' . DB_PREFIX . 'product_filter\'';
- $query = $this->db->query($sql);
- $this->hasFilter = 0 < $query->num_rows;
- $sql = 'show tables like \'' . DB_PREFIX . 'category_path\'';
- $query = $this->query($sql);
- $this->hasCategoryPath = 0 < $query->num_rows;
- $sql = 'show tables like \'' . DB_PREFIX . 'relatedoptions_variant_product\'';
- $query = $this->query($sql);
- $this->hasRelatedoptions = 0 < $query->num_rows;
- $sql = 'show tables like \'' . DB_PREFIX . 'product_option_pro_to_product\'';
- $query = $this->query($sql);
- $this->hasOptionsPro = 0 < $query->num_rows;
- $sql = 'show tables like \'' . DB_PREFIX . 'multistore\'';
- $query = $this->query($sql);
- $this->hasMultiStore = 0 < $query->num_rows;
- $sql = 'show tables like \'' . DB_PREFIX . 'poip_option_image\'';
- $query = $this->query($sql);
- $this->hasRelatedImages = 0 < $query->num_rows;
- $sql = 'show tables like \'' . DB_PREFIX . 'product_options_combinations\'';
- $query = $this->query($sql);
- $this->hasOptionsCombinations = 0 < $query->num_rows;
- if (!$this->hasOptionsCombinations) {
- $this->debug('Сообщение для разработчика: Модуль Комбинации опций не установлен. Использование комбинаций опций не возможно.');
- }
- $sql = 'show tables like \'' . DB_PREFIX . 'product_multycurr\'';
- $query = $this->query($sql);
- $this->hasProductMultycurr = 0 < $query->num_rows;
- $sql = 'show tables like \'' . DB_PREFIX . 'manufacturer_description\'';
- $query = $this->query($sql);
- $this->hasManufacturerDescription = 0 < $query->num_rows;
- if ($this->hasManufacturerDescription) {
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'manufacturer_description` LIKE \'name\';';
- $query = $this->query($sql);
- $this->hasManufacturerDescriptionName = 0 < $query->num_rows;
- }
- else {
- $this->hasManufacturerDescriptionName = false;
- }
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'product_option_value` LIKE \'image\';';
- $query = $this->query($sql);
- $this->hasOptionValueImage = 0 < $query->num_rows;
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'product_option_value` LIKE \'more_image\';';
- $query = $this->query($sql);
- $this->hasOptionValueMoreImage = 0 < $query->num_rows;
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'order` LIKE \'date_of_payment\';';
- $query = $this->query($sql);
- $this->hasDateOfPayment = 0 < $query->num_rows;
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'product_attribute` LIKE \'sort_order\';';
- $query = $this->query($sql);
- $this->hasAttributeProductSortorder = 0 < $query->num_rows;
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'order_product` LIKE \'status\';';
- $query = $this->query($sql);
- $this->hasOrderProductStatus = 0 < $query->num_rows;
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'manufacturer` LIKE \'name\';';
- $query = $this->query($sql);
- $this->hasManufacturerName = 0 < $query->num_rows;
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'product_to_category` LIKE \'main_category\';';
- $query = $this->query($sql);
- $this->main_category = 0 < $query->num_rows;
- $sql = 'SHOW TABLES LIKE \'' . DB_PREFIX . 'hpmodel_links\'';
- $query = $this->db->query($sql);
- $this->hasModuleNMP = 0 < $query->num_rows;
- if ($this->hasRelatedoptions && $this->config->get('neoseo_exchange1c_use_related_options')) {
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'relatedoptions_variant_product` LIKE \'relatedoptions_variant_product_id\';';
- $query = $this->query($sql);
- $this->hasRelatedOptionsVariantProductId = 0 < $query->num_rows;
- }
- else {
- $this->debug('Сообщение для разработчика. Таблица `' . DB_PREFIX . 'relatedoptions_variant_product` не была найдена. Использование связных опций не возможно.');
- }
- $search_option_for_sku = $this->config->get($this->_moduleSysName . '_search_option_for_sku');
- $option_field_sku = $this->config->get($this->_moduleSysName . '_option_field_sku');
- $this->sku = 0;
- $this->sku_field = '';
- if ($search_option_for_sku == 1) {
- if ($this->config->get($this->_moduleSysName . '_use_related_options') && $this->hasRelatedoptions) {
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'relatedoptions` LIKE \'' . $option_field_sku . '\';';
- $tablename = 'relatedoptions';
- }
- else {
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'product_option_value` LIKE \'' . $option_field_sku . '\';';
- $tablename = 'product_option_value';
- }
- $query = $this->query($sql);
- $this->sku = 0 < $query->num_rows;
- if ($this->sku || $this->hasOptionsPro || $this->hasOptionsCombinations) {
- $this->sku_field = $option_field_sku;
- }
- else {
- $this->debug('Поле ' . $option_field_sku . ' не найдено в таблице ' . DB_PREFIX . ($tablename . '. Поиск опций по артикулу не возможен.'));
- }
- }
- $option_field_ean = $this->config->get($this->_moduleSysName . '_option_field_ean');
- $this->option_ean_field = '';
- $this->option_ean = 0;
- $tablename = '';
- $this->relatedoptions_has_ean = 0;
- $this->product_option_value_has_ean = 0;
- if ($option_field_ean) {
- if ($this->config->get($this->_moduleSysName . '_use_related_options') && $this->hasRelatedoptions) {
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'relatedoptions` LIKE \'' . $option_field_ean . '\';';
- $tablename = 'relatedoptions';
- }
- else {
- $sql = 'SHOW COLUMNS FROM `' . DB_PREFIX . 'product_option_value` LIKE \'' . $option_field_ean . '\';';
- $tablename = 'product_option_value';
- }
- $query = $this->query($sql);
- $this->option_ean = 0 < $query->num_rows;
- if ($this->option_ean) {
- $this->option_ean_field = $option_field_ean;
- if ($tablename == 'product_option_value') {
- $this->product_option_value_has_ean = 1;
- }
- else if ($tablename == 'relatedoptions') {
- $this->relatedoptions_has_ean = 1;
- }
- }
- else {
- $this->debug('Поле ' . $option_field_ean . ' не найдено в таблице ' . DB_PREFIX . ($tablename . '. Штрих код для опции не будет присвоен'));
- }
- }
- $sql = 'SELECT stock_status_id, name FROM `' . DB_PREFIX . 'stock_status` WHERE language_id = ' . (int) $this->config->get('config_language_id') . ';';
- foreach ($this->query($sql)->rows as $row) {
- $this->stockStatusesByName[utf8_strtolower($row['name'])] = $row['stock_status_id'];
- }
- $this->log('Статусы в магазине ' . print_r($this->stockStatusesByName, true));
- $sql = 'SELECT language_id, code FROM `' . DB_PREFIX . 'language`;';
- foreach ($this->query($sql)->rows as $row) {
- $this->languages[$row['code']] = (int) $row['language_id'];
- $this->languageCodes[$row['code']] = $row['language_id'];
- }
- $links = [];
- foreach (explode("\n", $this->config->get('neoseo_exchange1c_category_links')) as $line) {
- $line = trim($line);
- if ($line == '') {
- continue;
- }
- $parts = explode(':', $line);
- if (count($parts) != 2) {
- $this->debug('Некорректная настройка связей категорий: ' . $line);
- continue;
- }
- $category_1c = $this->normalizeCategoryName($parts[0]);
- $category_names = [];
- foreach (explode(';', $parts[1]) as $name) {
- $name = $this->normalizeCategoryName($name);
- $category_id = $this->obf_7ujsqOQtJS4o6WmuJanwJ3rJCWtZE($name);
- if (!$category_id) {
- $this->debug('Некорректная настройка связей категорий: категория \'' . $name . '\' не найдена в базе');
- continue;
- }
- $category_names[] = $category_id;
- }
- if (0 < count($category_names)) {
- $links[$category_1c] = $category_names;
- }
- }
- $this->category_links = $links;
- if (0 < count($this->category_links)) {
- }
- foreach (explode("\n", $this->config->get('neoseo_exchange1c_attribute_links')) as $line) {
- $line = trim($line);
- if ($line == '') {
- continue;
- }
- $parts = explode(':', $line);
- if (count($parts) != 2) {
- $this->debug('Некорректная настройка связей атрибутов: ' . $line);
- continue;
- }
- $this->attribute_links[trim($parts[0])] = trim($parts[1]);
- }
- if (0 < count($this->attribute_links)) {
- $this->debug('Таблица связей для атрибутов: ' . print_r($this->attribute_links, true));
- }
- $attribute_labels = [];
- if ($this->config->get('neoseo_exchange1c_attribute_label')) {
- foreach (explode("\n", $this->config->get('neoseo_exchange1c_attribute_label')) as $line) {
- $line = trim($line);
- ..........................................................................
- .......................................
- .................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement