Zen Cart Logo
Forums / Bug Reports / zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

Locked

Views: 3,076

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
19 Nov 2009, 10:25 AM
#1
gob33 avatar

gob33

New Zenner

Join Date:
Jun 2008
Location:
Bordeaux, France
Posts:
69
Plugin Contributions:
3

zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

I have ZC 1.3.8a installed with DB_VERSION=1.3.8 (fresh install for demo purposes)

If i run "zc_install/index.php?main_page=inspect" like for doing an upgrade, the system recognize a db_version of 1.3.0.2 only.

Seems that "zc_install\includes\classes\class.installer_version_manager.php" finds "sort_order=115" in "configuration where configuration_key='SHOW_ACCOUNT_LINKS_ON_SITE_MAP'".

This condition is also true for 1.3.8 and the system cannot differentiate them.

19 Nov 2009, 6:23 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

I can't replicate that problem on a fresh 1.3.8a install without addons.

19 Nov 2009, 9:35 PM
#3
gob33 avatar

gob33

New Zenner

Join Date:
Jun 2008
Location:
Bordeaux, France
Posts:
69
Plugin Contributions:
3

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

Yes, you are right what you said, but I see the pb.
Ive checked again with my ZC (Full French 1.3.8a) and the original 1.3.8a (English version)

French 1.3.8a gives a DB_VERSION of 1.3.0.2 (false), English 1.3.8a gives 1.3.8 (correct)

Problem comes from the translation of 'zc_install\sql\mysql_zencart.sql' in French, to have an admin comprehensible for all our merchants. In 'zc_install\includes\classes\class.installer_version_manager.php', the functions 'check_version_XXX()'
were all refering to NUMBERS up to the 1302(). Then the comparison is done with 'configuration_title' (in English words)
which cannot be found in our version (French words). So it returns always false for 'check_version_XXX()' > 1302.

19 Nov 2009, 9:54 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

"configuration_title" is a field inside the database, and should not be translated.

19 Nov 2009, 11:33 PM
#5
gob33 avatar

gob33

New Zenner

Join Date:
Jun 2008
Location:
Bordeaux, France
Posts:
69
Plugin Contributions:
3

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

So, what the langage packs are for if the admin cannot be translated ? Its the comparison which should not have been done against something variable and langage dependant.

20 Nov 2009, 12:52 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

Feel free to translate language files located under the /includes/languages folder.
But don't go translating the core SQL code or you're naturally going to have problems.

20 Nov 2009, 10:35 AM
#7
gob33 avatar

gob33

New Zenner

Join Date:
Jun 2008
Location:
Bordeaux, France
Posts:
69
Plugin Contributions:
3

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

The Polish Language Pack (v 1.3.7 - ZenCart.pl Group) and Italian Group (http://www.zencart-italia.it/) at least are in the same case as us as they have translated 'zc_install\sql\mysql_zencart.sql'.

Some of our merchants doesnt understand English very well and have difficulties on very small problems. Thats why a full translation had been done (long work).

20 Nov 2009, 10:57 AM
#8
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

The issue here is compatibility between LABELS in the code and TABLES in the database.

You can call a database table anything you like (conforming of course to MySQL protocols).

Then you just need to make sure that references in the php (or other) code accurately use that table name.

But you should have no need to alter table names or code. You just need to alter the define constants for language descriptives.

20 Nov 2009, 3:02 PM
#9
gob33 avatar

gob33

New Zenner

Join Date:
Jun 2008
Location:
Bordeaux, France
Posts:
69
Plugin Contributions:
3

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

I just say bad tests are done relying on langage dependant text inside TABLE_CONFIGURE to determine DB_VERSION. Nobody had been advised NOT to change English text in TABLE_CONFIGURE for localisation, and having so many options in English make merchants lost.

I think it was more simple to have the functions check_version_XXX() of 'zc_install\includes\classes\class.installer_version_manager.php' look directly in TABLE_PRODUCT_VERSION_HISTORY for the db-updates that have occured.

Making 1 or 2 checks in TABLE_CONFIGURATION does not mean
the last update has completely performed. Any SQL upgrade script can fail between its begin (update/insert into TABLE_CONFIGURATION) and
its end (upadte/insert into TABLE_PRODUCT_VERSION_HISTORY), so that you could have TABLE_CONFIGURATION up-to-date but not the others tables comming after.

Suppose a SQL failure, as it is, zc_install would find with check_version_XXX() that the last update has occured (but not completely in reality).

21 Nov 2009, 5:54 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

gob33, while I understand what you're saying, all your arguments are moot if whoever has translated the SQL code actually changed the database FIELD names.
If you want to translate descriptive text, feel free. But leave the underlying architecture alone.

21 Nov 2009, 1:50 PM
#11
gob33 avatar

gob33

New Zenner

Join Date:
Jun 2008
Location:
Bordeaux, France
Posts:
69
Plugin Contributions:
3

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

Ok guys, I re-explain in details as you didn't understand all the points. I take a concrete example of upgrading from 1.3.5

In 'zc_install\includes\classes\class.installer_version_manager.php', the code for checking this version is:

function check_version_135() {
  global $db_test;
  $got_v1_3_5 = false;
  $got_v1_3_5a = false;
  $got_v1_3_5b = false;

  //1st check for v1.3.5
  $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='PRODUCT_LIST_PRICE_BUY_NOW'";
  $result = $db_test->Execute($sql);
  if (ZC_UPG_DEBUG==true) echo "135a-configkey_check PRODUCT_LIST_PRICE_BUY_NOW =" . $result->fields['configuration_title'] . '<br>';
  if  ($result->fields['configuration_title'] == 'Display Product Add to Cart Button (0=off; 1=on; 2=on with Qty Box per Product)') {
    $got_v1_3_5a = true;
  }

  //2nd check for v1.3.5
  $sql = "select configuration_title from " . DB_PREFIX . "configuration where configuration_key='PRODUCT_LIST_ALPHA_SORTER'";
  $result = $db_test->Execute($sql);
  if (ZC_UPG_DEBUG==true) echo "135b-configkey_check PRODUCT_LIST_ALPHA_SORTER =" . $result->fields['configuration_title'] . '<br>';
  if  ($result->fields['configuration_title'] == 'Include Product Listing Alpha Sorter Dropdown') {
    $got_v1_3_5b = true;
  }

  if (ZC_UPG_DEBUG==true) {
    echo '1.3.5a='.$got_v1_3_5a.'<br>';
    echo '1.3.5b='.$got_v1_3_5b.'<br>';
  }
  // evaluate all 1.3.5 checks
  if ($got_v1_3_5a && $got_v1_3_5b ) {
    $got_v1_3_5 = true;
    if (ZC_UPG_DEBUG==true) echo '<br>Got 1.3.5<br>';
  }
  return $got_v1_3_5;
} //end of 1.3.5 check

In our ZC.1.3.8aFR Full, all English text of 'zc_install\sql\mysql_zencart.sql' has been translated to have all config-options displayed in French.

Here an example for PRODUCT_LIST_ALPHA_SORTER [original, translation]:

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Include Product Listing Alpha Sorter Dropdown', 'PRODUCT_LIST_ALPHA_SORTER', 'true', 'Do you want to include an Alpha Filter dropdown on the Product Listing?', '8', '50', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Inclure la liste de classement alphabétique de produits', 'PRODUCT_LIST_ALPHA_SORTER', 'true', 'Voulez-vous inclure la liste de classement alphabétique de produits?', '8', '50', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now());

There NO modification on SQL core, FIELDS names and TABLE names are untouched. Only the text has changed.
So the function check_version_135() always return FALSE for us (as Polish and Italians I suppose) because of :

if  ($result->fields['configuration_title'] == 'Include Product Listing Alpha Sorter Dropdown') {
  $got_v1_3_5b = true;
}

Tests like this one are absolutely english dependant and the db-update process is bad for anyone that has TABLE_CONFIGURE translated.

QUESTION: Why a test like the following one was not sufficient ?

function check_version_135() {
  global $db_test;
  $got_v1_3_5 = false;

  //check for v1.3.5
  $sql = "select project_version_date_applied from " . DB_PREFIX . "project_version_history where project_version_key = 'Zen-Cart Database' and project_version_major='1' and project_version_major='3.5' and project_version_comment='Version Update 1.3.0.2->1.3.5'";
  $result = $db_test->Execute($sql);
  if (ZC_UPG_DEBUG==true) echo "135-date_applied =" . $result->fields['project_version_date_applied'] . '<br>';
  if ($result->RecordCount() > 0) {
    $got_v1_3_5 = true;
    if (ZC_UPG_DEBUG==true) echo '<br>Got 1.3.5<br>';
  }
  return $got_v1_3_5;
} //end of 1.3.5 check
21 Nov 2009, 4:28 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

gob33:

Tests like this one are absolutely english dependant and the db-update process is bad for anyone that has TABLE_CONFIGURE translated.Okay, I see your point. You had explained it differently the first time.
I understand now.
gob33:

QUESTION: Why a test like the following one was not sufficient ?The inspections look for individual new features added, not merely whether a certain version step was "attempted". We've seen cases where people incorrectly apply upgrade patches, thus resulting in more serious problems caused by skipped statements.

We will revisit the matter for future upgrades with respect to translations.

Thanks for your patience.

21 Nov 2009, 5:54 PM
#13
gob33 avatar

gob33

New Zenner

Join Date:
Jun 2008
Location:
Bordeaux, France
Posts:
69
Plugin Contributions:
3

Re: zc_install doesnt recognize my 1.3.8 database during upgrade (specific languages)

Ok, now you got it. The first time, I have not looked deeply in the code, just have seen the message 'Your version is 1.3.0.2'. I had also difficulties to explain my ideas in English.

By making 2 checks only in TABLE_CONFIGURE doesn't mean the full upgrade has been applied too.

Think of it for future versions (1.3.9?)...