Support
Database
Possible issues with OSCommerce and MySQL5
We
have been made aware that some customers may have
issues with their OSCommerce installations after
your recent upgrade to MySQL5.
To
solve this, two files in the installation directory
need to be changed. the first set of changes are
needed to index.php.
Remove
the code below from that file ...
//
show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id']))
{
if (isset($HTTP_GET_VARS['filter_id']) &&
tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
$listing_sql = "select " . $select_column_list
. " p.products_id, p.manufacturers_id, p.products_price,
p.products_tax_class_id, IF(s.status, s.specials_new_products_price,
NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price)
as final_price from " . TABLE_PRODUCTS .
" p, " . TABLE_PRODUCTS_DESCRIPTION
. " pd, " . TABLE_MANUFACTURERS . "
m, " . TABLE_PRODUCTS_TO_CATEGORIES . "
p2c left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id where p.products_status
= '1' and p.manufacturers_id = m.manufacturers_id
and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id']
. "' and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id
= '" . (int)$HTTP_GET_VARS['filter_id'] .
"'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list
. " p.products_id, p.manufacturers_id, p.products_price,
p.products_tax_class_id, IF(s.status, s.specials_new_products_price,
NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price)
as final_price from " . TABLE_PRODUCTS .
" p, " . TABLE_PRODUCTS_DESCRIPTION
. " pd, " . TABLE_MANUFACTURERS . "
m left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id where p.products_status
= '1' and pd.products_id = p.products_id and pd.language_id
= '" . (int)$languages_id . "' and p.manufacturers_id
= m.manufacturers_id and m.manufacturers_id =
'" . (int)$HTTP_GET_VARS['manufacturers_id']
. "'";
}
} else {
// show the products in a given categorie
if (isset($HTTP_GET_VARS['filter_id']) &&
tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
$listing_sql = "select " . $select_column_list
. " p.products_id, p.manufacturers_id, p.products_price,
p.products_tax_class_id, IF(s.status, s.specials_new_products_price,
NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price)
as final_price from " . TABLE_PRODUCTS .
" p, " . TABLE_PRODUCTS_DESCRIPTION
. " pd, " . TABLE_MANUFACTURERS . "
m, " . TABLE_PRODUCTS_TO_CATEGORIES . "
p2c left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id where p.products_status
= '1' and p.manufacturers_id = m.manufacturers_id
and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id']
. "' and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id
= '" . (int)$current_category_id . "'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list
. " p.products_id, p.manufacturers_id, p.products_price,
p.products_tax_class_id, IF(s.status, s.specials_new_products_price,
NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price)
as final_price from " . TABLE_PRODUCTS_DESCRIPTION
. " pd, " . TABLE_PRODUCTS . "
p left join " . TABLE_MANUFACTURERS . "
m on p.manufacturers_id = m.manufacturers_id,
" . TABLE_PRODUCTS_TO_CATEGORIES . "
p2c left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id where p.products_status
= '1' and p.products_id = p2c.products_id and
pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id
= '" . (int)$current_category_id . "'";
}
}
Replace
the code with this :-
// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id']))
{
if (isset($HTTP_GET_VARS['filter_id']) &&
tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
$listing_sql = "select " . $select_column_list
. " p.products_id, p.manufacturers_id, p.products_price,
p.products_tax_class_id, IF(s.status, s.specials_new_products_price,
NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price)
as final_price from (" . TABLE_PRODUCTS .
" p, " . TABLE_PRODUCTS_DESCRIPTION
. " pd, " . TABLE_MANUFACTURERS . "
m, " . TABLE_PRODUCTS_TO_CATEGORIES . "
p2c ) left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id where p.products_status
= '1' and p.manufacturers_id = m.manufacturers_id
and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id']
. "' and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id
= '" . (int)$HTTP_GET_VARS['filter_id'] .
"'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list
. " p.products_id, p.manufacturers_id, p.products_price,
p.products_tax_class_id, IF(s.status, s.specials_new_products_price,
NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price)
as final_price from (" . TABLE_PRODUCTS .
" p, " . TABLE_PRODUCTS_DESCRIPTION
. " pd, " . TABLE_MANUFACTURERS . "
m) left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id where p.products_status
= '1' and pd.products_id = p.products_id and pd.language_id
= '" . (int)$languages_id . "' and p.manufacturers_id
= m.manufacturers_id and m.manufacturers_id =
'" . (int)$HTTP_GET_VARS['manufacturers_id']
. "'";
}
} else {
// show the products in a given categorie
if (isset($HTTP_GET_VARS['filter_id']) &&
tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
$listing_sql = "select " . $select_column_list
. " p.products_id, p.manufacturers_id, p.products_price,
p.products_tax_class_id, IF(s.status, s.specials_new_products_price,
NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price)
as final_price from (" . TABLE_PRODUCTS .
" p, " . TABLE_PRODUCTS_DESCRIPTION
. " pd, " . TABLE_MANUFACTURERS . "
m, " . TABLE_PRODUCTS_TO_CATEGORIES . "
p2c) left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id where p.products_status
= '1' and p.manufacturers_id = m.manufacturers_id
and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id']
. "' and p.products_id = p2c.products_id
and pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id
= '" . (int)$current_category_id . "'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list
. " p.products_id, p.manufacturers_id, p.products_price,
p.products_tax_class_id, IF(s.status, s.specials_new_products_price,
NULL) as specials_new_products_price, IF(s.status,
s.specials_new_products_price, p.products_price)
as final_price from ((" . TABLE_PRODUCTS_DESCRIPTION
. " pd, " . TABLE_PRODUCTS . "
p) left join " . TABLE_MANUFACTURERS . "
m on p.manufacturers_id = m.manufacturers_id,
" . TABLE_PRODUCTS_TO_CATEGORIES . "
p2c) left join " . TABLE_SPECIALS . "
s on p.products_id = s.products_id where p.products_status
= '1' and p.products_id = p2c.products_id and
pd.products_id = p2c.products_id and pd.language_id
= '" . (int)$languages_id . "' and p2c.categories_id
= '" . (int)$current_category_id . "'";
}
}
The second line that needs editing is advanced_search_results.php
Remove
the following code .....
$from_str
= "from " . TABLE_PRODUCTS . "
p left join " . TABLE_MANUFACTURERS . "
m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION
. " pd left join " . TABLE_SPECIALS
. " s on p.products_id = s.products_id, "
. TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES
. " p2c";
Replace
it with this .....
$from_str
= "from ((" . TABLE_PRODUCTS . "
p) left join " . TABLE_MANUFACTURERS . "
m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION
. " pd) left join " . TABLE_SPECIALS
. " s on p.products_id = s.products_id, "
. TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES
. " p2c";
Return
to category list