Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing page title and head to product name?


Guest

Recommended Posts

Posted

Can someone please tell me if this can be done? I would like to have the title and the head of the pages to have the product name in it

Posted

Hi,

 

Open up product_info.php and place this code

 

  $product_top_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_rrp, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and m.manufacturers_id = p.manufacturers_id and pd.language_id = '" . $languages_id . "'");

 $product_top = tep_db_fetch_array($product_top_query);

 

above this line at the top of the page

 

require('includes/application_top.php');

 

Then replace the title line with

 

<title><?php echo $product_top['products_name']; ?></title>

 

Back up before you try!

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Posted

You can also check here for a solution that does not require an additional DB query.

 

Another point is that you don't have to add the query, which is performed lower on the page. Instead, you can move the other query up in the page.

 

Hth,

Matt

Posted

I could not get this to work can someone please help me out

Posted

Rumble misspoke. You would want to add that line *after* the application_top.php require, since the tep_db_query won't work otherwise.

 

Since you didn't give us any other information, like error messages, that's the best with which I can come up.

 

Hth,

Matt

Archived

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

×
×
  • Create New...