Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Related Products 1054 error - help


steffanih

Recommended Posts

Hello, I am receiving this error after installing Related Products:

 

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

 

SELECT pop_products_id_slave, products_name, products_model, products_price, products_quantity, products_tax_class_id, products_image FROM products_related_products, products_description pa, products pb where p.products_id not in(33) and pop_products_id_slave = pa.products_id AND pa.products_id = pb.products_id AND language_id = '1' AND pop_products_id_master = '113' AND products_status='1' ORDER BY rand()

 

[TEP STOP]

 

It appears in my product info display. I believe I have loctade the code causing it in catalog/includes/modules/optional_related_products.php

but I'm not sure exactly what is causing it and what I may need to change to clear the error.

Thanks for any and all help!

 

  $orderBy = 'ORDER BY ';
 $orderBy .= (RELATED_PRODUCTS_RANDOMIZE)?'rand()':'pop_order_id, pop_id';
 $orderBy .= (RELATED_PRODUCTS_MAX_DISP)?' limit ' . RELATED_PRODUCTS_MAX_DISP:'';
 $attributes = "
        SELECT
        pop_products_id_slave,
        products_name,
        products_model,
        products_price,
        products_quantity,
        products_tax_class_id,
        products_image
        FROM " .
        TABLE_PRODUCTS_RELATED_PRODUCTS . ", " .
        TABLE_PRODUCTS_DESCRIPTION . " pa, ".
        TABLE_PRODUCTS . " pb
        WHERE pop_products_id_slave = pa.products_id
        AND pa.products_id = pb.products_id
        AND language_id = '" . (int)$languages_id . "'
        AND pop_products_id_master = '".$HTTP_GET_VARS['products_id']."'
        AND products_status='1' " . $orderBy;
 $attribute_query = tep_db_query($attributes);

 if (mysql_num_rows($attribute_query)>0) {
 $count = 0;

Link to comment
Share on other sites

I decided to try one of the earlier installs, moving back to the Feb 25th version as suggested elsewhere when trying to resolve 1054 issues on this contribution. Im back to the same thing, same error. This is the section of code it appears to be coming from in the earlier install. I have made the changes to index.php and advanced_search_result.php that claim to resolve 1054 problems, but I still receive the same 1054 error. Any clue as to what could be causing this prob or how to resolve it?

// DANIEL: begin - show related products

 $attributes = "select pop_products_id_slave, products_name, products_price, products_tax_class_id, products_image from " . TABLE_PRODUCTS_OPTIONS_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . " pa, ". TABLE_PRODUCTS . " pb WHERE pop_products_id_slave = pa.products_id and pa.products_id=pb.products_id and language_id = '" . (int)$languages_id . "' and pop_products_id_master = '".$HTTP_GET_VARS['products_id']."' and products_status=1 order by pop_order_id, pop_id";

 $attribute_query = tep_db_query($attributes);


Link to comment
Share on other sites

  • 2 years later...

I decided to try one of the earlier installs, moving back to the Feb 25th version as suggested elsewhere when trying to resolve 1054 issues on this contribution. Im back to the same thing, same error. This is the section of code it appears to be coming from in the earlier install. I have made the changes to index.php and advanced_search_result.php that claim to resolve 1054 problems, but I still receive the same 1054 error. Any clue as to what could be causing this prob or how to resolve it?

// DANIEL: begin - show related products

$attributes = "select pop_products_id_slave, products_name, products_price, products_tax_class_id, products_image from " . TABLE_PRODUCTS_OPTIONS_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . " pa, ". TABLE_PRODUCTS . " pb WHERE pop_products_id_slave = pa.products_id and pa.products_id=pb.products_id and language_id = '" . (int)$languages_id . "' and pop_products_id_master = '".$HTTP_GET_VARS['products_id']."' and products_status=1 order by pop_order_id, pop_id";

$attribute_query = tep_db_query($attributes);


 

I had the same problem which recently started showing up on my 2.3.1 install and this query fixes it:

$attributes = " SELECT pop_products_id_slave, products_name, products_model, products_price, products_quantity, products_tax_class_id, products_image FROM " . TABLE_PRODUCTS_RELATED_PRODUCTS . ", " . TABLE_PRODUCTS_DESCRIPTION . " pa, " . TABLE_PRODUCTS . " p WHERE pop_products_id_slave = pa.products_id AND pa.products_id = p.products_id AND language_id = '" . (int)$languages_id . "' AND pop_products_id_master = '" . $HTTP_GET_VARS['products_id']."' AND products_status='1' " . $orderBy;

Please notice the alias to TBLE_PRODUCTS just needs to be p not pb.

Thank you.

Link to comment
Share on other sites

  • 1 year later...

I am getting a different 1054 error. This just showed up today.

 

"1054 - Unknown column 'products_ready_to_ship' in 'field list'

SELECT products_ready_to_ship, products_ship_sep, products_weight FROM products WHERE products_id = 2538 LIMIT 1;

[TEP STOP]"

Link to comment
Share on other sites

Answering my own question. That is a first for me.

 

I found the problem. My shipping module for FedEx has a field called products_ready_to_ship. Removed module for now and the error message is gone. I bet I could write a SQL statement to add that field to the database?

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...