Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

keywords


dydez

Recommended Posts

i have installed a meta tag addon witch is

 

<?php

// Easy Meta Tags 1.2.3 for osCommerce MS2.2

 

//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);

if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] != '1')) {

$page = '-' . $HTTP_GET_VARS['page'];

}

$meta_title_tag = $category_name['categories_name'] . $page;

$meta_description_tag = $category_name['categories_name'] . $page . ' : ' . STORE_NAME;

$meta_keywords_tag = $category_name['categories_name']. $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

$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";

 

?>

 

where do i insert my own keywords and how do i edit my tags

Link to comment
Share on other sites

Looking at the code, you can see that $meta_description_tag and $meta_keywords_tag are given different content, based on what the type of page is and what product, manufacturer, category, etc. is being shown. You can add additional material if you want (your own keywords) down near the bottom, just before the three echo statements.

$meta_keywords_tag .= ',my_keyword1, my_keyword2, my_keyword3';

Same thing for extending the "description" content and even the "title" content.

 

Keep in mind that most search engines pretty much ignore the "keywords" tag, as web authors have so badly abused it by loading up with unrelated keywords. The "description" tag isn't used for searches, either, but may be used to describe your page in the search results.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...