Jump to content

Archived

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

toyicebear

Meta Tags For Your osC Shop

Recommended Posts

Another update - The heading title is showing this

HEADING_TITLE_NEW

 

if that helps?

Share this post


Link to post
Share on other sites

That's a very old mod..try this instead:

 

http://addons.oscommerce.com/info/5497

 

Boom! Its working!

 

But..

 

Easy loses the option to change the heading_title.

 

Im clueless, any chance you could tell me how to work in the heading_title code in the easy_meta_tags file?

 

In basic meta tags it was this

 

 

if (isset($_GET['cPath'])) {

$category_name_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_name = tep_db_fetch_array($category_name_query);

define('HEADING_TITLE_NEW', $category_name['categories_name']);

}

 

and this

 

 

 

<?php echo HEADING_TITLE; ?>

 

Replace with:

 

<?php echo HEADING_TITLE_NEW; ?>

 

EDIT - okay i got it

 

<?php
// Easy Meta Tags 1.2.5 for osCommerce MS2.2/RC2.2/2.31
//index page metas
if (basename($PHP_SELF) == FILENAME_DEFAULT) {
if (isset($HTTP_GET_VARS['products_id'])){
$product_meta_query = tep_db_query("select products_name, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
$product_meta = tep_db_fetch_array($product_meta_query);
$meta_title_tag = $product_meta['products_name'];
$meta_description = preg_replace('/<[^>]*>/', '', $product_meta['products_description']);
$meta_description = preg_replace('/\s\s+/', ' ',$meta_description);
if (strlen($meta_description) > 200){
$meta_description_tag = substr($meta_description, 0, 200) . '...';
}else {
$meta_description_tag = $meta_description;
}
$meta_keywords_tag = $product_meta['products_name'];
}
if ((isset($_GET['cPath'])) && (!isset($HTTP_GET_VARS['products_id']))) {
$category_name_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_name = tep_db_fetch_array($category_name_query);
define('HEADING_TITLE_NEW', $category_name['categories_name']);
if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] != '1')) {
$page = '-' . $HTTP_GET_VARS['page'];
}
$meta_title_tag = $category_name['categories_name'] . (isset($page) ? $page : '');
$meta_description_tag = $category_name['categories_name'] . (isset($page) ? $page : '') . ' : ' . STORE_NAME;
$meta_keywords_tag = $category_name['categories_name']. (isset($page) ? $page : '');
}
if ((isset($HTTP_GET_VARS['manufacturers_id'])) && (!isset($HTTP_GET_VARS['products_id']))) {
$manufacturers_name_query = tep_db_query("select m.manufacturers_name from " . TABLE_MANUFACTURERS . " m where m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
$manufacturers_name = tep_db_fetch_array($manufacturers_name_query);

$meta_title_tag = $manufacturers_name['manufacturers_name'];
$meta_description_tag = $manufacturers_name['manufacturers_name'] . ' : ' . STORE_NAME;
$meta_keywords_tag = $manufacturers_name['manufacturers_name'];
}
if ((!isset($_GET['cPath'])) && (!isset($HTTP_GET_VARS['manufacturers_id'])) && (!isset($HTTP_GET_VARS['products_id']))) {
$meta_title_tag = STORE_NAME;
$meta_description_tag = STORE_NAME;
$meta_keywords_tag = STORE_NAME;
}
// product info metas
} elseif  (basename($PHP_SELF) == FILENAME_PRODUCT_INFO) {
$product_meta_query = tep_db_query("select products_name, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
$product_meta = tep_db_fetch_array($product_meta_query);
$meta_title_tag = $product_meta['products_name'];
$meta_description = preg_replace('/<[^>]*>/', '', $product_meta['products_description']);
$meta_description = preg_replace('/\s\s+/', ' ',$meta_description);
if (strlen($meta_description) > 200){
$meta_description_tag = substr($meta_description, 0, 200) . '...';
}else {
$meta_description_tag = $meta_description;
}
$meta_keywords_tag = $product_meta['products_name'];
// product reviews info metas
} elseif  (basename($PHP_SELF) == FILENAME_PRODUCT_REVIEWS_INFO) {
$reviews_meta_query = tep_db_query("select rd.reviews_text, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.reviews_id = '" . (int)$HTTP_GET_VARS['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");
$reviews_meta = tep_db_fetch_array($reviews_meta_query);
$meta_title_tag = NAVBAR_TITLE . ' :: ' . $reviews_meta['products_name'];
$meta_description = preg_replace('/<[^>]*>/', '', $reviews_meta['reviews_text']);
$meta_description = preg_replace('/\s\s+/', ' ',$meta_description);
if (strlen($meta_description) > 200){
$meta_description_tag = substr($meta_description, 0, 200) . '...';
}else {
$meta_description_tag = $meta_description;
}
$meta_keywords_tag = NAVBAR_TITLE . ' ' . $reviews_meta['products_name'];
} else {
//other pages 
if (HEADING_TITLE != 'HEADING_TITLE') {
$heading_title = HEADING_TITLE;
} else {
$heading_title = basename($PHP_SELF);
$patterns[0] = '/.php/';
$patterns[1] = '/.html/';
$patterns[2] = '/-/';
$patterns[3] = '/_/';
$replacements[0] = '';
$replacements[1] = '';
$replacements[2] = ' ';
$replacements[3] = ' ';
$heading_title = preg_replace($patterns, $replacements, $heading_title);
$heading_title = ucwords($heading_title);
}
$meta_title_tag = $heading_title; 
$meta_description_tag = $heading_title . ' : ' . STORE_NAME;
$meta_keywords_tag = $heading_title;
}
echo '<title>' . $meta_title_tag . '</title>' . "\n";
echo '<meta name="description" content="' . $meta_description_tag . '" />' . "\n";
echo '<meta name="keywords" content="' . $meta_keywords_tag . '" />' . "\n";
?>

Share this post


Link to post
Share on other sites

okay one last thing!

 

I want to append a standard comment on the end of a title tag using include

 

for example

 

<?php include("index_meta_title.php"); ?>

 

index_meta_title will create words specific for each category. my question is where can I put the includes in easy_meta_tags.php?

 

I expect it has to go somewhere in here but it breaks with everything I have tried so far

 

 

echo '<title>' . $meta_title_tag . '</title>' . "\n";

echo '<meta name="description" content="' . $meta_description_tag . '" />' . "\n";

echo '<meta name="keywords" content="' . $meta_keywords_tag . '" />' . "\n";

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

if you want to add manual tags you should rather look at the Header Tags SEO add-on.

 

Okay, I got it

 

I changed this

 

echo '<title>' . $meta_title_tag . '</title>' . "\n";
echo '<meta name="description" content="' . $meta_description_tag . '" />' . "\n";
echo '<meta name="keywords" content="' . $meta_keywords_tag . '" />' . "\n";

 

to this

 

echo '<title>' . $meta_title_tag;
include ('index_meta_title.php');
echo '</title>' . "\n";
echo '<meta name="description" content="' . $meta_description_tag;
include ('index_meta_description.php');
echo '" />' . "\n";
echo '<meta name="keywords" content="' . $meta_keywords_tag;
include ('index_meta_keywords.php');
echo '" />' . "\n";

 

About header tags SEO, yeah I have looked at it but unfortunately it does not use the same database tables as Easy Populate so it is not practical.

 

With your contribution I can manually add meta tags with Easy Populate which is an amazing feature.

 

About the category bit. Okay, I cant use Easy Populate but your contribution gets 70% of the way there and the extra includes gets it to 85%. Its not perfect but I can live with it.

 

Basically, the only way manually adding meta tags is feasible is with Easy Populate. Your contribution does use it and I know of know other SEO contribution that does, which in mind mind, makes you a bit of a hero.

Share this post


Link to post
Share on other sites

okay I pushed the boat out a bit more, replace the above code with this to make the title lower case in the keywords. Will also strip accents/foreign characters like Russian and Greek if you put in what you need.

 

<?php
// Easy Meta Tags 1.2.5 for osCommerce MS2.2/RC2.2/2.31
//index page metas
if (basename($PHP_SELF) == FILENAME_DEFAULT) {
if (isset($HTTP_GET_VARS['products_id'])){
$product_meta_query = tep_db_query("select products_name, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
$product_meta = tep_db_fetch_array($product_meta_query);
$meta_title_tag = $product_meta['products_name'];
$meta_description = preg_replace('/<[^>]*>/', '', $product_meta['products_description']);
$meta_description = preg_replace('/\s\s+/', ' ',$meta_description);
if (strlen($meta_description) > 200){
$meta_description_tag = substr($meta_description, 0, 200) . '...';
}else {
$meta_description_tag = $meta_description;
}
$meta_keywords_tag = $product_meta['products_name'];
}
if ((isset($_GET['cPath'])) && (!isset($HTTP_GET_VARS['products_id']))) {
$category_name_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_name = tep_db_fetch_array($category_name_query);
define('HEADING_TITLE_NEW', $category_name['categories_name']);
if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] != '1')) {
$page = '-' . $HTTP_GET_VARS['page'];
}
$meta_title_tag = $category_name['categories_name'] . (isset($page) ? $page : '');
$meta_description_tag = $category_name['categories_name'] . (isset($page) ? $page : '') . ' : ' . STORE_NAME;
$meta_keywords_tag = $category_name['categories_name']. (isset($page) ? $page : '');
}
if ((isset($HTTP_GET_VARS['manufacturers_id'])) && (!isset($HTTP_GET_VARS['products_id']))) {
$manufacturers_name_query = tep_db_query("select m.manufacturers_name from " . TABLE_MANUFACTURERS . " m where m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
$manufacturers_name = tep_db_fetch_array($manufacturers_name_query);

$meta_title_tag = $manufacturers_name['manufacturers_name'];
$meta_description_tag = $manufacturers_name['manufacturers_name'] . ' : ' . STORE_NAME;
$meta_keywords_tag = $manufacturers_name['manufacturers_name'];
}
if ((!isset($_GET['cPath'])) && (!isset($HTTP_GET_VARS['manufacturers_id'])) && (!isset($HTTP_GET_VARS['products_id']))) {
$meta_title_tag = STORE_NAME;
$meta_description_tag = STORE_NAME;
$meta_keywords_tag = STORE_NAME;
}
// product info metas
} elseif  (basename($PHP_SELF) == FILENAME_PRODUCT_INFO) {
$product_meta_query = tep_db_query("select products_name, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
$product_meta = tep_db_fetch_array($product_meta_query);
$meta_title_tag = $product_meta['products_name'];
$meta_description = preg_replace('/<[^>]*>/', '', $product_meta['products_description']);
$meta_description = preg_replace('/\s\s+/', ' ',$meta_description);
if (strlen($meta_description) > 200){
$meta_description_tag = substr($meta_description, 0, 200) . '...';
}else {
$meta_description_tag = $meta_description;
}
$meta_keywords_tag = $product_meta['products_name'];
// product reviews info metas
} elseif  (basename($PHP_SELF) == FILENAME_PRODUCT_REVIEWS_INFO) {
$reviews_meta_query = tep_db_query("select rd.reviews_text, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.reviews_id = '" . (int)$HTTP_GET_VARS['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");
$reviews_meta = tep_db_fetch_array($reviews_meta_query);
$meta_title_tag = NAVBAR_TITLE . ' :: ' . $reviews_meta['products_name'];
$meta_description = preg_replace('/<[^>]*>/', '', $reviews_meta['reviews_text']);
$meta_description = preg_replace('/\s\s+/', ' ',$meta_description);
if (strlen($meta_description) > 200){
$meta_description_tag = substr($meta_description, 0, 200) . '...';
}else {
$meta_description_tag = $meta_description;
}
$meta_keywords_tag = NAVBAR_TITLE . ' ' . $reviews_meta['products_name'];
} else {
//other pages 
if (HEADING_TITLE != 'HEADING_TITLE') {
$heading_title = HEADING_TITLE;
} else {
$heading_title = basename($PHP_SELF);
$patterns[0] = '/.php/';
$patterns[1] = '/.html/';
$patterns[2] = '/-/';
$patterns[3] = '/_/';
$replacements[0] = '';
$replacements[1] = '';
$replacements[2] = ' ';
$replacements[3] = ' ';
$heading_title = preg_replace($patterns, $replacements, $heading_title);
$heading_title = ucwords($heading_title);
}
$meta_title_tag = $heading_title;
$meta_description_tag = $heading_title . ' : ' . STORE_NAME;
$meta_keywords_tag = $heading_title;
}
function strtolower_utf8($string){
 $convert_to = array(
   "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u",
   "v", "w", "x", "y", "z", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï",
   "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "а", "б", "в", "г", "д", "е", "ё", "ж",
   "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы",
   "ь", "э", "ю", "я", "ζ", "α"
 );
 $convert_from = array(
   "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
   "V", "W", "X", "Y", "Z", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï",
   "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "А", "Б", "В", "Г", "Д", "Е", "Ё", "Ж",
   "З", "И", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ъ", "Ъ",
   "Ь", "Э", "Ю", "Я", "Ζ", "ά"
 );
 return str_replace($convert_from, $convert_to, $string);
}
$meta_keywords_tagL = strtolower_utf8($meta_keywords_tag);
echo '<title>' . $meta_title_tag;
include ('index_meta_title.php');
echo '</title>' . "\n";
echo '<meta name="description" content="' . $meta_description_tag;
include ('index_meta_description.php');
echo '" />' . "\n";
echo '<meta name="keywords" content="' . $meta_keywords_tagL;
include ('index_meta_keywords.php');
echo '" />' . "\n";
?>

 

100% not my work. I got it from here http://php.net/manual/en/function.strtolower.php

Share this post


Link to post
Share on other sites

I am a new user, how do I access the css file from the admin panel. Is it possible? thank u

Share this post


Link to post
Share on other sites

@@sanoo

 

No you cannot access the stylesheet.css from the admin area, the stylesheet.css file can only be accessed from your FTP client or hosting account file manager.

 

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

×