Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Titles on index category pages.


dburchm1

Recommended Posts

Hi, found this little trick to get unique titles on the index page when you click though the categories, so the title isn't the same on every page.

 

On the index.php page change the title line to:

 

<title><?php echo TITLE; ?> <?php echo $categories['categories_name']; ?> Online Catalog</title>

 

The $categories['categories_name']; var comes from the application top bread crumb trail. When you click through the categories on the index page it puts the category name into the title.

Link to comment
Share on other sites

  • Replies 72
  • Created
  • Last Reply

This is a good tip, but, when you do this, for some reason even if you have input the page titles in capital letters, like: AMD BASE UNITS, it defaults at that page to read: Amd Base Units

 

Steve

Link to comment
Share on other sites

Taking this one step further, using this code;

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

makes all the other pages take on the page 'title', or rather the text used in the breadcrumb navigation.

Link to comment
Share on other sites

Taking this one step further, using this code;

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

makes all the other pages take on the page 'title', or rather the text used in the breadcrumb navigation.

However, this does not work on 'product_info.php' as the "HEADING_TITLE" is not used. Instead use;

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

Link to comment
Share on other sites

On 'product_info.php' I installed the Header Tags Controller admin

http://www.oscommerce.com/community/contributions,207 and then used this code on the page

  if (isset($products_id)) {

$product_info = tep_db_query("select p.products_id, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag 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);

 

 

}

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

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

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

<meta name="description" content="<?php echo $product_info_values['products_head_desc_tag']; ?>">

 

 

on

Link to comment
Share on other sites

Guys,

 

I achieved what you are looking for by doing this :

 

In application_top.php :

 

Around

 

require(DIR_WS_CLASSES . 'breadcrumb.php');

$breadcrumb = new breadcrumb;

 

Add

 

$page_title = '';

 

After

 

$breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));

 

Add

 

$page_title = $categories['categories_name'];

 

After

 

$breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));

 

Add

 

$page_title = $manufacturers['manufacturers_name'];

 

Modify the model query to include products_name

 

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

 

Then after the breadcrumb ->add insert

 

$page_title = $model['products_name'];

 

Now in both default.php and product_info.php change

 

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

 

to

 

<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>

 

Its good, n'est pas?

Link to comment
Share on other sites

Alex

 

Cool. I like that one because its soooo simple. Now no one has an excuse for not having a unique title on every page. I see a lot of nice graphic designs on OSC shops, but they have the same title on every page. If you go through the /catalog folder you can work on the titles on other page too.

 

I went through setting up the header tags controller contrib(above) because I wanted to have precise control on my titles, keyword and description meta tags on the product pages. It was a lot of work to go back through the catalog and set those all up and I don't have a lot of products. This is a great way for someone with a lot of products, who is looking for something quick and dirty to get unique titles. I think it really helps for search engine placement, especially google, to have unique titles. I can find a lot of google searches where my site comes up first or very high when people search for a specific product.

 

Dan

Link to comment
Share on other sites

I'm glad you like it.

 

Dan,

 

While I admire your scrupulous attention to detail I rather fear that your hard work may have been in vain as I have it on good authority that few search engines these days use the meta tags during their indexing of your site. This was decided because of gross misuse by porn/viagra peddlers et al. The most recent articles that I have read indicate that the <title></title> tags are used and the page contents parsed for relevance. What is important is that the first few lines/paragraph contain the most relevant information about the page in question. Therefore it is important that you don't put a lot of "textural padding" like a disclaimer at the top of the page but put the most relevant information about your product there.

 

Hope that is of some assistance.

 

Regards

Alex.

Link to comment
Share on other sites

I can't generally disagree with the META issue, but keep in mind that there are SE's that do still use the description Meta under many circumstances.

 

Search on Yahoo for: electronic dart boards

 

Out of the top 4 listings (didn't look further), 1,2 and 4 have the Meta description tag, and that is what Yahoo displays as the description for the result. # 3 doesn't, because they don't have the Meta description at all.

#2 has actually changed their description since Yahoo crawled that pafge, and you'd need to look at the Yahoo cached version to see the description tag actually displayed currently in the results.

 

So, the Meta description IS a handy way to get the description you want in the search results.

Actually, if you look at those top 4 results, the description of the three with one looks much better than the one without it.

 

How useful is it actually for ranking? Who knows as Yahoo is a new animal, but Yahoos 'new' search technology will be powering Yahoo Search, AllTheWeb and Altavista, so I wouldn't yet discount that description Meta tag.

Link to comment
Share on other sites

I'm kinda new to OSC, so please bear with me. I made all the mods except one and titles are not appearing correctly - I still get the site name as the title. Can someone tell me where the default.php file is?

Link to comment
Share on other sites

I do not understand what to do at these two steps -

 

Modify the model query to include products_name

 

 

QUOTE

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

 

 

 

Then after the breadcrumb ->add insert

 

 

QUOTE

$page_title = $model['products_name'];

 

 

Can you explain these 2 steps a little for me?

Link to comment
Share on other sites

The model query originally does not include the column "products_name" and does not join with the table TABLE_PRODUCTS_DESCRIPTION, you need to modify the query as such. Search for the string "$model_query" in the file.

 

The breadcrumb trail is an object which is populated with values by calling the method called "add", search for the string "breadcrumb->add". You should add the new code "$page_title = $model['products_name'];" after this line.

 

Hope that helps.

(don't add the double-quotes, I just added those for annotation purposes)

 

Regards

Alex.

Link to comment
Share on other sites

I cant seem to get the code placed from Alex Bath's information..I keep getting a parse error when I place

$page_title = $model['products_name'];
In application_top.php...Just exactly where does this go?

The Hobby Undergound..."For The Pure Hobbyist"

Link to comment
Share on other sites

What would I add in index.php to get the same result as this below?

 

QUOTE

$page_title = $model['products_name'];

 

Now in both default.php and product_info.php change

 

QUOTE

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

 

to

 

QUOTE

<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>

 

Thanks

SeminoleFan

Link to comment
Share on other sites

Speaking of titles.. do you guys know how to clean this up in my source:

 

<!-- Page layout by Simple Template System (STS) v2.01 on osCommerce 2.2-MS2 - http://www.diamondsea.com/sts/ -->

<!-- Using Template File [includes/sts_template.html) -->

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- BOF: Generated Meta Tags -->

<title> Find Barcode Labels, Barcode Printers, Thermal Transfer Labels and Zebra Printers Here! </title>

<META NAME="Description" Content="Purchase Barcode Printers, Barcode Labels, Thermal Transfer Labels, and Zebra Printers at AdaZon. ">

<META NAME="Keywords" CONTENT=" barcode printers, barcode labels, zebra printers, thermal transfer labels, thermal transfer printers, barcode scanners, Sato printers, datamax printers, intermec scanners, symbol scanners, thermal transfer ribbons, barcode ribbons">

<!-- EOF: Generated Meta Tags -->

 

I have 2 contributions added. One is STS and the other is Header Tag Controller. The title><title has an unwanted space in front and behind the actual words. I cannot get rid of them. I also want the title to be right under the <head> Is that possible?

Laser labels, barcode labels, custom labels

Link to comment
Share on other sites

Guys,

 

I achieved what you are looking for by doing this :

 

In application_top.php :

 

Around

 

require(DIR_WS_CLASSES . 'breadcrumb.php');

$breadcrumb = new breadcrumb;

 

Add

 

$page_title = '';

 

After

 

$breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));

 

Add

 

$page_title = $categories['categories_name'];

 

After

 

$breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));

 

Add

 

$page_title = $manufacturers['manufacturers_name'];

 

Modify the model query to include products_name

 

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

 

Then after the breadcrumb ->add insert

 

$page_title = $model['products_name'];

 

Now in both default.php and product_info.php change

 

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

 

to

 

<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>

 

Its good, n'est pas?

Hello,

I am using ms2 max can you tell me where I would find this in ms2 max

 

Now in both default.php and product_info.php change

 

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

 

to

 

<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>

 

I looked in the index.php and product_info.php and cannot find this.

 

Thank you <_<

Link to comment
Share on other sites

I implemented Alex's idea, and it works great, with one exception: when on the front page, instead of the title being 'MYSTORE', it is now 'MYSTORE - '.

In order to fix this, make the following small changes:

 

Whereever you added $page_title, such as

$page_title = $manufacturers['manufacturers_name'];

replace it with

$page_title = $manufacturers['manufacturers_name'].' - ';

And then, in Index.php and in product_info.php, place the following:

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

or better yet,

<title><?php echo TITLE.$page_title; ?></title>

(Though I haven't tried the second option, in ought to work)

 

This way, the hyphen is part of the variable, and isn't displayed when not needed.

 

-Ethan

Link to comment
Share on other sites

For the BTS users out there, I was able to make Alex's changes in about 2 minutes and it works great.

 

Thanks for the great solution.

My advice comes in two flavors- Pick the one that won't offend you.

 

Hard and Cynical: How to Make a Horrible osCommerce Site

 

Warm and Fuzzy: How to Make an Awesome osCommerce Site

Link to comment
Share on other sites

I have tried this change and it works but i have gone about it differently

and get the same result.

what i am trying to get is to have the parrent categorie displayed also

 

catagorie>subcatagorie>model

 

somthing like this in the title bar i applied these changes and it anly diplays current catagorie or model

Link to comment
Share on other sites

I have tried this change and it works but i have gone about it differently

and get the same result.

what i am trying to get is to have the parrent categorie displayed also

 

catagorie>subcatagorie>model

 

somthing like this in the title bar i applied these changes and it anly diplays current catagorie or model

nice idea

Link to comment
Share on other sites

I tried this with the

$page_title = $categories['categories_name'].'-';

modifcation but the page titles came up like

Store - Product -- Internet Explorer
so I swapped the dash code around to this;
$page_title = ' - '.$categories['categories_name'];

and it looks fine now.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...