Jump to content
Jack_mcs

Header Tags SEO

Recommended Posts

Something else I hadn't noticed. The following changes should fix it.  In headertags_seo_styles.css, add

.hts_bookmarks_place {padding:10px 0;float:right}

In includes/modules/header_tags_social_bookmarks.php change

    echo '<div style="float:right;">';
    if (HEADER_TAGS_ENABLE_GOOGLE_PLUS == 'true') {
    echo '<div style="float:left; padding-top:' . $padding . 'px; padding-right:20px;"><g:plusone></g:plusone></div>';
    }
    echo '<div style="float:right;">' . $dataStr . '</div>';

to this (you are just removing the style code)

    echo '<div>';
    if (HEADER_TAGS_ENABLE_GOOGLE_PLUS == 'true') {
    echo '<div style="float:left; padding-top:' . $padding . 'px; padding-right:20px;"><g:plusone></g:plusone></div>';
    }
    echo '<div>' . $dataStr . '</div>';

In index.php, or wherever it is in your shop, change

          if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true') {
            echo '<div>';
            include(DIR_WS_MODULES . 'header_tags_social_bookmarks.php'); 
            echo '</div>';
          }

to

          if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true') {
            echo '<div class="row"><div class="hts_bookmarks_place">';
            include(DIR_WS_MODULES . 'header_tags_social_bookmarks.php'); 
            echo '</div></div>';
          }

 

Share this post


Link to post
Share on other sites

thanks, that fixed the problem on index.php and on product pages.

However, on products_new.php the social bookmarks still don't show up.

I have this in
includes/modules/content/index/templates/new_products.php

<!--- Begin Header Tags SEO Home Page Text and Social Bookmarks -->
<?php

    if (tep_not_null($header_tags_array['home_page_text'])) {
        echo '<div>';
        echo '<div style="padding:10px 0;">' . $header_tags_array['home_page_text'] . '</div>';
        echo '</div>';

    }
    if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true') {
        echo '<div class="row"><div class="hts_bookmarks_place">';
        include(DIR_WS_MODULES . 'header_tags_social_bookmarks.php');
        echo '</div></div>';
    }
?>
 <!--- END Header Tags SEO Home Page Text and Social Bookmarks -->


Did I miss anything?

 

 

Share this post


Link to post
Share on other sites

No, you didn't miss anything. The problem is that in older versions of oscommece, even in some 2.3.4 versions, the changes needed to be made to the individual pages. With the BS version, the contents of those pages were moved to modules so the changes should be made there. But some of those pages use the product listing module so, for those, the social tags code should be made in that module. Since I try to maintain my addons for all versions, this creates a big problem and is why I will be dropping support for some versions next year.

But for now, add the social code (below) to the includes/modules/product_listing.php file, right above the last </div>. You will need to then remove it from any file it was added to that uses that module, like in the index file. So if you search a file for product_listing.php and find the social code by it, remove that social code.

    <!--- BEGIN Header Tags SEO Social Bookmarks -->
    <?php if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true') {
      echo '<div style="margin-top:5px; float:right;">';
      include('includes/modules/header_tags_social_bookmarks.php');
      echo '</div>';    }
    ?>
    <!--- END Header Tags SEO Social Bookmarks -->

I apologize for the bother this causes anyone. I haven't had time to work through all of the variations to provide the best way to apply the changes.

Share this post


Link to post
Share on other sites

Hi, appreciate your help.
However this is getting rather confusing now.

When I add this to the file includes/modules/product_listing.php , and remove the code from index.php, the icons no longer show up on the index.php
If I don't remove the code from index.php it's working fine. Also the product pages are working fine.
However on the category pages, it is appearing twice, no matter if I remove it from index.php or not.
 

btw, the mentioned code to product_listing.php will bring back the issue with disappearing icons, when viewing the page on lower resolution.
So I used this code instead as suggested earlier:

      }
      if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true') {
        echo '<div class="row"><div class="hts_bookmarks_place">';
        include(DIR_WS_MODULES . 'header_tags_social_bookmarks.php');
        echo '</div></div>';
      }

But even if I use the original code, the problem with the double entries on category pages still exist.
A agree that oscommerce is very fragmented with all the different versions now.
I just decided to go with the latest bootstrap to make it responsive.

But I'm lost again now .... since I have no clue, why it  is appearing twice on category pages.

Edited by mk_osc

Share this post


Link to post
Share on other sites

You were correct to use the code you did. I had coped what I posted from the addon and forgot about the change.

In case you are not aware of it, the index.php file serves three purposes. It displays the home page, the category and manufacturer pages and the products for those. So when you say "no longer show on the index.php", that isn't describing the situation, unless you mean the icons don't show up anywhere, which means you didn't change the product listing file.

By making the change to the product_listing file, you will include the icons on any page where that is used. So if you have the new_products module, or a similar one, enabled for the home page, it will call the product_listing module. In that case, you don't need the code added to the home page since that will cause duplicates. But should you ever remove that module, then you will lose the icons since the product_listing file won't be loading.

So, unfortunately, the best solution is to remove the change to the product listing file and then add it to whatever page you want the icons to show on. There's no simple way to do this that I can see at the moment.

 

Share this post


Link to post
Share on other sites

ok, thanks. I've fixed the issue with the social icons.

I'm troubleshooting another one right now.

On header_tags_seo_keywords.php I'm supposed to be able to check the Google Position, when I click the buttons in the 'Get Position' column, however after clicking it, the following appears in the column 'Google Position': URL required

I looked at the code, and could only find a typo
in line 426
                <tr><td hiehgt="10"></td></tr>

and changed it to
                <tr><td height="10"></td></tr>

But that has of course nothing to do with it.

Any suggestions where or what to check?
I've searched my files for the phrase "URL required", but there was no match.
Maybe this is a message directly from the google server and the script did not properly submit the data?

Thanks for any help.

Share this post


Link to post
Share on other sites

In order to check the position the code has to know what domain to check. You can enter the url in the box on that page or in the setting. See the Options help file in Page Control for an explanation of the options.

Thanks for mentioning the spelling mistake.

Share this post


Link to post
Share on other sites

cool, thanks.
But then I always receive 0 / Not Found
even for keywords which show up, when I search manually on google.

So I've ran a test with curl on the server and grabbed your query URL format  from headertags_seo_position_google.php to verify if the match for the keyword is shown there, too.
However I'm only receiving a 302 server response, see below. Not sure if I made the test correctly, but I hope this gives an indication on why the results are always 0

curl http://www.google.com/search?q=testquery&hl=en&biw=1280&bih=520&num=10&start=1&lr=&ft=i&cr=&safe=images&tbs=
[1] 96
[2] 97
[3] 98
[4] 99
[5] 100
[6] 101
[7] 102
[8] 103
[9] 104
[10] 105
[2]   Done                    hl=en
[3]   Done                    biw=1280
[4]   Done                    bih=520
[5]   Done                    num=10
[6]   Done                    start=1
[7]   Done                    lr=
[8]   Done                    ft=i
[9]-  Done                    cr=
[~]# <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://ipv4.google.com/sorry/index?continue=http://www.google.com/search%3Fq%3Dtestquery&q=EgRA6-VkGNX4zc4FIhkA8aeDS7-zwdQQaeb6kLmrreT0oqXSZtXaMgFy">here</A>.
</BODY></HTML>


 

Share this post


Link to post
Share on other sites

I just checked it on two sites and the position was found and reported. If you go to google, do a search and find your listing, the url that shows for that page should be very similar to what the code uses. It can vary a little due to parameters but it should be close. Be sure the url you enter in admin is the actual url. So if your url uses www, the setting should use www. Don't use http or https in the url.

Share this post


Link to post
Share on other sites

ok, since I got the 302 moved response at the first test and now receiving 403 server response I researched a little on the web.

And found this:
https://stackoverflow.com/questions/22657548/is-it-ok-to-scrape-data-from-google-results/22703153#22703153

They are stating that without the Google search API, only 8 automated requests are allowed per hour. When retrieving e.g. 3 pages for each keyword to detect Google position, I can only check 2 keywords per hour.
When using their Google search API, they mention that the limit is 40 requests per hour.

I did not know and I checked much more than 2 keywords at 3 pages per hour, which then obviously resulted in a block from my server IP :sad:

 

Share this post


Link to post
Share on other sites

That's a general guideline. Go to google and search a phase. Go to the next page and search again. You will find you can do many pages without any problems, in most cases. If they limited it to 8/hour very few people would use google. But there is a limit and is why I didn't put in a "check many keywords at once" option. That would most likely cause a block.  

Share this post


Link to post
Share on other sites

Hi, Jack

Question about the Update, i'm trying to update using the update text file for changes. At point 7 i'm stuck, it's not in the categories file under admin, also not in your files of a fresh install of seo ?

Greetings, Anne

 

Share this post


Link to post
Share on other sites

Hi Anne. I'm sorry but I can't answer without knowing the name of the update file you are using and the version of your shop.

Share this post


Link to post
Share on other sites
3 hours ago, Jack_mcs said:

Hi Anne. I'm sorry but I can't answer without knowing the name of the update file you are using and the version of your shop.

BS Gold - file 2.3.4 to 2.3.5 last update.

Also not found in the package files of 2.3.5 categories.php file.

 

Greetings, Anne

Share this post


Link to post
Share on other sites

I assume you mean 3.3.4 to 3.3.5 since there are not any update files starting with 2.

Step 7 mentions "products_head_sub_text". That was added in version 3.2.7 so if you are uploading from a version before that, you have to run through all of the update files.

I just checked the zip package and there is a categories file in it at /catalog\admin\categories.php. You have to choose the directory that best applies to your shop. There isn't one for the Gold version but I think the "Use_if_version_greaterthan_2.3" would be closest.

 

Share this post


Link to post
Share on other sites

Hi,

Oke, installed it from 3.3.2 but oke. But i just checked those files also no mention of 

$products_head_sub_text = $HTTP_POST_VARS['products_head_sub_text'];

and point 8 only one time. 

Also checked the greater than, lower than and bootstrap version of categories.php all have no mention of this line in the packages.

Or i must be looking very over them.

It is mentioned in the less than 2.3 file set of categories.php

But i installed it fresh from BS Gold greater than 2.3 where it is not mentioned.

Greetings, Anne

Edited by DjViper

Share this post


Link to post
Share on other sites

It's important to understand that the install files are not always accurate. That is because, as mentioned in a recent post, there are many versions of oscommerce out there and the included files and the install and update files may not match. In the 3.3.5 file named Update_from_V_3.3.4_to_V_3.3.5.txt, it says to find this code:

$products_head_sub_text = $HTTP_POST_VARS['products_head_sub_text'];

You will see that line in the HeaderTags_SEO_V_3.3.4\Use_if_version_lessthan_2.3\catalog\admin\categories.php at line 736. It doesn't exist in 2.3 shops.

This is why I will be dropping install instructions for shops other than the Bootstrap version. There is just no reasonable way to list all of the possibilities.

Instead of trying to follow all of the update files, you would be better off either using the main install instructions for the greater than 2.3 version or, probably better, use a compare program like WinMerge, which is free, to compare the included files.

Share this post


Link to post
Share on other sites

hi,

I've a 301 redirection in place to direct my http requests to https

But when I now test with header_tags_test.php I get this below. Where do I have to adjust the code, that it works with https ?

  From Site:
    Title -> 301 Moved Permanently
    Meta Description ->

    Meta Keywords ->

Share this post


Link to post
Share on other sites

Remove the following in admin/includes/functions/header_tags.php

$path = str_replace("https:", "http:", $path);

 

Share this post


Link to post
Share on other sites

thanks, that worked :thumbsup:

I've another issue now:

When I test a product page with social bookmarks in the Open Graph Object Debugger: https://developers.facebook.com/tools/debug/og/object/
I get this warning:


Extraneous Property    Objects of this type do not allow properties named 'og:currency'.

Parser Mismatched Metadata    The parser's result for this metadata did not match the input metadata. Likely, this was caused by the data being ordered in an unexpected way, multiple values being given for a property only expecting a single value, or property values for a given property being mismatched. Here are the input properties that were not seen in the parsed result: 'product:price, og:currency'

on the page source code i Have
[...]

<meta property="og:price" content="$179.00" />
<meta property="og:currency" content="USD" />
<meta property="og:availability" content="instock" />
 <!-- EOF: Header Tags SEO Generated Meta Tags by oscommerce-solution.com -->

Share this post


Link to post
Share on other sites

Does the test tool show that it is one of the properties you mention? The FB parser is know to be sensitive to some things, like names with space and dates in certain formats. Maybe it is something like that?

Share this post


Link to post
Share on other sites

I think it may be caused due to the currency symbol $
Google was also picky when the currency symbol was included with the price. And as we define the currency in an extra property, that might cause the problem. What do you think?
I don't know how I can test it without it, since I don't know know which code to change.

Share this post


Link to post
Share on other sites
Quote

<meta property="og:price" content="$179.00" />

<meta property="og:currency" content="USD" />

I wouldn't be terribly surprised if giving the currency twice (explicit '$' in price, and 'USD' in currency), is upsetting somebody. Can you format the price as simply '179.00'? If the code is pulling the price from some other field, and it already has '$' in it, something as simple as changing $price to 

...substr($price, 1)... 

might do the job.

Share this post


Link to post
Share on other sites

Markus: The fix Phil mention is how to do it. In the includes/modules.header_tags_opengraph.php file, find this line

$og_price = $currencies->display_price($new_price, tep_get_tax_rate($og['products_tax_class_id']));

and add this one below it

$og_price = substr($og_price, 1);

 

Share this post


Link to post
Share on other sites

did not fix the issue. so I researched further.

According to Facebook's documentation og:price and og:currency is not valid

It should have the prefix "product" instead of "og".

product_Open_Graph_Object_Type_-_2017-10-16_18.42.00.png

Edited by mk_osc
fixed typo

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

×