Totally Zenned
- Join Date:
- Aug 2007
- Location:
- Gijón, Asturias, Spain
- Posts:
- 2,874
- Plugin Contributions:
- 7
[Done 1.6.0] Insertion of an additional language does not copy existing category/prod
For ZC1.54 there are new function calls to log admin activity scattered about the admin files.
In languages.php there is one after the insertion of a new language.
But, on the following line, the code uses the last insert id as the new language id to auto-populate the new categories and products texts. So now it's using the last insert of the admin activity log instead the languages table!
So although the category/product descriptions are created, they are linked to a language id of "whatever" ("64" in my test case) and so never display any text.
> $db->Execute("insert into " . TABLE_LANGUAGES . "
(name, code, image, directory, sort_order) values ('" . zen_db_input($name) . "', '" . zen_db_input($code) . "', '" . zen_db_input($image) . "', '" . zen_db_input($directory) . "', '" . zen_db_input($sort_order) . "')");zen_record_admin_activity('Language [' . $code . '] added', 'info');
$insert_id = $db->Insert_ID();
and subsequently
while (!$categories->EOF) { $db->Execute("insert into " . TABLE_CATEGORIES_DESCRIPTION . " (categories_id, language_id, categories_name, categories_description) values ('" . (int)$categories->fields['categories_id'] . "', '" . **(int)$insert_id** . "', '" . zen_db_input($categories->fields['categories_name']) . "', '" . zen_db_input($categories->fields['categories_description']) . "')"); $categories->MoveNext(); }