mk_osc Posted October 1, 2017 Share Posted October 1, 2017 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? Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 1, 2017 Author Share Posted October 1, 2017 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. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mk_osc Posted October 1, 2017 Share Posted October 1, 2017 (edited) 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 October 1, 2017 by mk_osc Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 2, 2017 Author Share Posted October 2, 2017 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. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mk_osc Posted October 2, 2017 Share Posted October 2, 2017 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. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 3, 2017 Author Share Posted October 3, 2017 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. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mk_osc Posted October 3, 2017 Share Posted October 3, 2017 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> Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 3, 2017 Author Share Posted October 3, 2017 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. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mk_osc Posted October 3, 2017 Share Posted October 3, 2017 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 Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 3, 2017 Author Share Posted October 3, 2017 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. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
DjViper Posted October 9, 2017 Share Posted October 9, 2017 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 Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 9, 2017 Author Share Posted October 9, 2017 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. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
DjViper Posted October 9, 2017 Share Posted October 9, 2017 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 Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 9, 2017 Author Share Posted October 9, 2017 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. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
DjViper Posted October 9, 2017 Share Posted October 9, 2017 (edited) 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 October 9, 2017 by DjViper Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 10, 2017 Author Share Posted October 10, 2017 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. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mk_osc Posted October 12, 2017 Share Posted October 12, 2017 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 -> Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 12, 2017 Author Share Posted October 12, 2017 Remove the following in admin/includes/functions/header_tags.php $path = str_replace("https:", "http:", $path); Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mk_osc Posted October 15, 2017 Share Posted October 15, 2017 thanks, that worked 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 --> Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 16, 2017 Author Share Posted October 16, 2017 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? Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mk_osc Posted October 16, 2017 Share Posted October 16, 2017 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. Quote Link to comment Share on other sites More sharing options...
MrPhil Posted October 16, 2017 Share Posted October 16, 2017 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. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 16, 2017 Author Share Posted October 16, 2017 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); Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
mk_osc Posted October 16, 2017 Share Posted October 16, 2017 (edited) 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". Edited October 16, 2017 by mk_osc fixed typo Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted October 16, 2017 Author Share Posted October 16, 2017 Replace the file mentioned previously with the following. It should conform to their changed rules. But it is only for one price/language. If multiple prices are present, the code would have to be altered further for that. <?php $loc = explode(',',$_SERVER["HTTP_ACCEPT_LANGUAGE"]); $ogArray = array(); $ogArray['site_name'] = STORE_NAME; $ogArray['locale'] = str_replace('-', '_', $loc[0]); $showOG = false; $showProduct = false; $showTwitter = false; $twitterArray = array(); $db_query = tep_db_query("select groupname as storename, data as creator from headertags_social where section = 'twitter'"); $db = array(); if (tep_db_num_rows($db_query)) { $db = tep_db_fetch_array($db_query); $twitterArray[] = '<meta name="twitter:card" content="summary">'; $twitterArray[] = '<meta name="twitter:site" content="@' . $db['storename'] . '">'; $showTwitter = true; } switch (true) { case (basename($_SERVER['SCRIPT_FILENAME']) === 'index.php'): if ($category_depth == 'top') { $img = (file_exists('store_logo.png') ? tep_href_link('images/store_logo.png', '', $request_type, false, false) : ''); if (! tep_not_null($canonical_url)) { $canonical_url = GetCanonicalURL(); } $twitterArray[] = '<meta name="twitter:creator" content="@' . $db['creator'] . '">'; $twitterArray[] = '<meta name="twitter:url" content="' . tep_href_link('index.php', '', $request_type, false) . '">'; $twitterArray[] = '<meta name="twitter:title" content="' . $header_tags_array['title'] . '">'; $twitterArray[] = '<meta name="twitter:description" content="' . $header_tags_array['desc'] . '">'; $twitterArray[] = '<meta name="twitter:image" content="' . $img . '">'; $ogArray['type'] = 'website'; $ogArray['image'] = $img; $ogArray['url'] = $canonical_url; $showOG = true; } break; case (basename($_SERVER['SCRIPT_FILENAME']) === 'product_info.php'): case (basename($_SERVER['SCRIPT_FILENAME']) === 'product_reviews.php'): case (basename($_SERVER['SCRIPT_FILENAME']) === 'product_reviews_info.php'): if ($_GET['products_id'] > 0) { $og_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_quantity, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_available from products p, products_description pd where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); if ( tep_db_num_rows($og_query) > 0 ) { $og = tep_db_fetch_array($og_query); $img = (tep_not_null($og['products_image']) ? tep_href_link('images/' . $og['products_image'], '', $request_type, false, false) : ''); $url = tep_href_link('product_info.php', 'products_id=' . $og['products_id'], $request_type, false); /**** Get the price ****/ if (($new_price = tep_get_products_special_price($og['products_id']))) { } else { $new_price = $og['products_price']; } $og_price = $currencies->display_price($new_price, tep_get_tax_rate($og['products_tax_class_id'])); $og_price = substr($og_price, 1); $twitterArray[] = '<meta name="twitter:creator" content="@' . $db['creator'] . '">'; $twitterArray[] = '<meta name="twitter:url" content="' . $url . '">'; $twitterArray[] = '<meta name="twitter:title" content="' . htmlspecialchars($og['products_name'], ENT_QUOTES) . '">'; $twitterArray[] = '<meta name="twitter:description" content="' . GetOGDescription($og['products_description']) . '">'; $twitterArray[] = '<meta name="twitter:image" content="' . $img . '">'; $twitterArray[] = '<meta name="twitter:data1" content="' . $og_price . '">'; $twitterArray[] = '<meta name="twitter:label1" content="' . HTS_OG_PRICE . '">'; $twitterArray[] = '<meta name="twitter:data2" content="' . $og['products_quantity'] . '">'; $twitterArray[] = '<meta name="twitter:label2" content="' . HTS_OG_AVAILABLE_STOCK . '">'; $ogArray['type'] = 'product'; $ogArray['title'] = htmlspecialchars($og['products_name'], ENT_QUOTES); $ogArray['description'] = GetOGDescription($og['products_description']); $ogArray['image'] = $img; $ogArray['url'] = $url; $ogArray['product:price:amount'] = $og_price; $ogArray['product:price:currency'] = $currency; $ogArray['availability'] = ($og['products_date_available'] > date('Y-m-d H:i:s') ? 'pending' : $og['products_quantity'] < 1 ? 'oos' : $og['products_quantity'] > 0 ? 'instock' : 'oos'); $showOG = true; $showProduct = true; } } break; case (defined('article_info.php') && basename($_SERVER['SCRIPT_FILENAME']) === 'article_info.php'): if ($_GET['articles_id'] > 0) { $og_query = tep_db_query("select a.articles_date_added, a.articles_last_modified, ad.articles_image, ad.articles_name, a.authors_id, ad.articles_description, ad.articles_url, au.authors_name, td.topics_name from articles a left join authors au on a.authors_id = au.authors_id left join articles_description ad on a.articles_id = ad.articles_id left join articles_to_topics a2t on a.articles_id = a2t.articles_id left join topics_description td on a2t.topics_id = td.topics_id where a.articles_status = '1' and a.articles_id = '" . (int)$_GET['articles_id'] . "' and ad.language_id = '" . (int)$languages_id . "'"); if ( tep_db_num_rows($og_query) > 0 ) { $og = tep_db_fetch_array($og_query); $img = (tep_not_null($og['articles_image']) ? tep_href_link('images/' . $og['articles_image'], '', $request_type, false, false) : ''); $url = tep_href_link('article_info.php', 'article_id=' . $og['articles_id'], $request_type, false); $twitterArray[] = '<meta name="twitter:creator" content="@' . (tep_not_null($og['authors_name']) ? $og['authors_name'] : $db['creator']) . '">'; $twitterArray[] = '<meta name="twitter:url" content="' . $url . '">'; $twitterArray[] = '<meta name="twitter:title" content="' . htmlspecialchars($og['articles_name'], ENT_QUOTES) . '">'; $twitterArray[] = '<meta name="twitter:description" content="' . GetOGDescription($og['articles_description']) . '">'; $twitterArray[] = '<meta name="twitter:image" content="' . $img . '">'; $ogArray['type'] = 'article'; $ogArray['url'] = $url; $ogArray['description'] = GetOGDescription($og['articles_description']); $ogArray['tag'] = $header_tags_array['keywords']; if (isset($og['articles_date_added'][1])) $ogArray['published_time'] = $og['articles_date_added']; if (isset($og['articles_last_modified'][1])) $ogArray['modified_time'] = $og['articles_last_modified']; if (isset($og['expiration_time'][1])) $ogArray['expiration_time'] = $og['expiration_time']; if (isset($og['authors_name'][1])) $ogArray['author'] = $og['authors_name']; if (isset($og['authors_id'][1])) $ogArray['author'] = tep_href_link('articles.php', 'authors_id=' . $og['authors_id'], $request_type, false); if (isset($og['topics_name'][1])) $ogArray['section'] = $og['topics_name']; if (isset($og['articles_image'][1])) $ogArray['image'] = $img; $showOG = true; } } break; } if ($showTwitter) { foreach ($twitterArray as $tag => $data) { echo $data . "\n"; } } if ($showOG) { foreach ($ogArray as $tag => $data) { if ($showProduct && strpos($tag, 'product:price:') !== FALSE) { echo '<meta property="' . $tag . '" content="' . $data . '" />' . "\n"; } else { echo '<meta property="og:' . $tag . '" content="' . $data . '" />' . "\n"; } } } Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.