$log_mess = "****************** " . date('d-m-Y-H-i-s', time()) . " *********************\n\r"; $log_mess .= "Начало импорта товаров\n\r"; fwrite($handle, $log_mess); $file = $_GET['filename']; if ($file == 'import.xml' && file_exists(IMPORT_FILES . $file)) { $xml = simplexml_load_file(IMPORT_FILES . $file); $db = new DBFunctions(DB_HOST, DB_NAME, DB_USER, DB_PASSWORD); $categories = $db->findAll('shop_categories'); $properties = $db->findAll('shop_properties'); $products['products'] = $db->findAll('shop'); if ($xml->Классификатор->Группы) { $categories = saveCategories($categories, $xml, $db); $products['categories'] = $categories; } if ($xml->Классификатор->Свойства) { $properties = saveProperties($properties, $xml, $db); $products['properties'] = $properties; } if ($xml->Каталог->Ид) { $db->truncate('exchange_info'); $db->create('exchange_info', array('catalog_id' => trim($xml->Каталог->Ид))); } if ($xml->Каталог->Товары) { $products = saveProducts($products, $xml, $db); } $log_mess = "****************** " . date('d-m-Y-H-i-s', time()) . " *********************\n\r"; $log_mess .= "Импорт товаров прошел нормально\n\r"; fwrite($handle, $log_mess); //$db->disconnect(); } elseif ($file == 'offers.xml' && file_exists(IMPORT_FILES . $file)) { $xml = simplexml_load_file(IMPORT_FILES . $file);
if ($listentry != '__TITLE__') { $properties_object->addListValue($properties_info_item['NEWIDENTIFIER'], $listentry, $listorder++); } } } } } if ($property_type == "page") { $sites = $siteMgr->getList(); for ($s = 0; $s < count($sites); $s++) { $pageMgr = new PageMgr($sites[$s]["ID"]); $properties_object = $pageMgr->properties; saveProperties($properties_object, $properties_ids, $properties_del_tsuffixes, $this->params, $widprefix, $property_type); } } else { saveProperties($properties_object, $properties_ids, $properties_del_tsuffixes, $this->params, $widprefix, $property_type); } // Reload Tab switch ($property_type) { case 'page': $koala->queueScript('Koala.windows[\'' . $widprefix . '\'].tabs.select(0,Koala.windows[\'' . $widprefix . '\'].tabs.params);'); break; case 'cblock': $koala->queueScript('Koala.windows[\'' . $widprefix . '\'].tabs.select(1,Koala.windows[\'' . $widprefix . '\'].tabs.params);'); break; case 'file': $koala->queueScript('Koala.windows[\'' . $widprefix . '\'].tabs.select(2,Koala.windows[\'' . $widprefix . '\'].tabs.params);'); break; case 'user': $koala->queueScript('Koala.windows[\'' . $widprefix . '\'].tabs.select(3,Koala.windows[\'' . $widprefix . '\'].tabs.params);'); break;