If you have attempted to install Wishlist 3.5 on a server running MySQL 5 you may have received the following error
1054 - Unknown column ‘p.products_id’ in ‘on clause’
According to the standard, the comma
operator has lower precedence than any of the JOIN variants.
Thus the query:
select * from t1, t2 join t3 on a=b;
actually means:
select * from t1, (t2 join t3 on a=b);
Since (according to ANSI SQL) column names in an ON
condition are resolved against the join operands (t2, t3 in
this case), then the first query above must produce a
name resolution error, because there is no column ‘a’ in
tables t2, t3.
On the other hand the query:
select * from (t1, t2) join t3 on a=b;
means that the whole cross-product (t1, t2) is the left
join operand. Consequently column ‘a’ in the ON
condition can be resolved against the table (t1, t2).
All this is described in the latest 5.0 manual:
http://dev.mysql.com/doc/refman/5.0/en/join.html
therefore:
catalog/wishlist.php around line 50
replace $products_query with the following
$products_query = tep_db_query(”
SELECT pd.products_id,
pd.products_name,
pd.products_description,
p.products_image,
p.products_status,
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)
LEFT JOIN ” . TABLE_SPECIALS . ” s
ON (p.products_id = s.products_id)
WHERE pd.products_id = ‘” . $product_id . “‘ AND p.products_id = pd.products_id AND pd.language_id = ‘” . $languages_id . “‘ order by products_name”);
and in file catalog/includes/boxes/wishlist.php
near line 45 replace $products_query with the following
$products_query = tep_db_query(”
SELECT pd.products_id,
pd.products_name,
pd.products_description,
p.products_image,
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)
LEFT JOIN ” . TABLE_SPECIALS . ” s
ON (p.products_id = s.products_id)
WHERE pd.products_id = ‘” . $wishlist_id . “‘ AND p.products_id = pd.products_id AND pd.language_id = ‘” . $languages_id . “‘ order by products_name”);





Excellent. I did not have to change the boxes portion. But your solution solved my problem. Thank you.
Comment by Auntie22 — January 11, 2008 @ 9:59 pm
Correction, this post did correct both my 1054 - Unknown column ‘p.products_id’ in ‘on clause’ issues in both wishlist.php listed above. Thank you again. Excellent, Excellent work.
Comment by Auntie22 — January 11, 2008 @ 10:09 pm
Your welcome Auntie22 here to help if you have any other problems with PHP5 use the forum and start a thread. I will be happy to help.
Comment by Frank — January 14, 2008 @ 9:13 pm