Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I put products_description in the <title>


NameSeek

Recommended Posts

Posted

I want to use the product description as my page title in product_info.php. I tried replacing:

 

<title><?php echo TITLE; ?></title>

 

with:

 

<title> <?php echo $product_info['products_description']; ?> </title>

 

But that does not work. Can someone show me the correct code ?

 

Thanks - Cindy

Posted

You have the right idea, but $product_info doesn't get generated after the TITLE. You just need to move the query up higher in the code.

 

Around line 72 in product_info.php look for:

 

 ? $product_info_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_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id 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_info = tep_db_fetch_array($product_info_query);

 

Move those to lines of code up to the top of the file inside the very first php tag, right under the '$product_check' line of code.

 

You can then use your code

 

<title> <?php echo $product_info['products_description']; ?> </title>

I'd rather be flying!

Posted

hi.

 

I'll give you code for adding product name in title, if you want product description just change the code following this "receipt"

 

1. product_info.php

 

just after

 

  $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);

 

we add

 

  $product_info_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_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id 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_info = tep_db_fetch_array($product_info_query);

 

so now

 

<title><?php echo TITLE; ?></title>

 

has to be changed to

 

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

 

 

all thnx 2 pionas

Archived

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

×
×
  • Create New...