michael_s
09-21-2007, 06:54 PM
This solution was posted by Jean Pierre in the forums at: http://forums.oscommerce.com/index.php?s=&showtopic=70365&view=findpost&p=1079735
VERSIONS AFFECTED: Multistores version 2.0 (not v 1.9), any maybe only needed for mysql 5.xx and/or php 5.xx versions.
Problem: When clicking on the "New Products" button in the Specials page the following error occurs:
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 'pd where p.products_id = pd.products_id and pd.language_id = '1' order by prod' at line 1
select p.products_id, pd.products_name, p.products_price from (products p, products_description) pd where p.products_id = pd.products_id and pd.language_id = '1' order by products_name
[TEP STOP]
Solution: Edit catalog/admin/includes/function/general.php line 209 (The parenthesis ")" before "pd" should be AFTER "pd".)
Original code: $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " ) pd " . ($admin_allowed_stores[0] == '*' ? " " : " LEFT JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id ") . "where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' " . ($admin_allowed_stores[0] == '*' ? " " : " and p2s.stores_id in(" . implode(',' , $admin_allowed_stores) . ") ") . "order by products_name");
Corrected code: $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd )" . ($admin_allowed_stores[0] == '*' ? " " : " LEFT JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id ") . "where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' " . ($admin_allowed_stores[0] == '*' ? " " : " and p2s.stores_id in(" . implode(',' , $admin_allowed_stores) . ") ") . "order by products_name");
Thanks to Jean Pierre
Incidentally: This problem does not occur in Hobzilla's v 1.9. Line 209 in his file is as follows and also works:
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd " . ($admin_allowed_stores[0] == '*' ? " " : " LEFT JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id ") . "where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' " . ($admin_allowed_stores[0] == '*' ? " " : " and p2s.stores_id in(" . implode(',' , $admin_allowed_stores) . ") ") . "order by products_name");
File attached is precisely the same as this text
More... (http://addons.oscommerce.com/info/1730)
VERSIONS AFFECTED: Multistores version 2.0 (not v 1.9), any maybe only needed for mysql 5.xx and/or php 5.xx versions.
Problem: When clicking on the "New Products" button in the Specials page the following error occurs:
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 'pd where p.products_id = pd.products_id and pd.language_id = '1' order by prod' at line 1
select p.products_id, pd.products_name, p.products_price from (products p, products_description) pd where p.products_id = pd.products_id and pd.language_id = '1' order by products_name
[TEP STOP]
Solution: Edit catalog/admin/includes/function/general.php line 209 (The parenthesis ")" before "pd" should be AFTER "pd".)
Original code: $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " ) pd " . ($admin_allowed_stores[0] == '*' ? " " : " LEFT JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id ") . "where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' " . ($admin_allowed_stores[0] == '*' ? " " : " and p2s.stores_id in(" . implode(',' , $admin_allowed_stores) . ") ") . "order by products_name");
Corrected code: $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd )" . ($admin_allowed_stores[0] == '*' ? " " : " LEFT JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id ") . "where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' " . ($admin_allowed_stores[0] == '*' ? " " : " and p2s.stores_id in(" . implode(',' , $admin_allowed_stores) . ") ") . "order by products_name");
Thanks to Jean Pierre
Incidentally: This problem does not occur in Hobzilla's v 1.9. Line 209 in his file is as follows and also works:
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd " . ($admin_allowed_stores[0] == '*' ? " " : " LEFT JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id ") . "where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' " . ($admin_allowed_stores[0] == '*' ? " " : " and p2s.stores_id in(" . implode(',' , $admin_allowed_stores) . ") ") . "order by products_name");
File attached is precisely the same as this text
More... (http://addons.oscommerce.com/info/1730)