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:
Code:
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]:
Code:
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 :
Code:
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 ?
Code:
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
Bookmarks