osCommerce: STS and Dynamic Meta Tags
OsCommerce is a great free ecommerce software. The plain vanilla release however has a few shortcommings but the ammount of released modifications makes it easy for anybody to modify it as you please. Sky’s the limit!
This article shows you how to use Simple Template System together with the cDynamic Meta Tags modification.
Simple Template System (STS)
OsCommerce vanilla release has no support for easy change of themes. Nobody wants a webshop looking like every other found on the net. STS makes it fairly easy to change the looks of your webshop just by changing a HTML template file.
This article uses v4.5.2 of STS. The latest version can be found here:
http://www.oscommerce.com/community/contributions,1524
Thanks to Chris “Rigadin2″ for his excellent work with this contribution.
cDynamic Meta Tags
There are quite a few mods for changing the osCommerce default meta tags. Dynamic Metatags however uses data from the Category and Product Names and aso the product description to produce meaningfull meta tags. This means less work for management as you don’t have to type in your own Tags and Titles.
This article uses Version 1.6. The latest version can be found here:
http://www.oscommerce.com/community/contributions,2895/
Thanks goes also to Chris LaRocque (azer, Glcustoms, Didier Debbaut and others) for their work with the Dynamic Meta Tags.
STS + cDynamic Meta Tags
The problem is that the Dynamic Meta Tags outputs the data direcly so it never seems to be catured by the STS. This modification enables the output from dynamic meta tags while STS is disabled and disables it when STS is enabled. The variables will instead be pulled from dynamic meta tags into the template.
Instructions
1.First of all install the two mentioned mods above.
2.Backup your files. Files that are going to be modified are:
- catalog\includes\meta_tags.php
- catalog\includes\modules\sts_inc\sts_user_code.php
- Your current template.
The standard is catalog\includes\sts_templates\test\sts_template.html
3. Open file catalog\includes\meta_tags.php
Find:
# Keywords
tep_not_null(HEAD_KEY_TAG_ALL)
? $key.='-'. STORE_KEYWORD
: NULL;
$metakeywords=strtolower(meta_create_meta_keywords($key));
}
After Add:
// Mod STS + cDynamic Meta Tags
// Check if STS is enabled or in test mode
if ((MODULE_STS_DEFAULT_STATUS == 'true') || (($_GET['sts_debug'] == MODULE_STS_DEBUG_CODE)))
{ }
else {
Find:
##################################### OUTPUT THE DATA ########################################## echo ' <title>'.$metatitle.'</title>' . "n"; echo ' <META NAME="Description" Content="' .$metadescription. '">' . "n"; echo ' <META NAME="Keywords" Content="' . $metakeywords . '">' . "n"; #####################################################################################################
After Add:
}
// END STS + cDynamic Meta Tags Mod
4. Open catalog\includes\modules\sts_inc\sts_user_code.php
Somewhere in the file, prefably on the top after the comments
Add:
# Mod STS + cDynamic Meta Tags $sts->template['stsMetaTitle']=' <title>'.$metatitle.'</title>' . "n"; $sts->template['stsMetaDescription']=' <META NAME="Description" Content="' .$metadescription. '">' . "n"; $sts->template['stsMetaKeywords']=' <META NAME="Keywords" Content="' . $metakeywords . '">' . "n"; # End Mod STS + cDynamic Meta Tags
5.Open your current template.
The standard is catalog\includes\sts_templates\test\sts_template.html
Find:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html $htmlparams> <head>
After Add:
$stsMetaTitle
$stsMetaDescription
$stsMetaKeywords
6. All Done! Save and close all files.










Friday, June 8th 2007 at 12:17 am
osCommerce: Installing Dynamic Meta Tags in STS…
How to install Dynamic Meta Tags in Simple Template System for osCommerce. OsCommerce is a open source based eCommerce platform that is highly customizable.
A must read if you are into eCommerce….
Tuesday, August 7th 2007 at 12:56 am
Tried the above on business-investment-news.info which is a test site that I’m creating an SEO version of Oscommerce with no tables in the code (so all CSS driven).
When complete will be quite easy to use various CSS bases templates, the one on the test site is a popular WordPress theme. Has taken a week to get this far, Oscommerce code is a pain to change from tables to CSS/divs.
Using the latest versions of the two contributions (so the STS version is not the one listed above)
Couldn’t get it working
I think you have an error in (prob not the cause of the problem)-
// Mod STS + cDynamic Meta Tags
blah…
else {
The else above clashes with
else if (strpos
I found removing else from “else if (strpos” (so use “if (strpos”) at least got the site working again, but the title etc… is not shown correctly. What I get is the title/meta tags code listed minus the actual keywords etc… and the /n is shown as text.
Anyone know how to get STS and Meta Tags working in the latest versions?
Sunday, September 9th 2007 at 12:52 pm
just add the code in catalog\includes\modules\sts_inc\sts_user_code.php
# Mod STS + cDynamic Meta Tags
$sts->template[’stsMetaTitle’]=’ ‘.$metatitle.'’ . “”;
$sts->template[’stsMetaDescription’]=’ ‘ . “”;
$sts->template[’stsMetaKeywords’]=’ ‘ . “”;
# End Mod STS + cDynamic Meta Tags
and then add
$stsMetaTitle
$stsMetaDescription
$stsMetaKeywords
in your template file. remember to remove the and will be fine
Sunday, September 30th 2007 at 4:06 pm
http://www.meta-fx.com
forex فارکس
Wednesday, January 9th 2008 at 12:49 pm
@David:
The ‘n’ should be a line break: replace “n” with “\n” and it should work fine.
I’m having a similar problem with output though. I have tested on a development copy of my client’s site and can get it working properly. I install cDynamic Meta Tags on the production site and get no output at the template stage other than empty HTML tags. This suggests to me that the variables aren’t being passed to the templates somewhere up the line. I have tested the code in sts_user_code.php by putting some static text in the title tag, and confirmed this. It looks like the $meta- variables need to be passed on somewhere. More when I find it.
Saturday, April 19th 2008 at 7:29 pm
Hello.
I have installed following the above instructions, but i get a “
Saturday, April 19th 2008 at 7:32 pm
Hmm… it was not that
Here it comes again:
Hello.
I have installed following the above instructions, but i get a [Opening Tag] (- cant write it, because this blog will disform it) in the top left corner of my site now. Everything else is working fine (also Meta).
Can some one please help me? I cant find a loose tag anywhere
The tag is somewhere in my catalog\includes\meta_tags.php - i think.
I really hope you can help! - Michael
Tuesday, April 29th 2008 at 5:42 pm
// Mod STS + cDynamic Meta Tags
// Check if STS is enabled or in test mode
if ((MODULE_STS_DEFAULT_STATUS == ‘true’) || (($_GET[’sts_debug’] == MODULE_STS_DEBUG_CODE)))
{ };
that works
Monday, May 5th 2008 at 11:17 am
I had the same problem with empty variables. The problem is that the above installation procedure is not complete. The meta_tags.php file isn’t called from any code.
Adding the line below to the beginning of sts_user.php (right after
Monday, May 5th 2008 at 11:23 am
addition to above post.
Meant:
right after the opening php tag.
require(DIR_WS_INCLUDES . ‘meta_tags.php’);
This solved the problem for me.
Kind regards,
Antoine
Tuesday, May 6th 2008 at 9:34 am
Another Addition/
Don’t use require(DIR_WS_INCLUDES . ‘meta_tags.php’); in str_user_code.php … after that index.php and categories don’t work anymore. In stead add the line
require(DIR_WS_INCLUDES . ‘meta_tags.php’);
Somewhere in
product_info.php
specials.php
products_new.php
somewhere after another require.
Hopefully everything works fine know .. if not let me know.
Antoine