Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help - Query to return Manu Name on Product_Info


James Quest

Recommended Posts

Since y'all have been extremely helpful with my previous problem I thought I'd try to see if I could go two for two!

 

I need to get the contents of the MANUFACTURERS_NAME field from the MANUFACTURERS table on the Product_Info page. Right now it returns the MANUFACTURER_ID which is also posted in the PRODUCT table...so I need some code that basically says:

 

select MANUFACTURERS_NAME from TABLE_MANUFACTURERS where MANUFACTURERS_ID = P.MANUFACTURERS_ID (read in on previous query of PRODUCT table)...

 

Any thoughts? (I know this should be rather simple, but, for some reason I am having trouble).

 

Thanks!

Jim

Link to comment
Share on other sites

Here's part of the top of a product_info page that does this ...

  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);

 if ($product_check['total'] < 1) {
   $the_product_name = '';
 } else {
	 $the_product_info_query = tep_db_query("select pd.products_name, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'" . " and pd.language_id ='" .  (int)$languages_id . "'"); 
   $the_product_info = tep_db_fetch_array($the_product_info_query);
  $the_product_name = strip_tags ($the_product_info['products_name'], "");
  $the_man_info_query = tep_db_query("select m.manufacturers_name from " . TABLE_MANUFACTURERS . " m where m.manufacturers_id = '$the_product_info[manufacturers_id]' "); 
   $the_man_info = tep_db_fetch_array($the_man_info_query);
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo ' « ' . $the_man_info['manufacturers_name'] . ' ' . $the_product_name . ' » ' . TITLE; ?></title>

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...