*[Done v1.6.0] Attributes controller fatal error after upgrade
Following upgrade to v1.51 I get the following error:
PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, 1, 'TEXT')' at line 1 :: INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES ((int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, 1, 'TEXT') in /home/myserver/public_html/mydomain.com/includes/classes/db/mysql/query_factory.php on line 120
when accessing either:
attributes controller
option names manager
option values manager
If I temporarily use the v1.50 php files for these 3 sources the problem does not occur. Looking at the difference between the two versions I think that v1.51 is checking for and finding errors in the database that v1.50 could not.
Any clue to where I should be looking is appreciated.
Re: Attributes controller fatal error after upgrade
Make the following changes:
Line 40:
/your_secret_admin_dir/attributes controller.php
Code:
if ((int)$languages[$i]['id'] > 0 && !in_array((int)$languages[$i]['id'], $ary)) {
// $db->Execute("INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES ((int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, " . (int)$languages[$i]['id'] . ", 'TEXT')");
$db->Execute("INSERT INTO " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) VALUES (" . (int)PRODUCTS_OPTIONS_VALUES_TEXT_ID . ", " . (int)$languages[$i]['id'] . ", 'TEXT')");
}
line 23:
/your_secret_admin_dir/option names manager.php
Code:
if ((int)$languages[$i]['id'] > 0 && !in_array((int)$languages[$i]['id'], $ary)) {
// $db->Execute("INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES ((int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, " . (int)$languages[$i]['id'] . ", 'TEXT')");
$db->Execute("INSERT INTO " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) VALUES (" . (int)PRODUCTS_OPTIONS_VALUES_TEXT_ID . ", " . (int)$languages[$i]['id'] . ", 'TEXT')");
}
line 28:
/your_secret_admin_dir/option values manager.php
Code:
if ((int)$languages[$i]['id'] > 0 && !in_array((int)$languages[$i]['id'], $ary)) {
// $db->Execute("INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES ((int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, " . (int)$languages[$i]['id'] . ", 'TEXT')");
$db->Execute("INSERT INTO " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) VALUES (" . (int)PRODUCTS_OPTIONS_VALUES_TEXT_ID . ", " . (int)$languages[$i]['id'] . ", 'TEXT')");
}
NOTE: Moved to Bug Reports
Re: Attributes controller fatal error after upgrade
That's it, all seems ok now.
Cheers
Re: Attributes controller fatal error after upgrade
Thanks for the update that this worked for you ...
It is one of those little typos on a built in fix to the database for a check of a missing record, and this bug will not affect very many many people at all, as they have no reason for this fix to run ...
Glad that you are set now ... :smile:
Re: Attributes controller fatal error after upgrade
Works for me - just in time too!
Re: Attributes controller fatal error after upgrade
i did this and now i get this
[14-Oct-2012 18:23:34] PHP Fatal error: 1062uplicate entry '0-1' for key 'PRIMARY' :: INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES (0, 1, 'TEXT') /public_html/includes/classes/db/mysql/query_factory.php on line 120
Re: Attributes controller fatal error after upgrade
Just wanted to add that Ajeh's original fixes for the 3 files worked for me.
Re: Attributes controller fatal error after upgrade
I want to bring something up i have a prefix zen_ so does that mean this file is looking in the wrong section??
Re: Attributes controller fatal error after upgrade
Quote:
Originally Posted by
lucidlee
Works for me - just in time too!
ok so where did i go wrong?
did i mess up the input of the code as shown above or is all that correct?
Re: Attributes controller fatal error after upgrade
Argh.
There's another bug. The original fix didn't take table-prefixes into account.
The fix is now included in Ajeh's post earlier: http://www.zen-cart.com/showthread.p...32#post1153132
This situation didn't show up in initial testing because the testing database didn't have two sets of data in it like Dashizna's does. (you should clean that up, BTW)