Index: branches/unlabeled/unlabeled-1.1.2/admin/install_over_kx.php =================================================================== diff -u --- branches/unlabeled/unlabeled-1.1.2/admin/install_over_kx.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/admin/install_over_kx.php (revision 6944) @@ -0,0 +1,80 @@ +Init(); + + require_once FULL_PATH.'/admin/install/install_lib.php'; + + // create module category + $ml_formatter =& $application->recallObject('kMultiLanguage'); + $name_field = $ml_formatter->LangFieldName('Name'); + $description_field = $ml_formatter->LangFieldName('Description'); + + $cat =& $application->recallObject('c', null, Array('skip_autoload' => true)); + $cat->Clear(); + $cat_fields = Array($name_field => 'Products', 'AutomaticFilename' => 1, 'Filename' => 'Products', + $description_field => 'Product Catalog', 'Status' => 1, 'ParentId' => 0, + 'CategoryTemplate' => 'in-commerce/store/category', 'CachedCategoryTemplate' => 'in-commerce/store/category'); + $cat->SetDBFieldsFromHash($cat_fields); + $cat->Create(); + + $cat_id = $cat->GetID(); + + $filename = FULL_PATH.'/'.$MODULE_NAME.'/admin/install/inportal_schema.sql'; + if( file_exists($filename) ) RunSchemaFile($application->Conn, $filename, 'dbconnection'); + + $filename = FULL_PATH.'/'.$MODULE_NAME.'/admin/install/inportal_data.sql'; + if( file_exists($filename) ) + { + $sql = file($filename); + for($x = 0; $x < count($sql); $x++) + { + $sql[$x] = str_replace('{ProductCatId}', $cat_id, $sql[$x]); + } + RunSQLText($application->Conn, $sql,'dbconnection'); + + if (!(isset($ini_file) && $ini_file)) { + $ini_file = FULL_PATH.'/config.php'; + $ini_vars = inst_parse_portal_ini($ini_file, true); + } + + $sql = 'SELECT Version FROM '.TABLE_PREFIX.'Modules WHERE Name = '.$application->Conn->qstr('In-Commerce'); + $mod_version = $application->Conn->GetOne($sql); + set_ini_value('Module Versions', 'In-Commerce', $mod_version); + save_values(); + } + + linkCustomFields($MODULE_NAME, 'p', 11); + + linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field + $cat->defineFields(); + $application->removeObject('c-cdata'); + $cat->SetDBField('cust_p_ItemTemplate', 'in-commerce/product/details'); + $cat->Update(); + + $sql = 'DELETE FROM '.TABLE_PREFIX.'Cache WHERE (VarName = "config_files") OR (VarName LIKE "%_parsed")'; + $application->Conn->Query($sql); + + $sql = 'UPDATE '.TABLE_PREFIX.'Modules SET RootCat = '.$cat_id.' WHERE Name = '.$application->Conn->qstr('In-Commerce'); + $application->Conn->Query($sql); + + $inp_cat =& $objCatList->GetCategory($cat_id); + $inp_cat->UpdateCachedPath(); + $inp_cat->UpdateACL(); + + finalizeModuleInstall($MODULE_NAME); + +?> \ No newline at end of file