Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Page titles...how?


on2dvd

Recommended Posts

How do you set page titles to anything other than the default? Not good for search engines.

 

I do beleive there is a contribution out for this.

 

Here is the quick one I use. It has been a long day and I'm not sure if I posted this correctly so make sure you back up first (this should go without saying). In product_info.php try putting the code below before the html:

 

<!-- begin dynamic meta tags query-->
<?php
$the_product_info_query = tep_db_query("select pd.language_id, 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_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_product_description = strip_tags ($the_product_info['products_description'], "");
$the_product_model = strip_tags ($the_product_info['products_model'], "");
?>
<?php
$the_manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
  $the_manufacturers = tep_db_fetch_array($the_manufacturer_query);
?>
<!-- end dynamic meta tags query added -->

 

Then put this where the title and metatags normally go:

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>

<!-- begin dynamic meta tags  -->
<title><?php echo TITLE ?>: <?php echo $the_product_name; ?></title>
<meta name="keywords" content="<?php echo TITLE ?>, <?php echo $the_product_name; ?>, <?php echo $the_product_model; ?>, <?php echo $the_manufacturers['manufacturers_name']; ?>">
<meta name="description" content="<?php echo $the_product_description . "," . $the_product_name . "," . $the_manufacturers['manufacturers_name']; ?>">
<!-- end dynamic meta tags  -->

Shade and Sweet Water

Chris Czerniak

Link to comment
Share on other sites

How do you set page titles to anything other than the default? Not good for search engines.
The main reason to have unique titled in a site is for the search engines. So, assuming that is important to you (and it should be), you should avoid short-cuts and install Header Tags. It is optimized for the SE's and will give you the best results, in my opinion.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

I do beleive there is a contribution out for this.

 

Here is the quick one I use. It has been a long day and I'm not sure if I posted this correctly so make sure you back up first (this should go without saying). In product_info.php try putting the code below before the html:

 

<!-- begin dynamic meta tags query-->
<?php
$the_product_info_query = tep_db_query("select pd.language_id, 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_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_product_description = strip_tags ($the_product_info['products_description'], "");
$the_product_model = strip_tags ($the_product_info['products_model'], "");
?>
<?php
$the_manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
  $the_manufacturers = tep_db_fetch_array($the_manufacturer_query);
?>
<!-- end dynamic meta tags query added -->

 

Then put this where the title and metatags normally go:

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>

<!-- begin dynamic meta tags  -->
<title><?php echo TITLE ?>: <?php echo $the_product_name; ?></title>
<meta name="keywords" content="<?php echo TITLE ?>, <?php echo $the_product_name; ?>, <?php echo $the_product_model; ?>, <?php echo $the_manufacturers['manufacturers_name']; ?>">
<meta name="description" content="<?php echo $the_product_description . "," . $the_product_name . "," . $the_manufacturers['manufacturers_name']; ?>">
<!-- end dynamic meta tags  -->

 

Hey, that worked, thanks so much :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...