Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Meta Tags For Your osC Shop


toyicebear

Recommended Posts

Sounds like a pretty good and maintainable solution to me, but on which file do I need to replace the <title> tag? Or do I need to replace every single occurence on all php files??

 

 

The most important is:

 

index.php and product_info.php

 

But you will also have to modify any other .php file where you want meta tags to show.

Link to comment
Share on other sites

  • 2 months later...
  • Replies 184
  • Created
  • Last Reply
I did this for myself, if it helps

 

Adds dynamic page titles and meta info to osCommerce based on the existing breadcrumb so no extra queries.

 

Replace <title></title> with ..

 

<?php include(DIR_WS_INCLUDES . 'meta_info.php'); ?>

create a file called meta_info.php and place in catalog>includes.

 

File contains the following: -

 

<?php
/*
 $Id: meta_info.php,v 1.280 2003/07/12 09:38:07 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
/**********************************************
Modifications by ...
Robert Fisher aka Thunderace
**********************************************/

// This file uses the breadcrumb class to create SEO friendly page titles
$title = '';
$meta_description = '';
$meta_keywords = '';
$count = count($breadcrumb->_trail);
for ($i=0; $i<($count); $i++)
{
 if ($breadcrumb->_trail[$i]['title'] != HEADER_TITLE_TOP && $breadcrumb->_trail[$i]['title'] != HEADER_TITLE_CATALOG)
 {
 $title .= $breadcrumb->_trail[$i]['title'] . ' | ';
 $meta_description .= $breadcrumb->_trail[$i]['title'] . ' | ';
 $meta_keywords .= $breadcrumb->_trail[$i]['title'] . ', ';
 if ($i == ($count-1))
 {
 //$shop_name is hardcoded if you wish to add your shop name to the end of <title> and meta info
 $shop_name = 'My Shop';
 $title .= $shop_name;
 $meta_description .= $shop_name;
 $meta_keywords .= $shop_name;
 }
 }
 }
 if ($title == '') {
//below are hardcoded to show meta info when no breadcrumb exists
$title = 'My standard shop title';
$meta_description = 'My standard shop description';
$meta_keywords = 'My standard shop keywords';
 }
 //Display <title> and meta info
 echo '<title>' . $title . '</title>' . "\n";
 echo '<meta name="description" content="' . $meta_description . '" />' . "\n";
 echo '<meta name="keywords" content="' . $meta_keywords . '" />' . "\n";
 ?>

 

I applied this piece of code, together with the <A href="http://www.oscommerce.com/community/contributions,4354/category,all/search,breadcrumb">breadcrum contribution</A>and it works beautifully!

 

However, I was wondering how to add other meta tags to my webshop, like abstract, author, language, revisit and robots meta tags. Some of these (like author and language) would be identical for all webpages, so I presume I could just add these to the php scripts in the catalog folder?

 

One other question. Could there perhaps be a way to add custom meta keywords to the category and product pages? Probably I am asking too much, since this wonderful peace of code automatically generates meta keywords, but if there were a way add custom meta keywords per product and category, it would be so nice....

 

thanks for the great contribution!

 

Mike Emmessen

Link to comment
Share on other sites

I applied this piece of code, together with the <A href="http://www.oscommerce.com/community/contributions,4354/category,all/search,breadcrumb">breadcrum contribution</A>and it works beautifully!

 

However, I was wondering how to add other meta tags to my webshop, like abstract, author, language, revisit and robots meta tags. Some of these (like author and language) would be identical for all webpages, so I presume I could just add these to the php scripts in the catalog folder?

 

One other question. Could there perhaps be a way to add custom meta keywords to the category and product pages? Probably I am asking too much, since this wonderful peace of code automatically generates meta keywords, but if there were a way add custom meta keywords per product and category, it would be so nice....

 

thanks for the great contribution!

 

Mike Emmessen

 

abstract, author, language, revisit and robots meta tags.

 

These were left out because tbh they are useless (not used by SEs), so I wouldn't bother.

 

Language is best defined in <html> to my knowledge .. e.g.

 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en_GB">

 

Could there perhaps be a way to add custom meta keywords to the category and product pages? Probably I am asking too much, since this wonderful peace of code automatically generates meta keywords, but if there were a way add custom meta keywords per product and category, it would be so nice.

 

My meta tag script is basic but does what I require of it, if you need more control then there are excellent far more powerful solutions in the contribs area.

 

Header Tags Controller is excellent and being written by Jack_mcs it's bound to be good code.

 

Hope that helps.

Link to comment
Share on other sites

I applied this piece of code, together with the <A href="http://www.oscommerce.com/community/contributions,4354/category,all/search,breadcrumb">breadcrum contribution</A>and it works beautifully!

 

However, I was wondering how to add other meta tags to my webshop, like abstract, author, language, revisit and robots meta tags. Some of these (like author and language) would be identical for all webpages, so I presume I could just add these to the php scripts in the catalog folder?

 

One other question. Could there perhaps be a way to add custom meta keywords to the category and product pages? Probably I am asking too much, since this wonderful peace of code automatically generates meta keywords, but if there were a way add custom meta keywords per product and category, it would be so nice....

 

thanks for the great contribution!

 

Mike Emmessen

 

 

This tread is not a support tread for any contribution, just information about some of the available meta tags contributions and their install.

 

If you want more manual control, you can go back to the first page of this tread and read up on Header Tags Controller.

Link to comment
Share on other sites

  • 1 month later...

Its been a while since I've been back to this thread. I have had success with the code I've previously posted to generate the metatags for my shop. Now, I realize I need header tags.

 

I've downloaded the header tags 2.6.3 version. I did read back in this thread that just using the sql and catalog side of this would generate the header tags automatically for me. My fear is that I'll be messing my current metatag codes up.

 

Does anyone have this working for their sites? I'd love to have header tags show up, but I dont want to have to enter the info for every product.

 

Thank you in advance for your help!

Link to comment
Share on other sites

Its been a while since I've been back to this thread. I have had success with the code I've previously posted to generate the metatags for my shop. Now, I realize I need header tags.

 

I've downloaded the header tags 2.6.3 version. I did read back in this thread that just using the sql and catalog side of this would generate the header tags automatically for me. My fear is that I'll be messing my current metatag codes up.

 

Does anyone have this working for their sites? I'd love to have header tags show up, but I dont want to have to enter the info for every product.

 

Thank you in advance for your help!

 

 

Adding a new meta tags contribution will of-course remove all the meta tags info you have from before.

Link to comment
Share on other sites

I guess what I'm asking is this, is there an easier way to add some sort of header tags to the code I am already using without adding another meta tag contrib?

 

What are you referring to when you say "Header Tags" ?

 

 

The header tags controller does not add any special "header tags" , it adds meta tags.

Link to comment
Share on other sites

What are you referring to when you say "Header Tags" ?

 

 

The header tags controller does not add any special "header tags" , it adds meta tags.

 

Hmmm, I thought header tags were the <h1> and so on tags. And because I thought that, I assumed this contrib would create that sort of thing. I already have a decent enough meta tag thing going on.

 

I was hoping my sites would rank a little higher if I found some contrib to add the <h1> tags since it does not appear that my osc sites have them.

Link to comment
Share on other sites

Hmmm, I thought header tags were the <h1> and so on tags. And because I thought that, I assumed this contrib would create that sort of thing. I already have a decent enough meta tag thing going on.

 

I was hoping my sites would rank a little higher if I found some contrib to add the <h1> tags since it does not appear that my osc sites have them.

 

 

You can easily add h1 tags to the solution you already have....

 

1. add h1 definitions to you stylesheet, something like this:

 

h1 {

font-family: Verdana, Arial, sans-serif;

font-size: 20px;

font-weight: bold;

margin-bottom: 0;

padding-bottom: 0;

}

 

2. in any files where you want to use the tags, you can then just change the line which showes the heading:

 

Some examples:

 

Product_info.php

 

change:

 

<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>

<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>

 

To:

 

<td valign="top"><h1><?php echo $products_name; ?></h1></td>

<td align="right" valign="top"><h1><?php echo $products_price; ?></h1></td>

 

 

For other standard pages, something like this:

 

change:

 

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

 

to:

 

<td><h1><?php echo HEADING_TITLE; ?></h1></td>
Link to comment
Share on other sites

:P I just came back to tell you I decided to do it manually via the tags and css and you had the same idea! Well, at least your info will help others before they wander off into the land of confusion I just left!

 

Thanks so much for your help!

Link to comment
Share on other sites

  • 2 months later...

Easy Meta Tags is a automatic meta tags generator which gives basic but relevant meta tags for all your osCommerce powered web shop pages.

 

It works with osCommerce MS2.2 up to and included the latest RC1 version.

 

Instructions for install on shops using STS V4... is also included.

 

This is not in any way a replacement for the header tags controller which is a very fully featured solution with manual and automatic meta tags information and also includes several other extra features for your site.

 

But if you are uncomfortable with complex installs and/or have a modified and/or template based shop....it offers a very easy and quick install which most should be able to do by simply following the included instructions.

Link to comment
Share on other sites

  • 3 weeks later...
how can i customise the title of the home page withpout changeing the cat paghes?

 

 

you can install the latest version of easy meta tags , it lets you set the title, meta description and meta keywords for the front page only....

 

(All other titles and metas are generated automatically)

Link to comment
Share on other sites

2. C-Dynamic Meta Tags

 

This contribution incerts meta tags automatically for your shops products and categories (and new products, specials ++), in addition it lets you add meta tags for your index page and general tags manually.

 

The meta tags can also be cached for shortest possible execution time, lower server load and faster page load time.

 

Install

 

Install is very easy and straight forward.

 

I'm installing this addon as we speak, but I'm not sure if it'll work for me. I've already installed another contribution for search engine-friendly URLs, which required me to edit the code. I've now basically blindly added the code for the meta tag contrib, and I'm not sure if it's right:

 

 

  $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

// Ultimate SEO URLs v2.1 -- NOTE: This contrib was added first
// If the action will affect the cache entries
   if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');

# cDynamic Meta Tags  -- NOTE: This was added second (I kinda just stuck it in between other chunks of code)
 // If the action will affect the cache entries
 if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_meta_cache.php');

 if (tep_not_null($action)) {
   switch ($action) {
     case 'setflag':
       if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
         if (isset($HTTP_GET_VARS['pID'])) {
           tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);
         }

         if (USE_CACHE == 'true') {
           tep_reset_cache_block('categories');
           tep_reset_cache_block('also_purchased');
         }
       }

 

I tested the site, and it still functions (definitely a good thing) but I just want to check that this is still going to allow the meta tags contrib to work. Thanks for your help!

Link to comment
Share on other sites

I'm installing this addon as we speak, but I'm not sure if it'll work for me. I've already installed another contribution for search engine-friendly URLs, which required me to edit the code. I've now basically blindly added the code for the meta tag contrib, and I'm not sure if it's right:

  $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

// Ultimate SEO URLs v2.1 -- NOTE: This contrib was added first
// If the action will affect the cache entries
   if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');

# cDynamic Meta Tags  -- NOTE: This was added second (I kinda just stuck it in between other chunks of code)
 // If the action will affect the cache entries
 if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_meta_cache.php');

 if (tep_not_null($action)) {
   switch ($action) {
     case 'setflag':
       if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
         if (isset($HTTP_GET_VARS['pID'])) {
           tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);
         }

         if (USE_CACHE == 'true') {
           tep_reset_cache_block('categories');
           tep_reset_cache_block('also_purchased');
         }
       }

 

I tested the site, and it still functions (definitely a good thing) but I just want to check that this is still going to allow the meta tags contrib to work. Thanks for your help!

 

 

should be ok...

Link to comment
Share on other sites

  • 3 weeks later...
Hi Nick,

 

I tried to install your Basic Meta Tags and now only product pages are showing the product titles, the Category and Sub-Category pages are showing "HEADING_TITLE_NEW" instead. Any advise? thanks

 

 

Go through the install one more time and make sure you have done all the required changes.

Link to comment
Share on other sites

HI Jack,

I followed all the instructions for generating meta tags and added fields to product description.

 

Uploaded the files according to instruction and made the changes required to some files.

 

 

 

Now I can add meta tags in product update page in admin.

 

 

Problem is that when i click on any of those products i get this error:

 

Fatal error: Call to undefined function: clean_html_comments() in /homepages/4/d191950542/htdocs/includes/header_tags.php on line 79

 

 

 

and this is how line 79 looks like in includes/header_tags.php

else {

if ( HTTA_PRODUCT_INFO_ON=='1' ) {

(79) $the_title= HEAD_TITLE_TAG_ALL . ' ' . clean_html_comments($the_product_info['products_head_title_tag']);

} else {

 

 

I use v2.2

Can you help

Thanks,

Link to comment
Share on other sites

HI Jack,

I followed all the instructions for generating meta tags and added fields to product description.

 

Uploaded the files according to instruction and made the changes required to some files.

Now I can add meta tags in product update page in admin.

Problem is that when i click on any of those products i get this error:

 

Fatal error: Call to undefined function: clean_html_comments() in /homepages/4/d191950542/htdocs/includes/header_tags.php on line 79

and this is how line 79 looks like in includes/header_tags.php

else {

if ( HTTA_PRODUCT_INFO_ON=='1' ) {

(79) $the_title= HEAD_TITLE_TAG_ALL . ' ' . clean_html_comments($the_product_info['products_head_title_tag']);

} else {

I use v2.2

Can you help

Thanks,

 

Ask in the header tags support tread....

Link to comment
Share on other sites

Hi, I was wondering which meta contribution would you recommend for my ecommerce website with the type of product line I offer? I want to make sure I get good page ranks.

http://www.blackthorne.ca

 

 

Read this tread from page 1 and decide if you want automatic or manual meta tags for your shop.

Link to comment
Share on other sites

I did this for myself, if it helps

 

Adds dynamic page titles and meta info to osCommerce based on the existing breadcrumb so no extra queries.

 

Replace <title></title> with ..

 

<?php include(DIR_WS_INCLUDES . 'meta_info.php'); ?>

create a file called meta_info.php and place in catalog>includes.

 

File contains the following: -

 

<?php
/*
 $Id: meta_info.php,v 1.280 2003/07/12 09:38:07 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
/**********************************************
Modifications by ...
Robert Fisher aka Thunderace
**********************************************/

// This file uses the breadcrumb class to create SEO friendly page titles
$title = '';
$meta_description = '';
$meta_keywords = '';
$count = count($breadcrumb->_trail);
for ($i=0; $i<($count); $i++)
{
 if ($breadcrumb->_trail[$i]['title'] != HEADER_TITLE_TOP && $breadcrumb->_trail[$i]['title'] != HEADER_TITLE_CATALOG)
 {
 $title .= $breadcrumb->_trail[$i]['title'] . ' | ';
 $meta_description .= $breadcrumb->_trail[$i]['title'] . ' | ';
 $meta_keywords .= $breadcrumb->_trail[$i]['title'] . ', ';
 if ($i == ($count-1))
 {
 //$shop_name is hardcoded if you wish to add your shop name to the end of <title> and meta info
 $shop_name = 'My Shop';
 $title .= $shop_name;
 $meta_description .= $shop_name;
 $meta_keywords .= $shop_name;
 }
 }
 }
 if ($title == '') {
//below are hardcoded to show meta info when no breadcrumb exists
$title = 'My standard shop title';
$meta_description = 'My standard shop description';
$meta_keywords = 'My standard shop keywords';
 }
 //Display <title> and meta info
 echo '<title>' . $title . '</title>' . "\n";
 echo '<meta name="description" content="' . $meta_description . '" />' . "\n";
 echo '<meta name="keywords" content="' . $meta_keywords . '" />' . "\n";
 ?>

 

 

Gday - sorry if this is a silly question...

Where do you put:

<?php include(DIR_WS_INCLUDES . 'meta_info.php'); ?>

?

 

Do I replace the title tags in product_info.php ? or index.php or others ?

Thanks in advance

Link to comment
Share on other sites

Gday - sorry if this is a silly question...

Where do you put:

<?php include(DIR_WS_INCLUDES . 'meta_info.php'); ?>

?

 

Do I replace the title tags in product_info.php ? or index.php or others ?

Thanks in advance

 

Using the mod from Robert Fischer mentioned earlier in this tread you should do it for these 2 files atleast: index.php and product_info.php

 

change:

 

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

 

to

 

<?php include(DIR_WS_INCLUDES . 'meta_info.php'); ?>
Link to comment
Share on other sites

Using the mod from Robert Fischer mentioned earlier in this tread you should do it for these 2 files atleast: index.php and product_info.php

 

change:

to

 

Thanks - does this mean the tip listed (the one I quoted) was to be used as part of a contrib? I thought it was an alternative to the contrib> must have missed the point altogether.

 

Would be great for dumbos like me to have a thread that answered the 'which contrib is best' & 'which ones work together' or even 'what total SEO package works best' for urls, meta tags, headers etc.

 

I have read through what feel like hundreds of pages (always exaggerating!) & am still no wiser...

 

Have installed header tags for novices & was going to do a Google sitemap one just in the meantime while I try to figure out the best way to go...

This thread was probably the most helpful with the 'auto or manual meta tags' question & a few other tips so thanks to all concerned.

 

I guess SEO is no simple topic!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...