Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

error after login


n7wwk

Recommended Posts

:'( After loging in as wholesale customer. I get

1052 - Column 'products_id' in from clause is ambiguous

 

select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s LEFT JOIN products_groups pg using (products_id, customers_group_id) where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '1' and s.status = '1' and s.customers_group_id= '1' order by s.specials_date_added desc limit 10

 

[TEP STOP]

 

in the right side box then the page is normal with

My account

Shopping cart

Best Sellers

 

I can not locate what is causing the error, Possibly Specials.php

Link to comment
Share on other sites

1052 - Column 'products_id' in from clause is ambiguous

 

select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s LEFT JOIN products_groups pg using (products_id, customers_group_id) where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '1' and s.status = '1' and s.customers_group_id= '1' order by s.specials_date_added desc limit 10

Totally bizar error IMO because it should be perfectly clear for MySQL what products_id stands for in using (products_id, customers_group_id). Probably a bug in your version (I don't have it and use MySQL 5.0.21). I found a similar case so this work-around might do the trick. The query is the same, just a different syntax. Try changing it to (in catalog/includes/boxes/specials.php, after the else) to:

$random_product = tep_random_select("select p.products_id, pd.products_name, IF(pg.customers_group_price IS NOT NULL,pg.customers_group_price, p.products_price) as products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg on (s.products_id = pg.products_id and s.customers_group_id = pg.customers_group_id) where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' and s.customers_group_id= '".$customer_group_id."' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS);

So the using (products_id, customers_group_id) is changed in the (longer) on (s.products_id = pg.products_id and s.customers_group_id = pg.customers_group_id).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...