Jump to content
Jack_mcs

Header Tags SEO

Recommended Posts

And I just checked, Login.php is defined in filenames.php and there is also a login.php file in languages/english/

 

Login.php is not showing up in the page control admin page.

 

If I rename login.php to login2.php then it shows up in the drop down, But if I change it back to just login.php it is gone again!

 

EDIT: I just found your post. I made a stupid:

 

because it is excluded in admin/includes/functions/header_tags.php. It is excluded because secure pages shouldn't be listed on search engine pages so it doesn't server much purpose to list them. You can delete any you want from that list if you want to have the control of the title and tags though.
Edited by sackling

Share this post


Link to post
Share on other sites

Hi,

I just have a few small issue with the addon.

Everything is working fine except the additional pages title meta desc etc.

Do I have to add any additional code to those pages individually. If so can you please guide me to that code. I did go through the Install_Catalog.txt but couldnt find it.

Edited by praga

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

First and foremost: Thank you for this hot work!

 

Just updated from 3.2.9 to 3.3.0 and recognized after turning "Display Tag Cloud" to true, you have added the header for the tag cloud. Cuuuute. Thanks again.

 

After some examination of source code of entire page (since it disturbs my structure in footer.php) it looks like there are 2 closing div's missing.

1. closing div if last element of last row is reached (of $content)

2. closing div for id="tagcloud" (of $content)

 

Solution: Add the 2 missing div if last element of array is reached within foreach element in catalog/includes/headertags_seo_tagcloud_footer.php

 

FIND:

 

		  if ($colCtr >= HEADER_TAGS_TAG_CLOUD_COLUMN_COUNT) {
			  $colCtr = 0;
			  $content .= '</div><div style="text-align:center;">';
		  }
	  }

 

REPLACE WITH

 

		  if ($colCtr >= HEADER_TAGS_TAG_CLOUD_COLUMN_COUNT) {
			  $colCtr = 0;
			  $content .= '</div><div style="text-align:center;">';
		  }
		  // closing div if last element of last row is reached (of $content)
		  // closing div for id="tagcloud" (of $content)
		  $htsTagsArrayCounter+=1;
		  $htsTagsArrayMax = count($htsTagsArray);
		  if ($htsTagsArrayCounter==$htsTagsArrayMax) {
			   $content .= '</div>' . '</div>';
		  }			 
	  }

 

The counter should be resetted in front of mentioned foreach element like: $htsTagsArrayCounter=0;

I don't know for sure if this is necessary but think its sound to prevent any trouble and to ensure a correct startvalue. Advise is appreciated.

 

Hope it will help.

 

Kind Regards

heranke


Recommended SEO Addons:

Most Important: Header Tags SEO - Ultimate SEO V 2.2d

Recommended Addons:

Also Purchased (AP) Preselection - Contribution 3294

Share this post


Link to post
Share on other sites

Thank you for mentioning it. I see the code is correct in the 2.2 version. It doesn't use the div's in the standard code so it was easier to see. For 2.3, I think all that is needed is to replace

color:#fff;">' . $content . '</div>'

with

color:#fff;">' . $content . '</div></div></div>'

I'm not seeing the problem in 2.3 shops I've installed it in so I can't test it to see if that works. If you have time to do so, I would appreciate it.

Share this post


Link to post
Share on other sites

Hey Jack,

 

thank you for your reply.

 

After rethinking post 7204, it turns out, if last keyword hits exactly the max elements per row (HEADER_TAGS_TAG_CLOUD_COLUMN_COUNT) it would send you a row with

<div style="text-align:center;"></div>

which is empty. Tested and confirmed. So recycle post 7204.

 

Next step:

Simply adding 2 closing divs, as suggested, may be the solution, but it fall short and could end up in having a row like described above. One don't need 2 closing divs in any case. Depending from last element of array and if it is hitting the max per row.

 

Solution:

Clean start and close the div's within foreach element and catch the 2 cases where 1 or 2 closing divs are needed.

 

in catalog/includes/headertags_seo_tagcloud_footer.php

 

FIND

 

	 $colCtr = '';
	 $content = '<div id="tagcloud"><div style="text-align:center;">';

	 foreach ($htsTagsArray as $kword) {
		 // determine the popularity of this term as a percentage
		 $percent = floor(($kword['counter'] / $maximum) * 100);

		 // determine the size for this term based on the percentage

		 if ($percent < 20) {
			 $class = 'smallest';
		 } elseif ($percent >= 20 and $percent < 40) {
			 $class = 'small';
		 } elseif ($percent >= 40 and $percent < 60) {
			 $class = 'medium';
		 } elseif ($percent >= 60 and $percent < 80) {
			 $class = 'large';
		 } else {
			 $class = 'largest';
		 }

		 if (! tep_not_null(($hstLink = GetHTSTagCloudLink($kword['keyword'], $languages_id)))) {
			 continue;
		 }

		 $content .= '<span class="' . $class . '"><a style="color:#000;" href="' . $hstLink . '">' . ucwords(stripslashes($kword['keyword'])) . '</a> </span>';
		 $colCtr++;

		 if ($colCtr >= HEADER_TAGS_TAG_CLOUD_COLUMN_COUNT) {
			 $colCtr = 0;
			 $content .= '</div><div style="text-align:center;">';
		 }
	 }

 

REPLACE WITH

 

	 $colCtr = '';
	 $htsTagsArrayCtr = '';
	 $content = '<div id="tagcloud">';

	 foreach ($htsTagsArray as $kword) {
		 // clean start a row
		 if ($colCtr == 0) {$content .= '<div style="text-align:center;">';}
		 // determine the popularity of this term as a percentage
		 $percent = floor(($kword['counter'] / $maximum) * 100);

		 // determine the size for this term based on the percentage

		 if ($percent < 20) {
			 $class = 'smallest';
		 } elseif ($percent >= 20 and $percent < 40) {
			 $class = 'small';
		 } elseif ($percent >= 40 and $percent < 60) {
			 $class = 'medium';
		 } elseif ($percent >= 60 and $percent < 80) {
			 $class = 'large';
		 } else {
			 $class = 'largest';
		 }

		 if (! tep_not_null(($hstLink = GetHTSTagCloudLink($kword['keyword'], $languages_id)))) {
			 continue;
		 }

		 $content .= '<span class="' . $class . '"><a style="color:#000;" href="' . $hstLink . '">' . ucwords(stripslashes($kword['keyword'])) . '</a> </span>';
		 $colCtr++;

		 if ($colCtr >= HEADER_TAGS_TAG_CLOUD_COLUMN_COUNT) {
			 $colCtr = 0;
			 $content .= '</div>';
		 }

		 // closing div
		 $htsTagsArrayCtr++;
		 $htsTagsArrayMax = count($htsTagsArray);
		 if ($htsTagsArrayCtr==$htsTagsArrayMax) { //if last element of array is reached
		   if ($colCtr == 0) { // last element of array = max element per row
			 $content .= '</div>';} // we need one closing div for id="tagcloud" (row 31), last row already closed (row 62)
		   else { //last element of array is < max element per row (since row 60 not met)
			 $content .= '</div>' . '</div>'; // we need two closing div: close last row and close id="tagcloud" (row 31)
		   }
		 }
	 }

 

Comments can be removed without trouble. Checked for 7,8,9,15,16,17 keywords with 8 as maximum per row. Working as intended.

Please recheck and proof if $htsTagsArrayCtr, $htsTagsArrayMax can be used without causing trouble.

 

Not lucky with last if clause ($colCtr == 0), should be something like ($htsTagsArrayCtr==HEADER_TAGS_TAG_CLOUD_COLUMN_COUNT). Have to figure out.

 

Kind Regards

heranke

Edited by heranke

Recommended SEO Addons:

Most Important: Header Tags SEO - Ultimate SEO V 2.2d

Recommended Addons:

Also Purchased (AP) Preselection - Contribution 3294

Share this post


Link to post
Share on other sites

Hello again,

 

added a debug display and figured it out.

 

catalog/includes/headertags_seo_tagcloud_footer.php is now closing right. Using tools showing the structure is fine.

It would be interesting to know if someone else is experiencing the same problem with the tagcloud.

 

Here it is:

catalog/includes/headertags_seo_tagcloud_footer.php

 

	 $colCtr = '';
	 $htsTagsArrayCtr = '';
	 $content = '<div id="tagcloud">';

	 foreach ($htsTagsArray as $kword) {
		 // clean start a row
		 if ($colCtr == 0) {$content .= '<div style="text-align:center;">';}
		 // determine the popularity of this term as a percentage
		 $percent = floor(($kword['counter'] / $maximum) * 100);

		 // determine the size for this term based on the percentage

		 if ($percent < 20) {
			 $class = 'smallest';
		 } elseif ($percent >= 20 and $percent < 40) {
			 $class = 'small';
		 } elseif ($percent >= 40 and $percent < 60) {
			 $class = 'medium';
		 } elseif ($percent >= 60 and $percent < 80) {
			 $class = 'large';
		 } else {
			 $class = 'largest';
		 }

		 if (! tep_not_null(($hstLink = GetHTSTagCloudLink($kword['keyword'], $languages_id)))) {
			 continue;
		 }

		 $content .= '<span class="' . $class . '"><a style="color:#000;" href="' . $hstLink . '">' . ucwords(stripslashes($kword['keyword'])) . '</a> </span>';
		 $colCtr++;
		 // clean close a row if max per row is reached
		 if ($colCtr >= HEADER_TAGS_TAG_CLOUD_COLUMN_COUNT) {
			 $colCtr = 0;
			 $content .= '</div>';
		 }

		 // closing div
		 $htsTagsArrayCtr++;
		 $htsTagsArrayMax = count($htsTagsArray);

		 // debug, e=element, max=total elements of array, c=column
		 #echo $htsTagsArrayCtr . 'e' . $htsTagsArrayMax . 'max' . $colCtr . 'c' . ' / ';

		 // solution 1: compact
		 #if ($htsTagsArrayCtr==$htsTagsArrayMax && $colCtr == 0) {$content .= '</div>';}
		 #elseif ($htsTagsArrayCtr==$htsTagsArrayMax) {$content .= '</div>' . '</div>';}

		 // solution 2: structured
		 if ($htsTagsArrayCtr==$htsTagsArrayMax) {		 // if last element of array is reached
		  if ($colCtr == 0) {							 // and we hit max element per row
			  $content .= '</div>';}					 // last row alrdy closed (row 62), close id="tagcloud" (row 31)
		  else {										 // else we are inmid the row
			  $content .= '</div>' . '</div>';			 // close last row and close id="tagcloud" (row 31)
		  }
		 }
	 }

 

Last comments and debug can be deleted without problems. There are 2 solutions where I consider the second as more clear.

 

Best Regards

heranke

Edited by heranke

Recommended SEO Addons:

Most Important: Header Tags SEO - Ultimate SEO V 2.2d

Recommended Addons:

Also Purchased (AP) Preselection - Contribution 3294

Share this post


Link to post
Share on other sites

What are "additional pages?" What version of oscommerce are you using?

Additional pages like contact_us.php etc

OSC 2.3 Version.

Everything else is working when

It say " Results of scan: contact_us.php is missing Header Tags code or it is not installed correctly. Verify that Fill Tags has been ran and that the root checkbox or the default checkboxes have been checked in Page Control."

Share this post


Link to post
Share on other sites

@@praga For 2.3, you don't need to do anything extra for the other pages. If your home page and product pages are working correctly, then the other pages should too. When you say they are not working, if you view the source of those files, do you see the code for the title and meta tags? If not, then something is wrong with your installation, though I can't even guess at what it might be. If they are there but just not filled in, then have you entered anything for them in Page Control? Do you have the root box checked for those pages? What's the web browser title on those pages say?

Share this post


Link to post
Share on other sites

@@praga For 2.3, you don't need to do anything extra for the other pages. If your home page and product pages are working correctly, then the other pages should too. When you say they are not working, if you view the source of those files, do you see the code for the title and meta tags? If not, then something is wrong with your installation, though I can't even guess at what it might be. If they are there but just not filled in, then have you entered anything for them in Page Control? Do you have the root box checked for those pages? What's the web browser title on those pages say?

Hi thanks, it was the root check box, strangely it showed weird names before. Now after ticking it everything is working fine.

Thanks alot mate

Share this post


Link to post
Share on other sites

Dear Jack,

 

Finally I broke down the trouble with the closing divs to one single problem: The last row beeing drawn has to be closed and how to do that depends from beeing at the end of the row or not.

 

Changes made:

Moved the count out of the foreach element for performance.

Moved one closing div after the foreach to close the <div id="tagcloud"> opened in front of the foreach element.

New variables:

$htsTagsArrayCount (bearing the total number of elements of $htsTagsArray)

$htsTagsArrayElement (actual element beeing processed)

 

This version takes account for your code structure.

 

catalog/includes/headertags_seo_tagcloud_footer.php

 

<?php
/*
 $Id$
 header_tags_tag_cloud Originally Created by: Jack_mcs
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Portions Copyright 2011 oscommerce-solution.com
 Released under the GNU General Public License
*/
  include_once(DIR_WS_FUNCTIONS . 'header_tags.php');
  // $maximum is the highest counter for a search term
  $hts_tags_query = tep_db_query("select keyword, counter from " . TABLE_HEADERTAGS_KEYWORDS . " where keyword is not null and keyword != '' and found = 1 and language_id = " . (int)$languages_id . " ORDER BY counter DESC LIMIT 20");  
  if (tep_db_num_rows($hts_tags_query)) {
	  $maximum = 0;
	  while ($hts_tags = tep_db_fetch_array($hts_tags_query)) {
		  if ($hts_tags['counter'] > $maximum) {
			  $maximum = $hts_tags['counter'];
		  }
		  $htsTagsArray[] = array('keyword' => $hts_tags['keyword'], 'counter' => $hts_tags['counter']);
	  }
	  shuffle($htsTagsArray);

	  $htsTagsArrayCount = count($htsTagsArray);

	  $colCtr = '';
	  $htsTagsArrayElement = '';
	  $content = '<div id="tagcloud">';

	  foreach ($htsTagsArray as $kword) {
		  // clean start a row
		  if ($colCtr == 0) {$content .= '<div style="text-align:center;">';}
		  // determine the popularity of this term as a percentage
		  $percent = floor(($kword['counter'] / $maximum) * 100);
		  // determine the size for this term based on the percentage
		  if ($percent < 20) {
			  $class = 'smallest';
		  } elseif ($percent >= 20 and $percent < 40) {
			  $class = 'small';
		  } elseif ($percent >= 40 and $percent < 60) {
			  $class = 'medium';
		  } elseif ($percent >= 60 and $percent < 80) {
			  $class = 'large';
		  } else {
			  $class = 'largest';
		  }
		 if (! tep_not_null(($hstLink = GetHTSTagCloudLink($kword['keyword'], $languages_id)))) {
			 continue;
		  }
		  $content .= '<span class="' . $class . '"><a style="color:#000;" href="' . $hstLink . '">' . ucwords(stripslashes($kword['keyword'])) . '</a> </span>';
		  $colCtr++;
		  // closing at the end of a row
		  if ($colCtr >= HEADER_TAGS_TAG_CLOUD_COLUMN_COUNT) {
			  $colCtr = 0;
			  $content .= '</div>';
		  }

		  // closing a row if we are inmid
		  $htsTagsArrayElement++;
		  if ($htsTagsArrayElement==$htsTagsArrayCount) {
			 if ( $colCtr <> 0) {
				    $content .= '</div>';
			 }
		  }

		  // debug bof, e=element, max=total elements of array, c=column
		  #echo $htsTagsArrayElement . 'e' . $htsTagsArrayCount . 'max' . $colCtr . 'c' . ' / ';
		  // debug eof
	  }

   $content .= '</div>';

   echo '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading"><span>' .  BOX_HEADING_HEADERTAGS_TAGCLOUD . '</span></div>' .
			  '  <div class="ui-widget-content ui-corner-bottom infoBoxContents" style="padding-top:10px; text-align:center; color:#fff;">' . $content . '</div>' .
			  '</div>';
  }	  
?>

 

Fontsizing keywords by weighted factors. I love it. After a day studying only one module of your work I got a slightly impression how much efforts you are putting in to bring this all to us. Thank you so much.

 

I consider it done so i posted the whole page. Hope its not to annoying.

 

Kind Regards

heranke


Recommended SEO Addons:

Most Important: Header Tags SEO - Ultimate SEO V 2.2d

Recommended Addons:

Also Purchased (AP) Preselection - Contribution 3294

Share this post


Link to post
Share on other sites

Hi Jack.

 

I must say this add-on has a lot of bells and whistles and it is hard for me as an old fart to figure it all out. I'll get there though. I did take to customizing some of the meta tags directly through my database interface. One thing I cannot figure out is why the model numbers are not showing up in the page titles. Can you point me in the right direction to fix this? Thaks..

Share this post


Link to post
Share on other sites

@@heranke Thank you for taking the time to troubleshoot and post your results. I'm sure it will help others.

Share this post


Link to post
Share on other sites

Hi Jack.

 

I must say this add-on has a lot of bells and whistles and it is hard for me as an old fart to figure it all out. I'll get there though. I did take to customizing some of the meta tags directly through my database interface. One thing I cannot figure out is why the model numbers are not showing up in the page titles. Can you point me in the right direction to fix this? Thaks..

There shouldn't be any reason to edit the database directly. All of the titles and tags can be edited in admin, either in Page Control or in one of the edit pages, like product edit. For the model number to show up, be sure to check the model checkbox in Page Control for whatever page you want them on.

Share this post


Link to post
Share on other sites

There shouldn't be any reason to edit the database directly. All of the titles and tags can be edited in admin, either in Page Control or in one of the edit pages, like product edit. For the model number to show up, be sure to check the model checkbox in Page Control for whatever page you want them on.

 

OK, I messed around with the settins and think I have that part figured out now - tyvm.

 

I would like to alter the model number though and not sure where to do this. My model numbers in the database are pre-pended with a 3 digit manufacturer code, but I need this stripped out. That I know how to do, but I need to know which file to change. Thanks..

Share this post


Link to post
Share on other sites

OK, I think I've found what i need if you can just verify

 

$tmpTags['prod_model'] = (tep_not_null($the_product_info['products_model'])) ? $the_product_info['products_model'] : '';

$tmpTags['prod_model'] = (substr($tmpTags['prod_model'],3));

 

That should do it, right?

 

Seems to work as I need it to. You need not respond unless there are any other places that might need fixing.. Thanks Jack

Edited by AJRYAN

Share this post


Link to post
Share on other sites

Jack, I just noticed that featured products is not in the file list. Is there a reason for that or ?? I tried selecting add missing pages though that didn't help. I suspect for some reason that didn't get added to the database (it's not there) perhaps a glitch during the installation. Was that supposed to be pulled from the filenames.php file? Perhaps I should just add it manually to the db? - no big deal.

 

Thanks..

Share this post


Link to post
Share on other sites

Do you have a page named featured products or are you referring to some addon that displays featured products on an existing page? If it is a page and you are using 2.3, then it should show up.

Share this post


Link to post
Share on other sites

Do you have a page named featured products or are you referring to some addon that displays featured products on an existing page? If it is a page and you are using 2.3, then it should show up.

 

There is a page featured_products.php. I don't recall if this was an add-on or came with stock OSC. Seems to have been there as long as I can remember. It's on a massively optimized shop from 2004, 2.2 I think.. thanks

Share this post


Link to post
Share on other sites

Then you probably need to add the header tags code to its head section. See the install_catalog file for that. A shop that old may have a number of security issues if they have not bee corrected. This is unrelated to Header Tags SEO but I thought I should mention. I suggest you check your site with our security checker.

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

Hi, is the facility to add the product filter name/title to the category page included in this ? Ie currently a category title might be 'Red Widgets' (I love widgets), however when using the filter to select a manufacturer, the title of the resulting filtered page still remains 'Red Widgets' and does not change to 'Acme Red Widgets' . Can this be altered? Can the filtered page carry the filter name in both title and description?

Share this post


Link to post
Share on other sites

I'm sorry but I don't know what you mean by "filter." There's nothing in Header Tags SEO by that name, that I can recall. But if you are asking why a categories name isn't showing up for the title on the categories page, assuming this addon is installed correctly, it is probably because you haven't checked the categories box in Page Control for the index.php file.

Share this post


Link to post
Share on other sites

Hi Jack, no sorry I perhaps didn't explain well. Leaving your contrib aside for one minute.. When viewing a product list page in OSC, we are also given the choice to further refine that list by choosing products from the relevant manufacturers via the product list filter. However, when we do this, the resulting page carries no mention of the manufacturer in the header tags. So, what i'm asking is, is it possible with HTC to add the manufacturer name to the resulting page?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×