Index: branches/unlabeled/unlabeled-1.1.2/admin/install_over_kx.php =================================================================== diff -u -r6944 -r6945 --- branches/unlabeled/unlabeled-1.1.2/admin/install_over_kx.php (.../install_over_kx.php) (revision 6944) +++ branches/unlabeled/unlabeled-1.1.2/admin/install_over_kx.php (.../install_over_kx.php) (revision 6945) @@ -1,14 +1,9 @@ recallObject('kMultiLanguage'); - $name_field = $ml_formatter->LangFieldName('Name'); - $description_field = $ml_formatter->LangFieldName('Description'); + // 1. run in-portal install scripts & import language packs + RunSchemaFile($application->Conn, FULL_PATH.'/admin/install/inportal_schema.sql', 'dbconnection'); + RunSQLFile($application->Conn, FULL_PATH.'/admin/install/inportal_data.sql', 'dbconnection'); - $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(); + $sql = 'SELECT Version FROM '.TABLE_PREFIX.'Modules WHERE Name = '.$application->Conn->qstr('In-Portal'); + $mod_version = $application->Conn->GetOne($sql); - $cat_id = $cat->GetID(); + set_ini_value('Module Versions', 'In-Portal', $mod_version); + save_values(); - $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); - + // 2. run in-commerce install script + $application->SetVar('skip_redirect', true); + include_once FULL_PATH.'/in-commerce/admin/install.php'; ?> \ No newline at end of file