public function __construct($company_id, $price_id = 0, $lang_code = DESCR_SL, $offset = 0, $debug = false, $options = array()) { $this->company_id = $company_id; $this->lang_code = $lang_code; $this->offset = (int) $offset; $this->debug = $debug; if (!empty($price_id)) { $this->price_id = $price_id; $this->price_list = fn_yml_get_price_list($price_id); if (!empty($options)) { $this->options = $options; } else { $this->options = fn_yml_get_options($price_id); } $this->log = new Logs('csv', $price_id); $this->filepath = $this->getFilePath(); $this->filepath_temp = $this->getTempFilePath(); } $this->yml2_product_export = fn_get_storage_data('yml2_product_export_' . $this->price_id); $this->yml2_product_skip = fn_get_storage_data('yml2_product_skip_' . $this->price_id); if (!empty($this->options)) { $this->filename = $this->filename . '_' . $this->options['price_id']; $this->options['company_id'] = $this->company_id; if (!empty($this->options['export_categories'])) { $this->export_category_ids = explode(',', $this->options['export_categories']); } if (!empty($this->options['exclude_categories_ext'])) { $this->exclude_category_ids = explode(',', $this->options['exclude_categories_ext']); } if (!empty($this->options['hidden_categories'])) { $this->hidden_category_ids = explode(',', $this->options['hidden_categories']); } if (!empty($this->options['export_hidden_categories']) && $this->options['export_hidden_categories'] == 'Y' && !empty($this->options['hidden_categories_ext'])) { $hidden_category_ids_ext = explode(',', $this->options['hidden_categories_ext']); $this->export_category_ids = array_merge($this->export_category_ids, $hidden_category_ids_ext); } $this->options['offer_type_categories'] = $this->getYMLCategories('yml2_offer_type'); $this->options['yml2_model_categories'] = $this->getYMLCategories('yml2_model'); $this->options['yml2_type_prefix_categories'] = $this->getYMLCategories('yml2_type_prefix'); $this->options['market_category'] = $this->getYMLCategories('yml2_market_category'); $this->options['yml2_model_select'] = $this->getYMLCategories('yml2_model_select'); foreach ($this->options['yml2_model_select'] as $category_id => $select) { $select = explode('.', $select); $this->options['yml2_model_select'][$category_id] = array(); if (!fn_is_empty($select)) { $this->options['yml2_model_select'][$category_id]['type'] = $select[0]; $this->options['yml2_model_select'][$category_id]['value'] = $select[1]; } } $this->options['yml2_type_prefix_select'] = $this->getYMLCategories('yml2_type_prefix_select'); foreach ($this->options['yml2_type_prefix_select'] as $category_id => $select) { $select = explode('.', $select); $this->options['yml2_type_prefix_select'][$category_id] = array(); if (!fn_is_empty($select)) { $this->options['yml2_type_prefix_select'][$category_id]['type'] = $select[0]; $this->options['yml2_type_prefix_select'][$category_id]['value'] = $select[1]; } } } }
} Tygh::$app['view']->assign('price_lists', $price_lists); Tygh::$app['view']->assign('generation_statuses', $generation_statuses); if (defined('AJAX_REQUEST')) { Tygh::$app['view']->display('addons/yml_export/views/yml/manage.tpl'); exit; } } elseif ($mode == "update") { $price_list = array(); $schema_price_list = fn_get_schema('yml', 'price_list'); $schema_price_list = $schema_price_list['default']; $schema_price_list['general']['shop_name']['default'] = Registry::get('runtime.company_data.company'); $simple = Registry::get('runtime.simple_ultimate'); $schema_price_list['export_data']['export_shared_products']['disabled'] = !empty($simple) ? true : false; if (!empty($_REQUEST['price_id'])) { $price_list = fn_yml_get_price_list($_REQUEST['price_id']); if (empty($price_list)) { return array(CONTROLLER_STATUS_OK, 'yml.manage'); } Tygh::$app['view']->assign('price', $price_list); } $tabs = array(); $tabs_codes = array_keys($schema_price_list); foreach ($tabs_codes as $tab_code) { $tabs[$tab_code] = array('title' => __('yml_export.tab_' . $tab_code), 'js' => true); } Registry::set('navigation.tabs', $tabs); Tygh::$app['view']->assign('price_lists', $schema_price_list); if (!empty($price_list['param_id'])) { $yml2_information = __('yml2_available_in_customer', array('[yml2_generate_url]' => fn_yml_get_generate_link($price_list), '[yml2_get_url]' => fn_yml_get_link($price_list), '[yml2_console_generate]' => fn_yml_get_console_cmd($price_list))); Tygh::$app['view']->assign('yml2_information', $yml2_information);