Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


pitune

Recommended Posts

got a error when im make a Subcategories:

 

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

 

select distinct p.products_id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from products p left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c left join manufacturers mnf on p.manufacturers_id = mnf.manufacturers_id left join reviews rvw on p.products_id = rvw.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '42' and p.products_status = '1' order by p.products_date_added desc limit 9

 

 

the product is showing in its categori, but the main categorie is showing this error...

whats going on here.... can fin anything about it.........

Link to comment
Share on other sites

Maybe if you select it in the first place the on clause will know where it's coming from:

 

select distinct p.products_id, p.manufacturers.id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from products p left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c left join manufacturers mnf on p.manufacturers_id = mnf.manufacturers_id left join reviews rvw on p.products_id = rvw.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '42' and p.products_status = '1' order by p.products_date_added

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Maybe if you select it in the first place the on clause will know where it's coming from:

 

select distinct p.products_id, p.manufacturers.id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from products p left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c left join manufacturers mnf on p.manufacturers_id = mnf.manufacturers_id left join reviews rvw on p.products_id = rvw.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '42' and p.products_status = '1' order by p.products_date_added

 

 

Maybe if you select it in the first place the on clause will know where it's coming from:

 

sorry dont now what you mean.... can you please explian a littel better....

Link to comment
Share on other sites

The unknown column 'p.manufacturers_id' was not listed in the SELECT portion of the MySQL query that you posted, so I posted a version of that same query that does have 'p.manufacturers_id' listed.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

The unknown column 'p.manufacturers_id' was not listed in the SELECT portion of the MySQL query that you posted, so I posted a version of that same query that does have 'p.manufacturers_id' listed.

 

oki now i understand....

 

but do you hafe a idea where it is missing for ist in the index file.........and there is many files to look in......

Link to comment
Share on other sites

oki now i understand....

 

but do you hafe a idea where it is missing for ist in the index file.........and there is many files to look in......

 

 

got the error here is in /includes/modules/new_products.php...

 

i got the better product contribution installet but somthing is wrong...

 

think there is something here: $new_products_query = $rndChooser; tep_db_query($sql);

but not sure that is the only thing there is.......

 

 

 

here is it can figurere it out

<!-- new_products //-->

<?php

//SET THE QUERYS

$sql_query[0] = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_ordered asc limit " . MAX_DISPLAY_NEW_PRODUCTS);

$sql_query[1] = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_last_modified desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

$sql_query[2] = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_quantity desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

$sql_query[3] = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_available desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

$sql_query[4] = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added asc limit " . MAX_DISPLAY_NEW_PRODUCTS);

// get a random number

$randomize = rand(0, 4);

$rndChooser = $sql_query[$randomize];

?>

 

 

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

// new noborderBox($info_box_contents);

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

$sql = "select distinct p.products_id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join ".TABLE_SPECIALS." s on p.products_id = s.products_id left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id where p.products_status = '1' order by p.products_date_added desc limit ".MAX_DISPLAY_NEW_PRODUCTS;

$new_products_query = $rndChooser; tep_db_query($sql);

 

 

} else {

 

$sql = "select distinct p.products_id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS;

$new_products_query = $rndChooser; tep_db_query($sql);

}

 

 

$row = 0;

$col = 0;

$info_box_contents = array();

echo '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>';

 

while ($new_products = tep_db_fetch_array($new_products_query)) {

 

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

 

$reviews_rating = $new_products['reviews_rating'];

$manufacturers_name = $new_products['manufacturers_name'];

 

if(!$manufacturers_name==null){

$manufacturers_name = '<strong><font face="Arial" size="2">Mfr:</font></strong> '.$manufacturers_name;

} else {

$manufacturers_name = '';

}

 

if(!$reviews_rating==null){

$reviews_rating = '<img src="images/stars_'. $new_products['reviews_rating'].'.gif" alt="'.$new_products['reviews_rating'] . TABLE_HEADING_TEXT_OF_5_STARS . ' ('.$new_products['products_name'].')" border="0" align="absmiddle">';

}else {

$reviews_rating = '<img src="images/stars_0.gif" alt="Not Rated" border="0" align="absmiddle"><br><span class="smallText"><a href="product_reviews_write.php?products_id='.$new_products['products_id'].'">' . TABLE_HEADING_FIRST_TO_RATE . '</a></span>';

}

 

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="20%" valign="top"',

'text' => ' <!-- one TBL Product -->

<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">

<tr>

<td bgcolor="#FFFFFF" class="main" height="37"><img src="images/lk_blue.gif" width="15" height="15" align="absmiddle" alt="'.$new_products['products_name'] .'"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></td>

</tr>

<tr>

<td bgcolor="#FFFFFF">

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td align="center" style="padding:3px;"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>

<td height="125%" valign="top">

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="17" class="smallText"><br>' . $manufacturers_name . '</td>

</tr>

<tr>

<td height="17" class="smallText"><b><br>' . TABLE_HEADING_PRICE . ': <font color="#FF5C02">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])). '</font></b></td>

</tr>

<tr>

<td height="17" class="smallText"><b><br>' . TABLE_HEADING_RATING . ': </b>'.$reviews_rating.'</td>

</tr>

</table>

</td>

</tr>

<tr>

<td>' . tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td>

<td height="30"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW) . '</a>

</tr>

</table>

</td>

</tr>

</table>

 

 

<!-- one TBL Product -->');

 

$col ++;

if ($col > 2) {

$col = 0;

$row ++;

}

}

 

new contentBox($info_box_contents);

//echo $info_box_contents[0][0]['text'];

?>

 

 

<!-- new_products_eof //-->

Link to comment
Share on other sites

There are two queries I would look at, specifically try changing

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
  $sql = "select distinct p.products_id, p.products_image,  p.products_model, p.products_tax_class_id, if(s.status,  s.specials_new_products_price, p.products_price) as products_price,  mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . "  p left join ".TABLE_SPECIALS." s on p.products_id = s.products_id left  join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id =  mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id =  rvw.products_id where p.products_status = '1' order by  p.products_date_added desc limit ".MAX_DISPLAY_NEW_PRODUCTS;
	  $new_products_query = $rndChooser; tep_db_query($sql); 


  } else {

  $sql = "select distinct p.products_id, p.products_image,  p.products_model, p.products_tax_class_id, if(s.status,  s.specials_new_products_price, p.products_price) as products_price,  mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . "  p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id,  " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c  left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id =  mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id =  rvw.products_id where p.products_id = p2c.products_id and  p2c.categories_id = c.categories_id and c.parent_id = '" .  (int)$new_products_category_id . "' and p.products_status = '1' order  by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS;
 $new_products_query = $rndChooser; tep_db_query($sql); 
	}

to

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
  $sql = "select distinct p.products_id, <span class="postcolor">p.manufacturers_id, </span>p.products_image,  p.products_model, p.products_tax_class_id, if(s.status,  s.specials_new_products_price, p.products_price) as products_price,  mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . "  p left join ".TABLE_SPECIALS." s on p.products_id = s.products_id left  join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id =  mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id =  rvw.products_id where p.products_status = '1' order by  p.products_date_added desc limit ".MAX_DISPLAY_NEW_PRODUCTS;
	  $new_products_query = $rndChooser; tep_db_query($sql); 


  } else {

  $sql = "select distinct p.products_id, <span class="postcolor">p.manufacturers_id, </span>p.products_image,  p.products_model, p.products_tax_class_id, if(s.status,  s.specials_new_products_price, p.products_price) as products_price,  mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . "  p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id,  " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c  left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id =  mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id =  rvw.products_id where p.products_id = p2c.products_id and  p2c.categories_id = c.categories_id and c.parent_id = '" .  (int)$new_products_category_id . "' and p.products_status = '1' order  by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS;
 $new_products_query = $rndChooser; tep_db_query($sql); 
	}

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...