Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show manufacturers name


zlack

Recommended Posts

Mattreicher pm'd me how to display the manufacturer and i though some ppl might find it usefull.

 

 

// Products manufacturer 

function tep_get_products_manufacturer($product_id) { 

$products_manufacturer_query = tep_db_query("SELECT manufacturers_id FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . $product_id . "'"); 

$products_manufacturer = tep_db_fetch_array($products_manufacturer_query); 

$manufacturer_query = tep_db_query("SELECT manufacturers_name FROM " . TABLE_MANUFACTURERS . " WHERE manufacturers_id = '" . $products_manufacturer['manufacturers_id'] . "'"); 

$manufacturer = tep_db_fetch_array($manufacturer_query); 



return ($manufacturer['manufacturers_name'] == "" ? "N/A" : $manufacturer['manufacturers_name']); 

}

 

 

Then you can call it with:

 

<?php echo tep_get_products_manufacturer($products_id); ?>

It's easier to remember, then to forget

Link to comment
Share on other sites

  • 2 weeks later...

Archived

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

×
×
  • Create New...