Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Tags for novices


GemRock

Recommended Posts

Fixed. And it works fine. Is there some other way.

 

catalog/includes/modules/sts_inc/general.php

 

//$sts->template['headertags']= "<title>" . TITLE ."</title>";

// Header Tags for novices w/STS v4.3.3 BOF

if (isset($cPath) && (!$HTTP_GET_VARS['products_id'])) {

// Header Tags for novices w/STS v4.3.3 BOF

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags('')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') . ' - ' . $cat_tags[title_tag] : TITLE;

$sts->template['headertags'] .= "</title>\n";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($cat_tags[desc_tag]);

$sts->template['headertags'] .= "\">\n<meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($cat_tags[keywords_tag]);

$sts->template['headertags'] .= "\">\n";

 

} elseif (isset($HTTP_GET_VARS['products_id'])) {

// Header Tags for novices w/STS v4.3.3 BOF

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags('')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') . ' - ' . $header_tags[title_tag] : TITLE;

$sts->template['headertags'] .= "</title>\n";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($header_tags[desc_tag]);

$sts->template['headertags'] .= "\">\n<meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($header_tags[keywords_tag]);

$sts->template['headertags'] .= "\">\n";

// Header Tags for novices EOF

} elseif (!isset($cPath) && !tep_not_null($cPath)) {

//set default

//default keywords for the index (home) page

$kws_home_default .= STORE_NAME;

//default Description for the index (home) page in your laguages

$desc_home_default = TEXT_DEFAULT_DESCRIPTION_TAG;

 

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= TITLE . ' - ' . TEXT_ADD_DEFAULT_TITLE;

$sts->template['headertags'] .= "</title>\n";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($desc_home_default);

$sts->template['headertags'] .= "\">\n<meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($kws_home_default);

$sts->template['headertags'] .= "\">\n";

}

// Header Tags for novices EOF

Link to comment
Share on other sites

STS Use for the change as shown below.

 

catalog/includes/modules/sts_inc/general.php

 

 

//osc_template TAG

//$sts->template['headertags']= "<title>" . TITLE ."</title>";

//$sts->template['headertags']= "<title>" . tep_output_string_protected($oscTemplate->getTitle()) ."</title>";

 

// Header Tags for novices w/STS v4.3.3 BOF

if ((isset($cPath) && tep_not_null($cPath)) && (!isset($HTTP_GET_VARS['products_id']))) {

// Header Tags for novices w/STS v4.3.3 BOF

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags('')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') . ' - ' . $cat_tags[title_tag] : TITLE;

$sts->template['headertags'] .= "</title>\n";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($cat_tags[desc_tag]);

$sts->template['headertags'] .= "\">\n<meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($cat_tags[keywords_tag]);

$sts->template['headertags'] .= "\">\n";

 

} elseif (isset($HTTP_GET_VARS['products_id'])) {

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags('')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') . ' - ' . $header_tags[title_tag] : TITLE;

$sts->template['headertags'] .= "</title>\n";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($header_tags[desc_tag]);

$sts->template['headertags'] .= "\">\n<meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($header_tags[keywords_tag]);

$sts->template['headertags'] .= "\">\n";

// Header Tags for novices EOF

} else {

//set default

//default keywords for the index (home) page

$kws_page_default .= HEADING_TITLE;

$kws_home_default .= STORE_NAME;

//default Description for the index (home) page in your laguages

$desc_home_default = TEXT_DEFAULT_DESCRIPTION_TAG;

 

$sts->template['headertags']= "<title>";

$sts->template['headertags'] .= $kws_page_default . ' - ' . TEXT_ADD_DEFAULT_TITLE;

$sts->template['headertags'] .= "</title>\n";

$sts->template['headertags'] .= "<meta name=\"description\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($desc_home_default);

$sts->template['headertags'] .= "\">\n<meta name=\"keywords\" content=\"";

$sts->template['headertags'] .= htmlspecialchars($kws_home_default);

$sts->template['headertags'] .= "\">\n";

}

// Header Tags for novices EOF

 

 

 

ADD :

 

catalog/includes/languages/your languages.php

 

define('TEXT_ADD_DEFAULT_TITLE', 'your meta title');

define('TEXT_DEFAULT_DESCRIPTION_TAG', 'your meta descriptin');

 

 

catalog/includes/application_top.php

 

search:

 

//add category name to page title

if (strlen($categories['categories_name'])>1) $header_tags[title_tag] = $categories['categories_name'] . ' ' . $header_tags[title_tag];

 

replace:

 

//add category name to page title

if (strlen($categories['categories_name'])>1) $header_tags[title_tag] = $header_tags[title_tag];

Link to comment
Share on other sites

  • 1 month later...

Hi Ken,

 

Love this contribution! It has really enhanced my website. Just one question: is there a way to get Manufacturer name on the title tag for products?

Currently, it is Product name - Category name - Store name

I'd like to to show Product name - manufacturer name - store name

 

Thanks for your help.

Best,

Iffy

Link to comment
Share on other sites

  • 1 month later...

Hi Paulien

 

i seem to have done a on-the-spot mod that is exactly what you requested for a site but at the moment cant remember which site. will have a look and post back here.

 

 

Hi Ken,

 

Great contribution. Is it also possible to have seo header tags for manufacturers pages? I'll be very grateful if you can help me we that.

 

Paulien

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

found it (header tags for manufacturers) but haven't got the time to add it to the package so not a formal release. download zip file HERE, just a single file combining the language definition. unzip it then upload to (admin)/ folder. add a link to the (admin)/includes/boxes/catalog.php. let me know if there is any problem (do not expect any) so that i can fix it and add it to the package.

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

found it (header tags for manufacturers) but haven't got the time to add it to the package so not a formal release. download zip file HERE, just a single file combining the language definition. unzip it then upload to (admin)/ folder. add a link to the (admin)/includes/boxes/catalog.php. let me know if there is any problem (do not expect any) so that i can fix it and add it to the package.

Ken

 

Thanks! Will let you know later today if everything works ok.

 

Paulien

Link to comment
Share on other sites

I uploaded the file and added a link to admin/includes/boxes/catalog.php and added a line to the language file and filenames.php. Three new fields are added to the database table manufacturers. But I have two problems. There is no manufacturer listed in the table where i can edit the manufacturers header tags. I entered the header tags directly in my database, but when I opened the manufacturers page the defealt header tags were shown. Do i have to change code in index.php?

 

Paulien

Edited by Truus100
Link to comment
Share on other sites

sorry i forgot that. yes you need to make change to index.php. try to add this code just before:

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

 

if (isset($_GET['manufacturers_id'])) {
$manufacturers_query = tep_db_query("select manufacturers_name,title_tag,desc_tag,keywords_tag from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
if (tep_db_num_rows($manufacturers_query)) {
 	$manufacturers = tep_db_fetch_array($manufacturers_query);
 	if (strlen($manufacturers['title_tag'])>3) {
   	$title_tag = $manufacturers['title_tag'];
 	} else {
   	$header_manifacturer = $manufacturers['manufacturers_name'] . ' - ';
 	}
 	if (strlen($manufacturers['desc_tag'])>5) {
   	$desc_tag = $manufacturers['desc_tag'].' - '.$desc_home_default;
 	} else {
   	$desc_tag = $manufacturers['manufacturers_name'].' - '.$desc_home_default;
 	}
 	if (strlen($manufacturers['keywords_tag'])>5) {
   	$keywords_tag = $manufacturers['keywords_tag'].' - '.$kws_home_default;
 	} else {
   	$keywords_tag = $manufacturers['manufacturers_name'].' - '.$kws_home_default;
 	}
}
if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) {
   	$cat_tags_query = tep_db_query("SELECT categories_name, title_tag, desc_tag, keywords_tag FROM " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$_GET['filter_id'] . "' AND language_id = '" . (int)$languages_id . "'");
   	$cat_tags = tep_db_fetch_array($cat_tags_query);
   	$title_tag  = $header_manifacturer . $cat_tags['categories_name'] . ' - ';
   	}
}

feel free to make further changes to suit your needsad the code may be customised that site only.

Ken

 

I uploaded the file and added a link to admin/includes/boxes/catalog.php and added a line to the language file and filenames.php. Three new fields are added to the database table manufacturers. But I have two problems. There is no manufacturer listed in the table where i can edit the manufacturers header tags. I entered the header tags directly in my database, but when I opened the manufacturers page the defealt header tags were shown. Do i have to change code in index.php?

 

Paulien

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Hi Ken,

 

Thanks a lot for your quick reply. The extra code in index.php helps a lot. I changed the first $header_manifacturer in $title_tag, so if i leave the Title Tag blank, the manufacturers name will be the title.

 

But my manufacturers list in admin is still empty. I edit the header tags directly in the database. I would like to do that in the admin of my shop. Hope you can help me with that.

 

Paulien

Link to comment
Share on other sites

the only possible reason for no-show of the manu. list could be the language id. try to change this line 204:

	$manufacturers_query_raw = "select manufacturers_id, manufacturers_name, title_tag, desc_tag,  keywords_tag from " . TABLE_MANUFACTURERS . " where language_id = '$languages_id' " . " $sort_by ";

 

to

 

	$manufacturers_query_raw = "select manufacturers_id, manufacturers_name, title_tag, desc_tag,  keywords_tag from " . TABLE_MANUFACTURERS .  " $sort_by ";

 

assuming you only have one language. you can look at the table to see if there is any language id. if there is, then somehow the variable $language_id is empty.

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

The language id was problem. Somehow all the manufacturers had the wrong (default) language id. I changed that in the database and everything works fine. Great! I'm very happy (hope google will be as happy as i am). You have been very helpful, thanks a lot!!!

 

Paulien

Link to comment
Share on other sites

  • 3 months later...

Hi Ken,

 

Thanks for an awesome contribution! It works great, but I have one hopefully minor problem. My Product_Info page doesn't display manufacturer, which I would really like to include. Not sure what the issue may be. I'm using the following title tag on my product_info.php:

 

title><?php echo ((strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1)) ? $header_tags['products_name'] . ' - ' . $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?>

</title>

 

Thanks for your help.

Best,

Iffy

Link to comment
Share on other sites

read the previous page (page 38) post #755 onward, to see if that help?

Ken

Hi Ken,

 

Thanks for an awesome contribution! It works great, but I have one hopefully minor problem. My Product_Info page doesn't display manufacturer, which I would really like to include. Not sure what the issue may be. I'm using the following title tag on my product_info.php:

 

title><?php echo ((strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1)) ? $header_tags['products_name'] . ' - ' . $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?>

</title>

 

Thanks for your help.

Best,

Iffy

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Hi Ken,

 

Adding the manufacturers tag to the index.php page definitely helped. Sorry for this basic question, but I think I am misunderstanding you. Are you suggesting that the same code that was added to the index.php page should also be added to the product_info.php page?

 

Thanks,

Iffy

Link to comment
Share on other sites

what i can do is to offer a quick fix as i know little about your website.

 

in product_info.php, below

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

add:

$mID_sql = tep_db_query("select manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$_GET['products_id'] . "'");
$mID_query = tep_db_fetch_array($mID_sql);
$mID = $mID_query['manufacturers_id'];

$manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$mID . "'");

$manufacturers = tep_db_fetch_array($manufacturers_query);
$m_name = $manufacturers['manufacturers_name'];

now, you get the manufacturers name, you can add it to wherever you want to. eg, add it to the title tag:

 

<title><?php echo $header_tags[title_tag] . ' - '.$m_name. ' - '. TITLE; ?></title>

 

Ken

 

Hi Ken,

 

Adding the manufacturers tag to the index.php page definitely helped. Sorry for this basic question, but I think I am misunderstanding you. Are you suggesting that the same code that was added to the index.php page should also be added to the product_info.php page?

 

Thanks,

Iffy

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Link to comment
Share on other sites

Hi Ken,

 

Thanks for all you help. It worked perfectly! If you would like to take a look, my site is at:

 

www.cuddlebugfactory.com

 

I'm very happy with the way it's turning out...thanks to you and all of the other contributors on this forum.

 

Best regards,

Iffy

Edited by Jan Zonjee
Link to comment
Share on other sites

  • 7 months later...

Hi.

I could follow all steps except these ones in index.php and products_info.php.

Couldn't find

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

in there.

What can I do ?

Link to comment
Share on other sites

  • 2 weeks later...

I installed seo header tags version 5.00 with Ultimate Seo Urls 5 PRO and they both work grate together and header tags for novices is a lot more easy to install and set up then KissMT by far. I hope people continue to support it.

 

Thank you for this great contribution.

 

Darren

Link to comment
Share on other sites

  • 1 month later...

(sorry for my very bad English)

Ken Thanks for that Great Work

So the Contrib is working great in osc 2.2

Today i installed it on new osc 2.31

All steps was same except 2 changes

1. Change

-----------------------------

in admin/includes/boxes/catalog.php

I wrote

array(

'code' => FILENAME_HEADER_TAGS_CATEGORY_EDIT,

'title' => BOX_CATALOG_HEADER_TAGS_CATEGORY_EDIT,

'link' => tep_href_link(FILENAME_HEADER_TAGS_CATEGORY_EDIT)

),

array(

'code' => FILENAME_HEADER_TAGS_EDIT,

'title' => BOX_CATALOG_HEADER_TAGS_EDIT,

'link' => tep_href_link(FILENAME_HEADER_TAGS_EDIT)

),

----------------------

2. Change

In osc 2.31 at index.php & product_info.php

there is no title tag: but there is a link to a file called template_top.php

and the title tag is in there so i give the code for the index.php there.

The problem is that at product_info.php there is the same link to the same template_top.php file

but in the instructions

the code for the title tag in product_info.php are Different than the title tag in index.php

So i made a new file (copy from template_top.php) renamed it template_top_products.php

and put the code for the Products title tag there and renamed the link from product_info.php to

template_top_products.php where the Products title tag is present.

Of course you can only understand that if you have installed osc2.31 did you?

Or has somebody else installed this great Contrib in osc2.31

Thanks friends

Edited by Pelvis
Link to comment
Share on other sites

And a Last question

What is the corect code for catalog/product_info.php

 

This:

-------------------------

<title><?php echo $header_tags[products_name]; ?></title>

-------------------------

Or This (from the last Install Instructions):

-------------------------

<title><?php echo $header_tags[title_tag]; ?></title>

<meta name="description" content="<?php echo $header_tags[desc_tag]; ?>">

<meta name="keywords" content="<?php echo $header_tags[keywords_tag]; ?>">

--------------------------

Thanks for your time!

Link to comment
Share on other sites

In 2.3.1 you do not edit individual files for adding in meta/title info, its all done in just one file: includes/template_top.php

Link to comment
Share on other sites

  • 2 months later...

Hello,

 

I've just installed this contribution, but unfortunatly I just still don't get any meta tags & discription in my header tags..

I've tried for so long now (with many other contributions as wel), i just don't know what's wrong, could this be maybe because i'm using an STS template?

I really don't now, it's just very frustrating my webshop is unfindable in google..

 

This is a link to my shop: http://bordspel.goed-kopen.be

 

Here is a link to the index.php file: http://goed-kopen.be/upload/index.rar (or see the attached file)

 

I really really hope somebody could help me with this problem, i just want some meta keywords and a discription on the index page so that google can find us!

Thank you very much!

 

Sincerely,

Jonas

index.php

Edited by Orpian
Link to comment
Share on other sites

@@Orpian

 

I am sure it as something to do with the STS contribution. If you check the STS support thread I do believe it mentions Header tags SEO issues.

 

Chris

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...