Quobit

Gadgets, tecnología y estilo de vida digital

OSCommerce, solución al error 1054 Unknown column ‘p.products_id’ in ‘on clause’

Si estas manejando OSCommerce y de pronto te encuentras con el error:

1054 – Unknown column ‘p.products_id’ in ‘on clause’

 

La solución es muy sencilla. En el archivo index.php busca el siguiente código:

// show the products of a specified manufacturer
   if (isset($HTTP_GET_VARS[‘manufacturers_id’])) {
     if (isset($HTTP_GET_VARS[‘filter_id’]) && tep_not_null($HTTP_GET_VARS[‘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, 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, » . 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)$HTTP_GET_VARS[‘manufacturers_id’] . «‘ and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = ‘» . (int)$languages_id . «‘ and p2c.categories_id = ‘» . (int)$HTTP_GET_VARS[‘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, 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, » . 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)$languages_id . «‘ and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = ‘» . (int)$HTTP_GET_VARS[‘manufacturers_id’] . «‘»;
     }
   } else {
// show the products in a given categorie
     if (isset($HTTP_GET_VARS[‘filter_id’]) && tep_not_null($HTTP_GET_VARS[‘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, 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, » . 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)$HTTP_GET_VARS[‘filter_id’] . «‘ and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = ‘» . (int)$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, 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_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)$languages_id . «‘ and p2c.categories_id = ‘» . (int)$current_category_id . «‘»;
     }
   }

 

Y reemplazalo por:

// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS[‘manufacturers_id’])) {
if (isset($HTTP_GET_VARS[‘filter_id’]) && tep_not_null($HTTP_GET_VARS[‘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, 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, » . 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)$HTTP_GET_VARS[‘manufacturers_id’] . «‘ and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = ‘» . (int)$languages_id . «‘ and p2c.categories_id = ‘» . (int)$HTTP_GET_VARS[‘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, 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, » . 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)$languages_id . «‘ and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = ‘» . (int)$HTTP_GET_VARS[‘manufacturers_id’] . «‘»;
}
} else {
// show the products in a given categorie
if (isset($HTTP_GET_VARS[‘filter_id’]) && tep_not_null($HTTP_GET_VARS[‘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, 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, » . 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)$HTTP_GET_VARS[‘filter_id’] . «‘ and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = ‘» . (int)$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, 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_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)$languages_id . «‘ and p2c.categories_id = ‘» . (int)$current_category_id . «‘»;
}
}

 

Después en el archivo advanced_search_result.php busca:

$from_str = «from » . TABLE_PRODUCTS . » p left join » . TABLE_MANUFACTURERS . » m using(manufacturers_id), » . TABLE_PRODUCTS_DESCRIPTION . » pd left join » . TABLE_SPECIALS . » s on p.products_id = s.products_id, » . TABLE_CATEGORIES . » c, » . TABLE_PRODUCTS_TO_CATEGORIES . » p2c»;

 

Y reemplazalo por:

 

$from_str = «from ((» . TABLE_PRODUCTS . » p) left join » . TABLE_MANUFACTURERS . » m using(manufacturers_id), » . TABLE_PRODUCTS_DESCRIPTION . » pd) left join » . TABLE_SPECIALS . » s on p.products_id = s.products_id, » . TABLE_CATEGORIES . » c, » . TABLE_PRODUCTS_TO_CATEGORIES . » p2c»;

Cualquier duda en los comentarios

 

1054 – Unknown column ‘p.products_id’ in ‘on clause’

¡Dejanos un comentario!

¡No olvides dejar un comentario!