SEO Friendly Titles on Product and Index Pages

Here is a simple one step method to add SEO Friendly titles to the product pages, category listing and the main page of OSCommerce.

use for OSCommerce versions: 2.2rc2a and 2.3

To have the product name as the title on the product page, open product_info.php.
Between the head tags find:

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

change to:

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

That’s it.

To add the category name to the category listings on index.php (main page):

Open index.php

} else {
$category_depth = 'products'; // category has no products, but display the 'no products' message

add just beneath

//pull category info for CAT and SUBCAT, META-INFO
$category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");
$category = tep_db_fetch_array($category_query); 
//define title
if (tep_not_null($category['categories_name'])) {
$title = $category['categories_name'] ; 
} else {
$title = STORE_NAME.' more text if desired';

Posted in SEO

2 thoughts on “SEO Friendly Titles on Product and Index Pages

  1. Thanks a lotttttttttt 🙂 what about if we want to add title with the product name on products details page?

Comments are closed.