Forums / Setting Up Categories, Products, Attributes / 1054 Unknown column 'p.products_id' in 'on clause'

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

Locked

Views: 35,381

Results 1 to 20 of 31
This thread is locked. New replies are disabled.
3 Jun 2006, 9:17 PM
#1
jeffnord avatar

jeffnord

New Zenner

Join Date:
Apr 2005
Posts:
16
Plugin Contributions:
0

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

When ever I go to select a category from the main screen or when I try to select an individual product in viewing all products I get this error message: 1054 Unknown column 'p.products_id' in 'on clause'

I'm not the only one with admin rights and I'm not sure what the other person could have done to cause this error.

Does anyone have any idea what this error is and how I can fix it? I can no longer view any products in the catelog.

Any help would be appreciated.

Thanks,

Jeff Nordgren

4 Jun 2006, 3:59 PM
#2
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,927
Plugin Contributions:
3

Re: 1054 Unknown column 'p.products_id' in 'on clause'

This problem is usually caused by using mysql5 with zc v1.2.x. If this problem has recently shown up after your site has been working with no problems, then the likelihood is that your Host has upgraded mysql. If that is the case then I would be complaining to my host.

Mysql5 uses a much stricter SQL interpreter and some queries in ZC v1.2.7 and earlier will fail. Fixes were introduced into ZC v1.3.0 to fix this.

4 Jun 2006, 9:25 PM
#3
jeffnord avatar

jeffnord

New Zenner

Join Date:
Apr 2005
Posts:
16
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

Wilt,

Thanks for the information.

I upgraded to zc 1.3 and that seemed to fix the problem.

Thanks again,

Jeff

19 Jun 2006, 1:36 PM
#4
vanhooffmodelbouw avatar

vanhooffmodelbouw

New Zenner

Join Date:
Jul 2005
Posts:
21
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

I have the same problem, in the category products i get the message: 1054 Unknown column 'p.products_id' in 'on clause'. My host has upgraded to SQL 5. See https://www.vanhooffmodelbouw.nl

But i am a bit anxious to upgrade my zencart version, because i made a lot of custumizations a while ago.

Is there any simple (temporary) solution to fix this problem.

19 Jun 2006, 5:38 PM
#5
vanhooffmodelbouw avatar

vanhooffmodelbouw

New Zenner

Join Date:
Jul 2005
Posts:
21
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

I fixed it, i used the help off this thread: forums.oscommerce.nl/index.php?showtopic=6565. I added some brackets in the default_filter file (in the includes/index_filter map).

22 Jun 2006, 12:15 PM
#6
scrapgabbie avatar

scrapgabbie

Inactive

Join Date:
Jan 2004
Posts:
57
Plugin Contributions:
1

Re: 1054 Unknown column 'p.products_id' in 'on clause'

please could you paste the code here, with instructions in english? l have the same problem with my new install, but my norweigian is not that good LOL ;-)

22 Jun 2006, 4:39 PM
#7
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

Please note that osCommerce and Zen Cart are not the same but do use some of the same functions. The Bug Fix to make osCommerce compatable with MySQL 5 is listed in full here:

oscommerce.com/ext/update-20051112.html#_Toc119473702

It may help to show you what you need to do to make your version of Zen Cart compatable with MySQL 5. If you can upgrade to the latest vrsion of Zen Cart then do so, and this should also fix the problem.

Vger

27 Aug 2007, 2:27 PM
#8
linkedla avatar

linkedla

New Zenner

Join Date:
Mar 2005
Location:
Bogotá, Colombia
Posts:
32
Plugin Contributions:
1

Re: 1054 Unknown column 'p.products_id' in 'on clause'

I got this error:

1054 Unknown column 'c.parent_id' in 'on clause'
in:
[SELECT c.categories_id as id, c.parent_id, cd.categories_name as cName, cd2.categories_name as pName FROM zce_categories c, zce_categories_description cd LEFT JOIN zce_categories_description cd2 ON c.parent_id=cd2.categories_id AND cd2.language_id='2' WHERE c.categories_id=cd.categories_id AND cd.language_id='2']

I did upgrade to the latest ZenCart 1.3.7 and the MySQL was upgraded to from 4 to 5, now i have did everything you say exept the OsCommerce thing because I am not proficient on the SQL management.
Anyway after the upgrading all seems to be the same, also the original install was 1.3.1 so I think there is something else.
Please HELP.
the site URL is https://www.electrogeno.com

Thanks in advance for your help.

Visit https://www.colombianhandcrafts.org, we are in the fair trade move!

13 Dec 2007, 12:34 PM
#9
erik89 avatar

erik89

New Zenner

Join Date:
Nov 2005
Posts:
3
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

I get the 1054 error message when I open the attributes controller in the admin area.
I have searched through many forums, but they didn't help.
I cannot update from zc 1.26 to 1.3.x because I have made many changes in the design of the shop.
Does someone know what I have to do so it works again?
Thanks for answers!

13 Dec 2007, 1:06 PM
#10
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

You will have to update. Most hosts will upgrade to PHP5 soon, and 1.2.x will not run on it. Upgrade now or you will regret later.

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

13 Dec 2007, 3:27 PM
#11
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: 1054 Unknown column 'p.products_id' in 'on clause'

alot of hosts are making the jump to mysql5 at the same time they go to php5

this will cause issues with sites under 1.3.6 ( have to upgrade the /includes/functions/sessions.php )

You should always plan on having to upgrade at some time:
as technology changes, things go obsolete

this is the reason that the developers built in the over rides folders and pages, as well as the auto loading functions,

Zen cart PCI compliant Hosting

13 Dec 2007, 4:12 PM
#12
erik89 avatar

erik89

New Zenner

Join Date:
Nov 2005
Posts:
3
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

I will begin with the upgrade as soon as possible, but I haven't much time for it right now. So it will take 4-5 weeks until I can start upgrading. But now I want to add some attributes to some of my products in my zen-cart store and need to know what I have to do with the source code in the admin area so it works.
Thanks!

13 Dec 2007, 5:09 PM
#13
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: 1054 Unknown column 'p.products_id' in 'on clause'

you dont understand it WONT work

Zen cart PCI compliant Hosting

13 Dec 2007, 5:16 PM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 1054 Unknown column 'p.products_id' in 'on clause'

There is an unsupported patch for v1.2.6 and v1.2.7 at the following site, which can be used to do partial bridging for a limited number of MySQL5 features.
Use at your own risk.
http://download.dataweb.no/

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

24 Feb 2008, 9:13 AM
#15
robo avatar

robo

New Zenner

Join Date:
Nov 2004
Posts:
3
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

OK, I'm on Zen Cart 1.2, MySQL 5, I've fixed the error by updating the file includes/index_filters/default_filter.php, which is the equivalent of index.php that people mention in this thread:

forums.oscommerce.com/index.php?showtopic=230304

Here's what I changed:

From:

      if (isset($_GET['filter_id']) && zen_not_null($_GET['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 = '1', s.specials_new_products_price, NULL) AS specials_new_products_price, IF(s.status = '1', s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order 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)$_GET['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and p2c.categories_id = '" . (int)$_GET['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 = '1', s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = '1', s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order 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)$_SESSION['languages_id'] . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'";
      }
    } else {
// show the products in a given categorie
      if (isset($_GET['filter_id']) && zen_not_null($_GET['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 = '1', s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = '1', s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order 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)$_GET['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$_SESSION['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 = '1', s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status ='1', s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order 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)$_SESSION['languages_id'] . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
      }

To:

      if (isset($_GET['filter_id']) && zen_not_null($_GET['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 = '1', s.specials_new_products_price, NULL) AS specials_new_products_price, IF(s.status = '1', s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p2c.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and p2c.categories_id = '" . (int)$_GET['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 = '1', s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = '1', s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order from ". TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p 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)$_SESSION['languages_id'] . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'";
      }
    } else {
// show the products in a given categorie
      if (isset($_GET['filter_id']) && zen_not_null($_GET['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 = '1', s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = '1', s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p2c.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$_SESSION['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 = '1', s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status ='1', s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order 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 p2c.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)$_SESSION['languages_id'] . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
      }

In particular, I changed the 1st, 3rd, and 4th query from p.products_id = s.products_id to p2c.products_id = s.products_id. In the 2nd query, I changed the FROM clause table select order from TABLE_PRODUCTS, TABLE_PRODUCTS_DESCRIPTION, TABLE_MANUFACTURERS to TABLE_PRODUCTS_DESCRIPTION, TABLE_MANUFACTURERS, TABLE_PRODUCTS.

Are there any other places in Zen Cart that I'll need to update? In this OSCommerce thread, post #6:

forums.oscommerce.com/index.php?showtopic=230304

It says the advanced_search_result.php file needs to be updated, but in Zen Cart that file doesn't contain any SQL code. What's the equivalent Zen Cart file that I need to update?

18 Mar 2008, 11:28 PM
#16
jewelee65 avatar

jewelee65

New Zenner

Join Date:
Jun 2005
Posts:
2
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

In /public_html/yoursite.com/includes/modules/meta-tags.php

I changed:

from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd on mtpd.products_id

TO:

from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd on mtpd.products_id

Line 163

That seemed to do the trick to get all products to show up error free.

Good Luck!! Have a great day.

18 Mar 2008, 11:50 PM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: 1054 Unknown column 'p.products_id' in 'on clause'

jewelee65:

In /public_html/yoursite.com/includes/modules/meta-tags.php

I changed:

from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd on mtpd.products_id

TO:

from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd on mtpd.products_id

Line 163

That seemed to do the trick to get all products to show up error free.That will bandage one of about 30 different problems you'll encounter when trying to run Zen Cart v1.2.x on MySQL 5.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 Mar 2008, 6:34 PM
#18
jewelee65 avatar

jewelee65

New Zenner

Join Date:
Jun 2005
Posts:
2
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

I know.......have had to find quite a few other files with problems in the select statements. Still working out the bugs. We are planning to upgrade, just for the security issues alone, but are trying to hang in there until 1.4 comes out.

The fix above seemed to clear up quite a few problems with products though.

6 May 2008, 1:12 AM
#19
flyspirit avatar

flyspirit

New Zenner

Join Date:
May 2008
Posts:
3
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

Robo:

OK, I'm on Zen Cart 1.2, MySQL 5, I've fixed the error by updating the file includes/index_filters/default_filter.php, which is the equivalent of index.php that people mention in this thread:

forums.oscommerce.com/index.php?showtopic=230304

Here's what I changed:

the real search SQL code is in includes/block/blk_advanced_search_result.php, you can change like this

$from_str = "from (((" . TABLE_PRODUCTS . " p) left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c) left join " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd on mtpd.products_id= p.products_id and mtpd.language_id = '" . $_SESSION['languages_id'] . "'";

For other changes need to be made, please look at my blog flyspirit99.blogspot.com/2008/05/1054-unknown-column-pproductsid-in-on.html

6 May 2008, 1:27 AM
#20
flyspirit avatar

flyspirit

New Zenner

Join Date:
May 2008
Posts:
3
Plugin Contributions:
0

Re: 1054 Unknown column 'p.products_id' in 'on clause'

The real search SQL code is in includes/block/blk_advanced_search_result.php now