Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1054 - Unknown column 'p.products_id' in 'on clause'


blauwie

Recommended Posts

I have read several threads about the 1054 - Unknown column 'p.products_id' in 'on clause' issue. I have installed a template and this problem appeared directly. So, I haven't had the problem of an unforeseen SQL upgrade.

 

So when I click on 'categories' of my website/template, I get the following problem:

 

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join 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 = '1' and p2c.categories_id = '57'

 

When I read several threads about this problem, they all advise that one should find in index.php the following code: // show the products of a specified manufacturer untill (int)$current_category_id . And that one has to replace this code by another one.

 

However, in my index.php there doesn't exist such a sentence. So can anyone help me to fix this problem?

Link to comment
Share on other sites

The query you show does not appear to be in any recent release of standard osC, so it must be something by your template's author. The place you were told to look is not for this code.

 

Any way, the corrected query would be

select count(p.products_id) as total from ((products_description pd, products p) left join
manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join
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 = '1' and 
p2c.categories_id = '57'

Unfortunately, you will need to do some sleuthing to find the PHP code that generates this particular query (it won't appear in exactly that form). You might try scanning your .php files for count(p.products_id) as total from or left join specials s on p.products_id etc. -- eventually you'll find it. Or, you can just scan your .php files for left join and fix all of them (putting parentheses around comma-separated lists of table names to the left of "join" commands).

 

The utility "grep" is wonderful for scanning lists of files. It's free and comes from the GNU project, running on Linux and Unix (its birthplace) as well as Windows. It can recursively search directories and searches on a "regular expression", not just a fixed search string.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...