Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dynamic Page Title


horizon70s

Recommended Posts

Posted

I'm wondering if it's possible to have the page title match the product listing for each page. Say you're selling a "blue 4 inch widget"...for the page title to read "blue 4 inch widget". Currently the static page title does very little for search engines, and I'm wondering if anyone has worked with an issue such as this.

 

Happy New Year to everyone!

Posted

there is Linda's header tags controller that can do this... it adds new tables to the database for titles, meta tags, etc...:

http://www.oscommerce.com/community/contri...ions,207/page,4

 

there is one that mirrors the breadcrumb trail in the title:

http://www.oscommerce.com/community/contributions,302

 

and then there is the one that I use, that uses the product info already in the database to create meta tag descriptions, keywords, and page title... though I can't find it... I've looked all through the contributions and its not there... hope Linda didn't have Harold kill it when he was re-organizing the contributions :wink:

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Posted
Sorry for this question....but what is the breadcrumb trail?

 

 

 

 

 

...yes I searched.  :oops:  :wink:

 

It's the trail in the top nav bar that usually reads something like:

 

Top >> Catalog >> (Category) >> (Subcategory) >> (Product)

 

Each one is called a "breadcrumb", and most of the time each one is a clickable entity to take you to that point in your "trail".

 

Aodhan

Posted

I'm not sure if I can explain what I'm after clearly but I'll try.

 

What I would like to do (have seen it done somewhere before but forgotten where! :?: ) is to copy the BreadCrumb, to the product title... and the section where it says 'Let's See What We Have Here'

 

Thanks in advance to whoever can help me with this...

 

Tony

"The price of success is perseverance. The price of failure comes much cheaper."

  • 3 weeks later...
Posted
and then there is the one that I use, that uses the product info already in the database to create meta tag descriptions, keywords, and page title..

Joshua or anyone,

Did you manage to track down this contribution?

It seems like a very pragmatic approach (and an approach I have used o other non-osc sites). I'm currently using Linda's contrib but is means doing a weekly sql update to copy across the title information to the extra fields because I don't have the time to keep them updated manually.

Posted

harald removed it from the contributions section for some reason or another...

 

it was just a text file and here it is:

I've implemented 'dynamic' Meta Tags by using the title of the products and the description of the product.  

 

In product_info.php find:  

 

$location = ''; (its about line 17)  

 

Directly after it add:  

 

Code:  

 

if (isset($products_id)) {  

   $product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");  

   $product_info_values = tep_db_fetch_array($product_info);  

 

   $keywords = strip_tags($product_info_values['products_description']);  

   $keywords = substr($keywords, 0, 250);  

}  

 

 

 

Find the <title> </title> line and replace it with:  

 

Code:  

 

<title><?php echo TITLE; ?> | <?php echo $product_info_values['products_name']; ?></title>  

 

 

Directly after your new title line, add:  

 

Code:  

 

<meta name="keywords" content="<?php echo $product_info_values['products_name']; ?> | <?php echo TITLE; ?>">  

<meta name="description" content="<?php echo $keywords; ?>">  

 

 

 

No work, and a good solution. All you have to do is make sure you give your product a good descriptive name, and a great description...

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Posted

I never contributed it, as IMO simple textual changes that don't require more than one file changed are not worthy of being contributed.

 

It's as easy to search the forum and apply the changes.

Posted

Ah yes that's what tips and tricks is for but somehow I missed this one.

It might be worth adding something like this after the keyword string is created:

	

// get rid of common words

$keywords=str_replace(" the ", " ",strtolower($keywords));

$keywords=str_replace(" a "," ",$keywords);

$keywords=str_replace(" and "," ",$keywords);

$keywords=str_replace(" in "," ",$keywords);

// separate with commas

$meta_array=explode(' ',$keywords);

$keywords=implode($meta_array,',');

although I don't think search engines bother too much about the commas these days (or even the keywords come to that)

  • 1 month later...
Posted

dreamscape, burt;

 

I also am using burt's dynamic header tags hack and I am perfectly satisfied with the ease of using it and the output it generates.

 

Is there a way to continue using this and to get some dynamic meta keywords and description on pages such as category and sub-category?

 

I've added description and keyword tags to the index.php page, but it remains the same (of course) when I move to a category, sub-category or manufacturers page (i.e. anything that still references index.php)

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Posted
Is there a way to continue using this and to get some dynamic meta keywords and description on pages such as category and sub-category?

 

Only way would be if you had the "category descriptions" contribution installed as then you would be able to draw off the description to create the meta tags.

 

What I have done is made one .php file named meta.php, uploaded into catalog/includes

 

On each page (other than product_info.php), I then call the include. When I want to update the metas across the site, I only have one file to change then.

 

I'm not sure that the use of Metas really helps with any search engines that matter - though that is my opinion only!

 

hth

Posted

Thanks for the reply, burt.

 

I tend to agree with you about the diminishing value of META tags with most search engines.

 

I think p'haps I'll just set a hard-coded general site META for anything that works off the index.php page, leave your mod in place for the product_info pages and call it good!

 

:wink:

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Archived

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

×
×
  • Create New...