* @copyright 2015 PrestaShow.pl * @license http://PrestaShow.pl/license */ require_once dirname(__FILE__) . "/../../config.php"; class PShowImporterConfigController extends PShowAdminController { /** * *Only for ajax requests * * Get saved import condition */ public function getsavedconditionsAction() { $data = array(); $config = PShow_Config::getFileConfig(Tools::getValue('file')); if (array_key_exists('additional', $config) && array_key_exists('conditions', $config['additional'])) { $data = $config['additional']['conditions']; } unset($data['import_require_all']); unset($data['skip_require_all']); if (!is_array($data)) { $data = array(); } die(Tools::jsonEncode($data)); } /** * *Only for ajax requests * * Get configuration fields form */ public function getfieldsettingsformAction() { $field = Tools::getValue('field'); $fieldNamePrefix = Tools::getValue('fieldNamePrefix'); $config = PShow_Config::getAvailableFieldConfig($field); $config['y'] = array( 'type' => 'nothing', 'label' => '', 'desc' => '
', ); $config['onlyForNew'] = array( 'type' => 'switch', 'label' => $this->l('Only for new objects'), 'desc' => $this->l('If active, this value will be imported only for new objects (not existing in the store)'), ); $config['importIfMatchRegex'] = array( 'type' => 'switch', 'label' => sprintf($this->l('Import if value %smatches%s regular expression'), '', ''), 'desc' => $this->l('Eg. import if value is not empty: /\\S+/'), ); $config['importIfMatchRegexValue'] = array( 'type' => 'text', 'label' => $this->l('Enter regular expression'), ); foreach ($config as $k => $v) { $config[$k]['name'] = $fieldNamePrefix . '[options][' . $k . ']'; if ($config[$k]['type'] == 'switch') { $config[$k]['is_bool'] = true; $config[$k]['values'] = array( 'on' => array( 'value' => 1, ), 'off' => array( 'value' => 0, ), ); } } PShowSettingsAbstract::modyfiFormPS15($config); $fields_form = array( 'form' => array( 'input' => $config, ) ); $this->prepareFileData(); // form values $values = array(); $currConfig = PShow_Config::getFileConfig($this->filename); $temp = explode('[', str_replace(']', '', $fieldNamePrefix)); foreach ($config as $k => $v) { $options = $currConfig['matched'][$temp[1]][$temp[2]]['options']; if (isset($options[$k])) { $values[$v['name']] = $options[$k]; } elseif (isset($v['value'])) { $values[$v['name']] = $v['value']; } } // create form $helper = new HelperForm(); $helper->show_toolbar = false; $lang = new Language( (int) Configuration::get('PS_LANG_DEFAULT') ); $helper->default_form_language = $lang->id; $helper->submit_action = 'btnSubmit'; $helper->currentIndex = null; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array( 'fields_value' => $values, 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); die($helper->generateForm(array($fields_form))); } public $filename; public $filepath; public $fileinfo; public $config_dir; public $default_action = 'index'; public $select_menu_tab = 'subtab-PShowImporterMain'; public function __construct() { parent::__construct(); $this->controller_displayName = $this->l('Sample Controller'); $this->context->smarty->assign('lang_iso', $this->context->language->iso_code); $this->addCSS(__PS_BASE_URI__ . 'modules/pshowimporter/views/css/full-screen-loader.css'); $maxInputVarsMsg = $this->l('You have set too low limit of form input fields (' . ini_get('max_input_vars') . ').') . '
' . $this->l('Configuration have a lot of form fields with import options.') . '

' . $this->l('If your configuration is not saving, change the limit to 3000 or more (max_input_vars=3000).') . '
' . $this->l('The above limit can be changed in PHP configuration.'); ini_set('max_input_vars', '5000'); if ((int) ini_get('max_input_vars') < 1000) { $this->alerts[] = array('danger', $maxInputVarsMsg); } $this->context->smarty->assign('max_input_vars', (int) ini_get('max_input_vars')); $this->context->smarty->assign('max_input_vars_msg', $maxInputVarsMsg); if (!Tools::getValue('file')) Tools::redirectAdmin($this->context->link->getAdminLink('PShowImporterMain')); } private function prepareFileData() { global $smarty; $this->context->smarty->assign('is_multishop', class_exists('PShow_Import_Object_Multistore')); $this->filename = Tools::getValue('file'); if (!$this->filename) { return false; } $this->filepath = glob(_MODULE_UPLOAD_PATH_ . $this->filename . '.xml'); if (count($this->filepath) <= 0) { return false; } foreach ($this->filepath as $f) { if (!in_array(pathinfo($f, PATHINFO_EXTENSION), explode(',', _IMPORT_FILE_EXTENSIONS_))) { continue; } $this->filepath = $f; break; } $this->fileinfo = pathinfo($this->filepath); $this->config_dir = _IMPORT_CONFIG_PATH_ . $this->filename . '/'; $smarty->assign('file', $this->filename); $smarty->assign('fileType', Tools::strtolower($this->fileinfo['extension'])); $smarty->assign('fromURL', file_exists(str_replace($this->fileinfo['extension'], "txt", $this->filepath))); if (!is_dir($this->config_dir)) { mkdir($this->config_dir); } $this->config = PShow_Config::getFileConfig($this->filename); $smarty->assign('config', $this->config); } /** * indexAction() * * Control configuration steps: * 1 get delimiter(CSV only) and first line * 2 match fields */ public function indexAction() { $this->action_displayName = $this->l('Informations'); $smarty = $this->context->smarty; $this->prepareFileData(); $config = PShow_Config::getFileConfig($this->fileinfo['filename']); $this->config['primary'] = array_key_exists('primary', $config) ? $config['primary'] : array(); $smarty->assign('has_matching', true); $smarty->assign('has_config', true); $this->addCSS(__PS_BASE_URI__ . 'modules/pshowimporter/views/css/config.css'); $this->addJS(__PS_BASE_URI__ . 'modules/pshowimporter/views/js/vkbeautify.0.99.00.beta.js'); if (version_compare(_PS_VERSION_, '1.6.0', '<')) { $this->addCSS(__PS_BASE_URI__ . 'modules/pshowimporter/views/css/font-awesome.min.css'); $this->addCSS(__PS_BASE_URI__ . 'modules/pshowimporter/views/css/import_ps15.css'); $this->addJS(__PS_BASE_URI__ . 'modules/pshowimporter/views/js/import_ps15.js'); } $smarty->assign('category_matching', true); $return = false; //step 1 if (!Tools::getValue('step') || Tools::getValue('step') == 1) { $smarty->assign('configStep', $this->l('Primary configuration')); $return = $this->primaryConfig(); } if ($return === true || Tools::getValue('step') == 2) { $config = PShow_Config::getFileConfig($this->fileinfo['filename']); $this->config['primary'] = array_key_exists('primary', $config) ? $config['primary'] : array(); //step 2 $smarty->assign('configStep', $this->l('Matching data')); $return = $this->matchFields(); } if ($return === true || Tools::getValue('step') == 3) { $this->action_displayName = $this->l('Final configuration'); $config = PShow_Config::getFileConfig($this->fileinfo['filename']); $this->config['primary'] = $config['primary']; //step 3 $smarty->assign('configStep', $this->l('Matching categories')); $return = $this->matchCategories(); } if ($return === true) { Tools::redirectAdmin($this->context->link->getAdminLink('PShowImporterMain')); } return $return; } /** * primaryConfig() * * configuration step: 1 */ public function primaryConfig() { $smarty = $this->context->smarty; $this->addJS('https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js'); $this->addJS(__PS_BASE_URI__ . 'modules/pshowimporter/views/js/primary_config.js'); $smarty->assign('primary_config', $this->config['primary']); if (Tools::isSubmit('submit_primaryconfig')) { $values = array_map('strval', $_POST); foreach ($values as &$v) { $v = preg_replace('~\? string\:([^\ ]+) \?~', '$1', $v); } PShow_Config::saveFileConfig($this->filename, array('primary' => $values)); $smarty->assign("alert", array('success', $this->l('Primary config saved successfully.'))); return true; } $handle = fopen($this->filepath, "r"); $i = 0; while (!feof($handle) && $i < 20) { $rows[++$i] = htmlspecialchars(fgets($handle)); } fclose($handle); $shops = Shop::getShops(); asort($shops); $smarty->assign('shops', $shops); $smarty->assign('shop_groups', ShopGroup::getShopGroups()); $smarty->assign('multistore_addon', (int) PShow_Addon::exists('Multistore')); $smarty->assign('rows', $rows); $smarty->assign('languages', Language::getLanguages(true)); } public function saveSkippedManufacturers() { $data = array(); if (!array_key_exists('manufacturersLoaded', $_POST)) { return; } foreach ($_POST as $key => $val) { if (stripos($key, 'manufacturer_') === false) { continue; } $data[str_replace('manufacturer_', '', $key)] = (int) $val; } PShow_Config::saveFileConfig($this->filename, array('skipped_manufacturers' => $data)); return true; } public function genFormForExchangeRates() { $currencies = Currency::getCurrencies(); $config = array( 'active' => array( 'label' => $this->l('Define custom exchange rates'), 'name' => 'exchange_rates[active]', 'type' => 'switch', 'is_bool' => true, 'desc' => $this->l('Enable this option to calculate the price from the file according to the exchange rate during import, exchange rates you can set below'), 'values' => array( 'on' => array( 'value' => 1, ), 'off' => array( 'value' => 0, ), ), 'value' => 0, ), 'currency' => array( 'label' => $this->l('Default currency of the prices from file'), 'name' => 'exchange_rates[id_currency]', 'type' => 'select', 'default_value' => (int) $this->context->currency->id, 'options' => array( 'query' => $currencies, 'id' => 'id_currency', 'name' => 'name' ) ), ); foreach ($currencies as $currency) { $config['currency_' . $currency['id_currency']] = array( 'label' => $this->l('Exchange rate for ') . $currency['name'], 'name' => 'exchange_rates[currency_' . $currency['id_currency'] . ']', 'type' => 'text', 'desc' => $this->l('set 1 to do not change price from file') . '
' . $this->l('(net price from file + (net price from file * overhead)) * exchange rate = net price in the shop'), 'value' => 1, ); } PShowSettingsAbstract::modyfiFormPS15($config); $fields_form = array( 'form' => array( 'input' => $config, ) ); $values = array(); foreach ($config as $k => $v) { $options = $this->config['additional']['exchange_rates']; if (isset($options[$k])) { $values[$v['name']] = $options[$k]; } elseif (isset($v['value'])) { $values[$v['name']] = $v['value']; } if ($v['type'] == 'switch') { $values[$v['name']] = (int) $values[$v['name']]; } } PShowSettingsAbstract::modyfiFormPS15($config); // create form $helper = new HelperForm(); $helper->show_toolbar = false; $lang = new Language( (int) Configuration::get('PS_LANG_DEFAULT') ); $helper->default_form_language = $lang->id; $helper->submit_action = 'btnSubmit'; $helper->currentIndex = null; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array( 'fields_value' => $values, 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm(array($fields_form)); } public function saveConditions() { if (!array_key_exists('conditions', $_POST)) { return false; } PShow_Config::saveFileConfig( $this->filename, array('additional' => array('conditions' => $_POST['conditions'])) ); return true; } public function saveReplacement() { if (!array_key_exists('replacement', $_POST)) { return false; } PShow_Config::saveFileConfig( $this->filename, array('additional' => array('replacement' => $_POST['replacement'])) ); return true; } public function saveExchangeRates() { if (!array_key_exists('exchange_rates', $_POST)) { return false; } PShow_Config::saveFileConfig( $this->filename, array('additional' => array('exchange_rates' => $_POST['exchange_rates'])) ); return true; } public function saveMatchedCategories() { $data = array(); if (!array_key_exists('categoriesLoaded', $_POST)) { return; } foreach ($_POST as $key => $val) { if (in_array($val, array('skip', 'leave', 'disableNotExistingInFile'))) { $data[$key] = $val; } if (in_array($val, array('match'))) { $data[$key] = str_replace("\\\"", "\"", $_POST['categoryFromStore_' . $key]); } } PShow_Config::saveFileConfig($this->filename, array('matched_categories' => $data)); return true; } public function loadCategoriesAction() { $this->action_displayName = $this->l('Sample Controller'); $this->prepareFileData(); $offset = (int) Tools::getValue('offset', 0); $limit = (int) Tools::getValue('limit', 10); $fileCategories = Tools::jsonDecode(Tools::file_get_contents($this->config_dir . 'categories_in_file')); if ($offset > 0) { --$offset; } if ($limit === 0) { $_results = array_slice($fileCategories, $offset, count($fileCategories) - $offset + 1); } else { $_results = array_slice($fileCategories, (($offset == 0) ? 0 : ($offset + 1)), $limit); } $results = array(); $k = (($offset == 0) ? 0 : ($offset + 1)); foreach ($_results as $c) { $results[++$k] = $c; } global $smarty; $smarty->assign('matched_categories', $this->config['matched_categories']); $smarty->assign('fileCategories', $results); die($smarty->display(__DIR__ . "/../../views/templates/admin/config_loadCategories.tpl")); } public function loadManufacturersAction() { $this->action_displayName = $this->l('Sample Controller'); $this->prepareFileData(); $fileManufacturers = Tools::jsonDecode(Tools::file_get_contents($this->config_dir . 'manufacturers_in_file')); $fileManufacturers = array_merge(array("Without value in the file"), $fileManufacturers); global $smarty; $smarty->assign('fileManufacturers', $fileManufacturers); $smarty->assign('skipped_manufacturers', $this->config['skipped_manufacturers']); $smarty->display(__DIR__ . "/../../views/templates/admin/config_loadManufacturers.tpl"); die(); } public function matchCategories() { global $smarty; if (Tools::getValue('regenerate_categories_list')) { @unlink($this->config_dir . 'categories_in_file'); $actual_link = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $actual_link = str_replace('regenerate_categories_list', '', $actual_link); Tools::redirect($actual_link); } if (Tools::getValue('regenerate_manufacturer_list')) { @unlink($this->config_dir . 'manufacturers_in_file'); $actual_link = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $actual_link = str_replace('regenerate_manufacturer_list', '', $actual_link); Tools::redirect($actual_link); } if (Tools::isSubmit('submitNstay_categories')) { $this->saveSkippedManufacturers(); $this->saveMatchedCategories(); $this->saveExchangeRates(); $this->saveReplacement(); $this->saveConditions(); $this->config = PShow_Config::getFileConfig($this->filename); } if (Tools::isSubmit('submitNimport_categories')) { $this->saveSkippedManufacturers(); $this->saveMatchedCategories(); $this->saveExchangeRates(); $this->saveReplacement(); $this->saveConditions(); Tools::redirectAdmin($this->context->link->getAdminLink('PShowImporterImport', true) . "&file=" . $this->filename); } if (Tools::isSubmit('submit_categories')) { $this->saveSkippedManufacturers(); $this->saveMatchedCategories(); $this->saveExchangeRates(); $this->saveReplacement(); $this->saveConditions(); Tools::redirectAdmin($this->context->link->getAdminLink('PShowImporterMain', true)); } $this->addJS(__PS_BASE_URI__ . 'modules/pshowimporter/views/js/config_categories.js'); $this->action = 'additional'; $smarty->assign('config', $this->config); $smarty->assign('form_exchange_rates', $this->genFormForExchangeRates()); // get all matched fields to import conditions $matched = array(); $db_tables_ = PShow_Prestashop_Fields::getFields($this->config['primary']); $db_tables = reset($db_tables_); foreach ($this->config['matched'] as $matches) { foreach ($matches as $m) { if ($m['value'] == 'none') { continue; // skip not matched } $expl = explode('.', $m['value']); $matched[$m['value']] = $db_tables[$expl[1]]; } } $smarty->assign('matchedFromFile', $matched); if ($this->config['primary']['file_contains'] == 'data_product') { $smarty->assign('category_matching', true); $smarty->assign('manufacturer_matching', true); // check if we have category matched in the configuration from step 3 $prestafields = array('product.category', 'product.category_id', 'product.category_ids', 'product.category_path'); $temp = count(PShow_Config::getFileConfigByMatchedPrestaFields($this->filename, $prestafields)); $smarty->assign('category_matching_hasCategory', (bool) $temp); // check if we have manufacturer matched in the configuration from step 3 $prestafields = array('product.manufacturer', 'product.id_manufacturer'); $temp = count(PShow_Config::getFileConfigByMatchedPrestaFields($this->filename, $prestafields)); $smarty->assign('manufacturer_matching_hasManufacturer', (bool) $temp); } else { $smarty->assign('category_matching', false); $smarty->assign('manufacturer_matching', false); } // find categories $fileCategories = false; if (Tools::getValue('load') != 'categories') { $fileCategories = array(); } $smarty->assign('find_categories', false); if (!file_exists($this->config_dir . 'categories_in_file')) { $smarty->assign('find_categories', true); } if (Tools::getValue('load') == 'categories' && !file_exists($this->config_dir . 'categories_in_file')) { $fileCategories = array(); ini_set('max_execution_time', 3600); $matched_data_ = array(); $getCategoryField = function($match) use (&$matched_data_) { $matches = array(); preg_match('~product([0-9]+)?\.category([\_a-z]+)?~', $match['value'], $matches); if (count($matches) > 0) { $matched_data_[$match['key']] = $match['value']; } }; foreach ($this->config['matched']['matches'] as $match) { $getCategoryField($match); } foreach ($this->config['matched']['custommatches'] as $match) { $getCategoryField($match); } $results = array(); $objectTag = $this->config['matched']['objectTag']; foreach ($matched_data_ as $path => $type) { $path = substr($path, (stripos($path, '/') + 1)); $cats = PShow_Xml_Parser::getInstance($this->filepath) ->getElementsByPath($objectTag); $path = str_replace('*DOT*', '.', $path); foreach ($cats as $cat) { $vals = $cat->xpath($path); if (!is_array($vals)) { continue; } $vals = array_map(function($x) { return (string) $x; }, $vals); foreach ($vals as $val) { if (!in_array(((string) $val), $results)) { $results[] = (string) $val; } } } } file_put_contents($this->config_dir . 'categories_in_file', Tools::jsonEncode($results)); die('100'); } if (file_exists($this->config_dir . 'categories_in_file')) { $storeCategories_ = Category::getCategories(false, false); $storeCategories = array(); $getChildren = function($id_parent, $getChildren) use (&$storeCategories, $storeCategories_) { foreach ($storeCategories_ as $category) { foreach ($category as $cat) { $infos = $cat['infos']; if ($infos['id_parent'] != $id_parent) { continue; } $depth = str_repeat(' ', 20 - strlen($infos['id_category'])); $depth .= str_repeat( '     ', ($infos['level_depth'] > 0) ? $infos['level_depth'] - 1 : 0 ); if ($infos['level_depth'] > 0) $depth .= '|--'; $infos['name'] = str_replace("\\", "\\\\", $infos['name']); $infos['name'] = str_replace('"', '\"', $infos['name']); $infos['name'] = str_replace("'", "\\\"", $infos['name']); $storeCategories[] = '[' . $infos['id_category'] . '] ' . $depth . ' ' . $infos['name']; $getChildren($infos['id_category'], $getChildren); } } }; $getChildren(1, $getChildren); $smarty->assign('storeCategories', Tools::jsonEncode($storeCategories)); $smarty->assign('matched_categories', $this->config['matched_categories']); $fileCategories = Tools::jsonDecode(Tools::file_get_contents($this->config_dir . 'categories_in_file')); $smarty->assign('fileCategories', $fileCategories); } // / find categories // find manufacturers $fileManufacturers = false; if (Tools::getValue('load') != 'manufacturers') { $fileManufacturers = array(); } $smarty->assign('find_manufacturers', false); if (!file_exists($this->config_dir . 'manufacturers_in_file') || file_exists($this->config_dir . 'counter_manufacturers_in_file')) { $smarty->assign('find_manufacturers', true); } if (Tools::getValue('load') == 'manufacturers' && (!file_exists($this->config_dir . 'manufacturers_in_file') || file_exists($this->config_dir . 'counter_manufacturers_in_file'))) { $fileManufacturers = array(); ini_set('max_execution_time', 3600); $matched_data_ = array(); $getManufacturerField = function($match) use (&$matched_data_) { $matches = array(); preg_match('~product([0-9]+)?\.manufacturer([\_a-z]+)?~', $match['value'], $matches); if (count($matches) > 0) { $matched_data_[$match['key']] = $match['value']; } }; foreach ($this->config['matched']['matches'] as $match) { $getManufacturerField($match); } foreach ($this->config['matched']['custommatches'] as $match) { $getManufacturerField($match); } file_put_contents($this->config_dir . 'manufacturers_in_file', ""); if (count($matched_data_) > 0) { $objectTag = $this->config['matched']['objectTag']; $fileManufacturers = array(); foreach ($matched_data_ as $path => $type) { $path = substr($path, (stripos($path, '/') + 1)); $cats = PShow_Xml_Parser::getInstance($this->filepath) ->getElementsByPath($objectTag); foreach ($cats as $cat) { $tmp = $cat->xpath($path); if (!is_array($tmp)) continue; $tmp = reset($tmp); if (!in_array(((string) $tmp), $fileManufacturers)) { $fileManufacturers[] = (string) $tmp; } } } file_put_contents($this->config_dir . 'manufacturers_in_file', Tools::jsonEncode($fileManufacturers)); die("100"); } } if (file_exists($this->config_dir . 'manufacturers_in_file')) { $fileManufacturers = Tools::jsonDecode(Tools::file_get_contents($this->config_dir . 'manufacturers_in_file')); $smarty->assign('skipped_manufacturers', $this->config['skipped_manufacturers']); $smarty->assign('fileManufacturers', $fileManufacturers); } // / find manufacturers } public function ajaxgetfilecontentsAction() { $this->prepareFileData(); $contents = PShow_Xml::removeCDATA(PShow_Xml::getFileRowsToMatchData($this->filepath, 50000)); if (Tools::getValue('bytag')) { $tag = Tools::getValue('bytag'); $matches = array(); preg_match_all('#<' . $tag . '>(.*?)#s', $contents, $matches); $result = reset($matches); $result = reset($result); if (empty($result)) { $matches = array(); preg_match_all('#<' . $tag . ' (.*)>#is', $contents, $matches); $result = reset($matches); $result = reset($result); } die(substr($result, 0, (strlen($result) > 1500 ? 1500 : strlen($result)))); } die($contents); } /** * * @param type $data */ public function removeDuplicatedPathes(&$data) { function readIt(&$SimpleXMLElement, $max_depth_lvl = 1, &$allPathes = array(), $prefix = '/') { if (--$max_depth_lvl < 0) { return; } foreach ($SimpleXMLElement as $k => $v) { $attributes = $v->attributes(); $children = $v->children(); if ($children->count() == 0 && $attributes->count() == 0) { if (in_array($prefix . $k, $allPathes)) { //unset($SimpleXMLElement->xpath($k)[0][0]); continue; } $allPathes[] = $prefix . $k; continue; } if ($attributes->count() > 0) { readIt($attributes, $max_depth_lvl, $allPathes, $prefix . $k . '/@'); } if ($children->count() > 0) { readIt($children, $max_depth_lvl, $allPathes, $prefix . $k . '/'); } } } readIt($data); } /** * matchFields() * * configuration step: 3 * match fields from file to database columns */ public function matchFields() { $smarty = $this->context->smarty; $ext = Tools::strtoupper($this->fileinfo['extension']); $this->addCSS(__PS_BASE_URI__ . 'modules/pshowimporter/views/css/icon-info.css'); $this->addCSS(__PS_BASE_URI__ . 'modules/pshowimporter/views/css/config_matchxmlfields.css'); $db_tables = PShow_Prestashop_Fields::getFields($this->config['primary']); $smarty->assign('db_tables', $db_tables); if (Tools::isSubmit('submitNstay_matchfields') || Tools::isSubmit('submit_matchfields')) { foreach ($_POST['matched']['custommatches'] as &$data) { $data['key'] = str_replace('"', "'", $data['key']); } PShow_Config::saveFileConfig($this->fileinfo['filename'], $_POST); $smarty->assign('config', PShow_Config::getFileConfig($this->fileinfo['filename'])); if (Tools::isSubmit('submit_matchfields')) { Tools::redirectAdmin($this->context->link->getAdminLink('PShowImporterConfig', true) . "&file=" . $this->filename . "&step=3"); return; } } $parser = PShow_Xml_Parser::getInstance($this->filepath); $tags = $parser->getAllTags(); if (Tools::getValue('ajaxgetbytag')) { $data = $parser->getElementByPath(explode(',', Tools::getValue('ajaxgetbytag'))); if ($data !== null) { $this->removeDuplicatedPathes($data); $smarty->assign('data', $data); } $smarty->assign('objectTag', Tools::getValue('ajaxgetbytag')); $values = $parser->getAllValuesFromObject($data, true); $smarty->assign('allValues', $values); die($smarty->display(__DIR__ . "/../../views/templates/admin/config_matchxmlfields_matches.tpl")); } $smarty->assign('tags', $tags); $this->action = 'match' . Tools::strtolower($ext) . 'fields'; } }