Jump to content
Jack_mcs

Header Tags SEO

Recommended Posts

I came across a small problem with the Search Site portion of the keywords page misbehaving  - and Jack promptly offered the below solution:

 

@@Jack_mcs

The problem is in the admin/header_tags_seo_ajax.php file.

 

Find these two lines and reverse the order 

 

$assignedID = (tep_not_null($searchWords) ? GetProductID($searchWords, $keyword, $keywords['language_id']) : '');
$keyword = $keywords['keyword'];

to

$keyword = $keywords['keyword'];
$assignedID = (tep_not_null($searchWords) ? GetProductID($searchWords, $keyword, $keywords['language_id']) : '');

from package 3.3.3.1, greater than 2.3 version. I did not check if other versions effected. Thank you Jack for the great support!


-Dave

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

small bug - but I'm pulling my hair out looking where to fix it.

per https://developers.facebook.com/tools/debug/

 

<meta property="og:locale" content="en-US" />

 

should be using   en_US

 

Where do I sort that?

 

Also, FB wants images at least 200x200. All my main images are too small - is it possible to use the first large image if available, if not existing, then default main image?

 

Thanks as usual... :)

Edited by Roaddoctor

-Dave

Share this post


Link to post
Share on other sites

found header_tags_opengraph.php... can hack the first problem

 

any help on the image solution appreciated.


-Dave

Share this post


Link to post
Share on other sites

For those that might want the code change for the first problem, change this line in the includes/modules/header_tags_opengraph.php file

$ogArray['locale']  = $loc[0];

to

$ogArray['locale']  = str_replace('-', '_', $loc[0]);

For the image problem, that is a difficult one to do automatically since there are many possibilities between sites and I try to code for the vast majority of them. The code loads in the product image (I assume you are talking about products) since that is the only thing that is common across all versions of oscommerce. A field could be added in admin for it but that's a lot of extra work for the shop owner. I suppose a setting could be used to provide the database name of the alternate field. But short of that, you can just edit the MySQL call in the above file and have it load whichever image you want to use.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Good morning. Little question about includes/functions/header_tags.php. I see this

Error: Use of undefined constant DIR_WS_BOXES - assumed 'DIR_WS_BOXES'

File: includes/functions/header_tags.php

Line: 213

I have DIR_WS_BOXES defined in admin configure, but do not see it on shop side. The code looks like your breaking into 2.2 vs 2.3, is my configure correct or is it correct as is?  just trying to understand

/*****************************************************************
Used to retrieve a link for a tag cloud keyword
*****************************************************************/
function GetHTSTagCloudLink($keyword, $languages_id) {
    $quotes = (defined('QUOTES_CATEGORY_NAME')) ? " and p.customers_email_address = '' and p.quotes_email_address = '' " : '';
  
    $kwrd = tep_db_input($keyword);

    $searchDesc = '';
    $boxLocn = DIR_WS_BOXES . 'search.php';
    if (file_exists(DIR_WS_INCLUDES . 'template_top.php')) {  //this is a 2.3 shop
        $boxLocn = DIR_WS_MODULES . 'boxes/bm_search';
    } 
    if (file_exists($boxLocn)) {
        $fileStr = file_get_contents($boxLocn);
        if ($fileStr !== FALSE) {
            if (strpos($fileStr, "search_in_description','1'") !== FALSE) {
                $searchDesc = " or pd.products_description like '%" . $kwrd . "%' ";
            }
        }
    }


-Dave

Share this post


Link to post
Share on other sites

When coding an if statement, it is a little faster, and clearer to me, to set one of the conditions before the first if so I do that out of habit. But in this case, it is not correct. It won't hurt anything but will give the error you mention. The code should be like this:

    if (file_exists(DIR_WS_INCLUDES . 'template_top.php')) {  //this is a 2.3 shop
        $boxLocn = DIR_WS_MODULES . 'boxes/bm_search';
    } else {
        $boxLocn = DIR_WS_BOXES . 'search.php';
    }

Share this post


Link to post
Share on other sites

installing HT's 3_3_3_1 on regular osc234

 

in In product_reviews_info.php

FIND (around line 47):
  require(DIR_WS_INCLUDES . 'template_top.php');


ADD BENEATH:
<?php /*** Begin Header Tags SEO ***/
  <a name="<?php echo $header_tags_array['title']; ?>"></a>
  $review['products_name'] = $header_tags_array['title_alt'];


  if (tep_not_null($review['products_model'])) {
    $products_name = $review['products_name'] . '<br><span class="smallText">[' . $review['products_model'] . ']</span>';
  } else {
    $products_name = $review['products_name'];
  }
  /*** End Header Tags SEO ***/ 
<?php /*** End Header Tags SEO ***/ ?>

Dreamweaver giving syntax error 

changed this

  /*** End Header Tags SEO ***/ 
<?php /*** End Header Tags SEO ***/ ?>

tothis

/*** End Header Tags SEO ***/ ?>

but still getting them here.

<?php /*** Begin Header Tags SEO ***/
  <a name="<?php echo $header_tags_array['title']; ?>"></a>
Edited by zpupster

Share this post


Link to post
Share on other sites

I think you've made some sort of cut and past error... the block looks like this

  require(DIR_WS_INCLUDES . 'template_top.php');
 /*** Begin Header Tags SEO ***/ ?>
<a name="<?php echo $header_tags_array['title']; ?>"></a>
<?php
  $review['products_name'] = $header_tags_array['title_alt'];

  if (tep_not_null($review['products_model'])) {
    $products_name = $review['products_name'] . '<br><span class="smallText">[' . $review['products_model'] . ']</span>';
  } else {
    $products_name = $review['products_name'];
  }
  /*** End Header Tags SEO ***/ 
?>

-Dave

Share this post


Link to post
Share on other sites

ty road dr,

 

i copied that from the instructions.

 

 <?php /*** Begin Header Tags SEO ***/ ?>
<a name="<?php echo $header_tags_array['title']; ?>"></a>
<?php
  $review['products_name'] = $header_tags_array['title_alt'];


  if (tep_not_null($review['products_model'])) {
    $products_name = $review['products_name'] . '<br><span class="smallText">[' . $review['products_model'] . ']</span>';
  } else {
    $products_name = $review['products_name'];
  }
  /*** End Header Tags SEO ***/ 
?>

this worked

Share this post


Link to post
Share on other sites

@@zpupster

I haven't looked at the instructions text to see, but if you ever come across something in written instructions and have some sort of issue, use WinMerge or any comparison program to compare the package file to your own. Very helpful sometimes. Backup first...

Edited by Roaddoctor

-Dave

Share this post


Link to post
Share on other sites

Jack - Love the work you do and this is an awesome package.

 

That said, I have a weird error that I can't track down. Running OSC 2.3.3.4 and Header Tags SEO 3.3.2.  All tests run fine, no errors.

 

This page (and several like it):

http://mrwnh.com/product_info.php?products_id=100

works fine. But one of the links in the product text is coded as:

<a href="harnesses_from_udogu.php">UDogU Easy-On Dog Harness</a>

but when you hover over it, it converts itself to

mrwnh.com/<strong>Harnesses</strong>_from_udogu.php

and of course if you click on it the page fails.

 

This happens with all products that use this link in the description, not with just this one product.

 

The Product Description as typed into the product itself in Admin looks like this:

<p>Our <b>Teacup Easy-On Harness</b> is made of 1/2" webbing and is designed for a dog measuring 11" to 13" around the ribcage. Please measure your dog carefully using the diagram on the <a href="harness_sizing_for_dogs.php">Harness  Sizing</a> page to avoid having to return your harness for a different size. For more information about our Easy-On Harnesses, please visit <a href="why_use_a_dog_harness.php">Why Use a Harness?</a> and <a href="harnesses_from_udogu.php">UDogU Easy-On Dog Harness</a>.

Only the very LAST link in the paragraph has this problem.

 

I think it maybe has something to do with SEO Header Tags bolding the keyword "harness" in the URL? But it doesn't seem to happen with the other links that include the same word.

 

Any ideas?

Edited by robinwarren

Share this post


Link to post
Share on other sites

Yes, it is probably because of the keyword highlighter. You can turn that off to check it. Although, you shouldn't use links like that in the products description. The embed link is meant for that purpose. The highlighter might still cause this problem but at least your links will be correctly formatted.

Share this post


Link to post
Share on other sites

Hello

I need some help with Header Tags Seo in order to get it fully working.

Here is what i've done :

- I've installed a brand new Oscommerce 2.3.4 for test. No add-ons.

- I've also installed the last version of Header Tags Seo (HeaderTags_SEO_V_3.3.3_1) using the instructions in "Use_if_version_greaterthan_2.3" folder.

The install process was ok.
The admin side is ok.
The tags for products, categories, manufacturers and pages are all ok.

But i have problems with the front side of the shop. Here are the main ones.

1) The header-tags social box does not display correctly. No border, no box, only some social icons on white background. When the product page is displayed in internet explorer, the right column of the oscommerce interface is gone. Probably a html tag problem in this box. When the header-tags social box is not displayed, there is no problem. The 2 other boxes works ok.

2) There is a problem with product listing. When "Enable AutoFill - Listing Text" is true, the text is ok.
When i add a personnalised product listing text, it is displayed on top of the product listing, not with the product.

3) Problem on the product page (product_info.php). The product image reverts to old style (open a classic window when clicked to zoom).

 

Has someone already had these problems and found solutions ?

Or is there a bug in my test installation ?
 

Thanks for upcoming replies.

Share this post


Link to post
Share on other sites

As mentioned in a previous post, the install instructions may not be correct. That is my fault. It takes a while to create the instructions and now with three versions to maintain, it just came down to a matter of not having enough time. But I can't say for sure that that is the cause of all of your problems. It seems unlikely since I don't think the instructions are that far off. Since this is a new shop, you can just copy the files that are having a problem from the package and see if that fixes them. For the autofill one, replace the includes/modules/product_listing.php file and for the product one, the product_info.php file. Do them one at a time. Make backups of the originals. If replacing the file fixes the problem, download WinMerge, or use any compare program, and compare the two files to see where the mistake is at. I don't suggest just uploading the files and leaving them since I'm not sure which version of 2.3 they use.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Noticed yesterday that canonical on categories pages was showing /index.php instead of the category  - the mismatch triggers page not-indexable status with google. Clicking thru the categories, I noticed sometimes the /index.php would show, and sometimes the correct url would show.

After scouring this thread, found similar issues but no specific answers, but all related to the cache.

Disabling cache resolves the problem.

 

Any suggestions for me?


-Dave

Share this post


Link to post
Share on other sites

The gzip cache option has never worked correctly so if you are using that, try the other method (be sure to clear it using the admin setting). But if that fails too, then turn it off. I haven't changed the cache code in many years and it needs to be re-done but just haven't had the time.

Share this post


Link to post
Share on other sites

@@Jack_mcs

 

Thanks Jack, cache was set normal, not gzip. Disabled for now. all is ok.

 

separate issue, or question actually

canonical is showing on all https pages as http. Is this expected/normal? or should it be fixed?


-Dave

Share this post


Link to post
Share on other sites

In the past, secure pages should not have been seen by search engines so the code creates the links as non-ssl. But nowadays, some shops are running ssl for the whole shop, which I don't agree with, so for those sites the code will cause problems. If you are not running your site under full ssl, then something is wrong in your shops setup since those pages should not be visible to the search engines. If you are running your shop with full ssl, then you will need to edit the includes/header_tags.php and includes/functions/header_tags,php files and change the NONSSL entries to SSL.

Share this post


Link to post
Share on other sites

What about having canonical correct regardless of SSL or NONSSL, and of course use Robot NoIndex Module properly to set no-index.

good idea or not?

includes/functions/header_tags.php

function GetCanonicalURL() {
  global $request_type;  // testing

  $parts = explode("&", $_SERVER['QUERY_STRING']);
  $cnt = count($parts);
  $args = array(); // testing

  if ($cnt == 1 && basename($_SERVER['SCRIPT_FILENAME']) === FILENAME_DEFAULT) { //home page
     global $cPath,$category_depth;

     if (tep_not_null($cPath) || (isset($_GET['manufacturers_id']) && $category_depth == 'top')) {
        $args = tep_get_all_get_params(array('action','currency', tep_session_name(),'cPath','manufacturers_id','sort','page', 'language'));
//        return StripSID(tep_href_link(FILENAME_DEFAULT, $args, 'NONSSL', false) );
        return StripSID(tep_href_link(FILENAME_DEFAULT, $args, $request_type, false) );
     }

//     $url = StripSID(tep_href_link('/', $args, 'NONSSL', false) );
     $url = StripSID(tep_href_link('/', $args, $request_type, false) );

     if (substr($url, -2) == '//') {
         $url = substr($url, 0, -1);       //remove duplicate slashes
     }    
     return $url;    
  }  

  $args = tep_get_all_get_params(array('action','currency', tep_session_name(),'cPath','manufacturers_id','sort','page', 'language'));
//  return StripSID(tep_href_link(basename($_SERVER['SCRIPT_FILENAME']), $args, 'NONSSL', false) );
  return StripSID(tep_href_link(basename($_SERVER['SCRIPT_FILENAME']), $args, $request_type, false) );

}

seems to be functioning as expected.


-Dave

Share this post


Link to post
Share on other sites

I haven't tested it but when I get around to making the change, that is the way I would add the ssl code. I don't understand your statement about the no index module. That doesn't exist in this addon.

Share this post


Link to post
Share on other sites

modules -> header tags -> Robot NoIndex

 

to set No Index on ssl pages and whatever else appropriate....

 

Sorry I was unclear on that.

 Dave 


-Dave

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

×