Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,589
    Plugin Contributions
    30

    Default installation of additional language and automatic copying of english database texts

    Is it/was it not the case that the installation of an additional language would automatically copy the existing pre-english text (category/product titles and descriptions) to the new language fields?

    I was sure this was what happened when I did this years ago, but it is not happening now...or am I completely confused!!
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  2. #2
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: installation of additional language and automatic copying of english database tex

    Quote Originally Posted by torvista View Post
    Is it/was it not the case that the installation of an additional language would automatically copy the existing pre-english text (category/product titles and descriptions) to the new language fields?

    I was sure this was what happened when I did this years ago, but it is not happening now...or am I completely confused!!
    That should happen when the language is inserted, assuming 1) it actually gets inserted, 2) the $_SESSION['languages_id'] does not equal the newly installed languages_id and 3) the particular language record does not already exist for the category(ies)/product(s) in question... (see admin/languages.php file for more comprehensive review than provided below. Code below is shown from ZC 1.5.3.)

    obtains records from languages table to see if the new code is already in the table, if it is, error message and skip the add of new/equivalent product and other associated actions, if not, then insert the language and perform action on the database.
    Code:
    $check = $db->Execute("select * from " . TABLE_LANGUAGES . " where code = '" . $code . "'");
    if ($check->RecordCount() > 0) {
    $messageStack->add(ERROR_DUPLICATE_LANGUAGE_CODE, 'error');
    } else {
    $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) . "')");
    $insert_id = $db->Insert_ID();
    This adds the categories for the new language and is still within the else statement above, with more language generation action following it.
    Code:
    // create additional categories_description records
    $categories = $db->Execute("select c.categories_id, cd.categories_name,
    categories_description
    from " . TABLE_CATEGORIES . " c
    left join " . TABLE_CATEGORIES_DESCRIPTION . " cd
    on c.categories_id = cd.categories_id
    where cd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
    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();
    }
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,589
    Plugin Contributions
    30

    Default Re: installation of additional language and automatic copying of english database tex

    Thanks for the detailed answer, code from 1.53 does indeed work like that, but not 1.54:

    http://www.zen-cart.com/showthread.p...-product-texts
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 

Similar Threads

  1. Default Language: 2-English revise to 1-English
    By mydanilo in forum General Questions
    Replies: 2
    Last Post: 17 Mar 2015, 02:08 PM
  2. GeoIP for automatic language and currency change?
    By lexus_ in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 1
    Last Post: 23 Nov 2011, 11:47 AM
  3. writing additional texts on homepage.
    By shresthashree in forum General Questions
    Replies: 1
    Last Post: 11 Oct 2011, 05:06 PM
  4. Differet behavior in css between english and swedish language
    By malci in forum Addon Language Packs
    Replies: 0
    Last Post: 22 Aug 2008, 10:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR