Jump to content
Jack_mcs

Header Tags SEO

Recommended Posts

39 minutes ago, Jack_mcs said:

@artfulwebFor the first change you made, you replaced product handling code with category handling code so that won't work. For problem #1, that may be related to that incorrect change. For problem #2, it appears you didn't upload the new file for v 15. Previous versions of Phoenix changed language_id to id. In  v 15, some, but not all, of those changes were reversed. That's the only reason a version of this addon was needed for 15 .

Sorry Jack, it was 

           /*** Begin Header Tags SEO ***/
          'categories_seo_title' => Text::prepare(strip_tags((tep_not_null($_POST['categories_seo_title'][$l]['id']) ? str_replace('"', '"', $_POST['categories_seo_title'][$l]['id']) : str_replace('"', '"', $_POST['categories_name'][$l]['id'])))),
          'categories_seo_description' => Text::prepare(strip_tags((tep_not_null($_POST['categories_seo_description'][$l]['id']) ? str_replace('"', '"', $_POST['categories_seo_description'][$l]['id']) : str_replace('"', '"', $_POST['categories_name'][$l]['id'])))),
          'categories_seo_keywords' => Text::prepare(strip_tags((tep_not_null($_POST['categories_seo_keywords'][$l]['id']) ? str_replace('"', '"', $_POST['categories_seo_keywords'][$l]['id']) : str_replace('"', '"', $_POST['categories_name'][$l]['id'])))),


 that I changed to 

            'categories_seo_description' => Text::prepare($_POST['categories_seo_description'][$l['id']]),
            'categories_seo_title' => Text::prepare($_POST['categories_seo_title'][$l['id']]),
            'categories_seo_keywords' => Text::prepare($_POST['categories_seo_keywords'][$l['id']]),
         /*** Begin Header Tags SEO ***/

 

and for products

            'products_seo_title' => Text::prepare(strip_tags((tep_not_null($_POST['products_seo_title'][$language_id]) ? str_replace('"', '"', $_POST['products_seo_title'][$language_id]) : str_replace('"', '"', $_POST['products_name'][$language_id])))),
            'products_seo_description' => Text::prepare(strip_tags((tep_not_null($_POST['products_seo_description'][$language_id]) ? str_replace('"', '"', $_POST['products_seo_description'][$language_id]) : str_replace('"', '"', $_POST['products_name'][$language_id])))),
            'products_seo_keywords' => Text::prepare(strip_tags((tep_not_null($_POST['products_seo_keywords'][$language_id]) ? str_replace('"', '"', $_POST['products_seo_keywords'][$language_id]) : str_replace('"', '"', $_POST['products_name'][$language_id])))),

TO:

            'products_seo_description' => Text::prepare($_POST['products_seo_description'][$language_id]),
            'products_seo_keywords' => Text::prepare($_POST['products_seo_keywords'][$language_id]),
            'products_seo_title' => Text::prepare($_POST['products_seo_title'][$language_id]),
 

 

Share this post


Link to post
Share on other sites
15 minutes ago, artfulweb said:

Sorry Jack, it was 

           /*** Begin Header Tags SEO ***/
          'categories_seo_title' => Text::prepare(strip_tags((tep_not_null($_POST['categories_seo_title'][$l]['id']) ? str_replace('"', '"', $_POST['categories_seo_title'][$l]['id']) : str_replace('"', '"', $_POST['categories_name'][$l]['id'])))),
          'categories_seo_description' => Text::prepare(strip_tags((tep_not_null($_POST['categories_seo_description'][$l]['id']) ? str_replace('"', '"', $_POST['categories_seo_description'][$l]['id']) : str_replace('"', '"', $_POST['categories_name'][$l]['id'])))),
          'categories_seo_keywords' => Text::prepare(strip_tags((tep_not_null($_POST['categories_seo_keywords'][$l]['id']) ? str_replace('"', '"', $_POST['categories_seo_keywords'][$l]['id']) : str_replace('"', '"', $_POST['categories_name'][$l]['id'])))),


 that I changed to 

            'categories_seo_description' => Text::prepare($_POST['categories_seo_description'][$l['id']]),
            'categories_seo_title' => Text::prepare($_POST['categories_seo_title'][$l['id']]),
            'categories_seo_keywords' => Text::prepare($_POST['categories_seo_keywords'][$l['id']]),
         /*** Begin Header Tags SEO ***/

 

and for products

            'products_seo_title' => Text::prepare(strip_tags((tep_not_null($_POST['products_seo_title'][$language_id]) ? str_replace('"', '"', $_POST['products_seo_title'][$language_id]) : str_replace('"', '"', $_POST['products_name'][$language_id])))),
            'products_seo_description' => Text::prepare(strip_tags((tep_not_null($_POST['products_seo_description'][$language_id]) ? str_replace('"', '"', $_POST['products_seo_description'][$language_id]) : str_replace('"', '"', $_POST['products_name'][$language_id])))),
            'products_seo_keywords' => Text::prepare(strip_tags((tep_not_null($_POST['products_seo_keywords'][$language_id]) ? str_replace('"', '"', $_POST['products_seo_keywords'][$language_id]) : str_replace('"', '"', $_POST['products_name'][$language_id])))),

TO:

            'products_seo_description' => Text::prepare($_POST['products_seo_description'][$language_id]),
            'products_seo_keywords' => Text::prepare($_POST['products_seo_keywords'][$language_id]),
            'products_seo_title' => Text::prepare($_POST['products_seo_title'][$language_id]),
 

 

Oh, plus I did overwrite all the HTC files with the new ones from "Use_if_version_Phoenix_V_1.0.7.15_and_later" but without the above changes when editing a product or category the header tags title, description and key words so not save.

Share this post


Link to post
Share on other sites

I don't know what to tell you. The code works fine here in two 15 shops. If the changes work for you, then they will be fine other that allowing invalid characters into the SEO fields, if present.

Share this post


Link to post
Share on other sites

PHP 7.0

caught a few problems:
Social -> Notice: Undefined variable: storeName in /administracao/header_tags_seo_ajax.php on line 22

and if you disable the social and press save it does says "  Data Save was successful " but the icons stills shows up at product_info

 

If you Install: Breadcrumb - Header Tags and Remove (or dont):  Breadcrumb ->

Fatal error: Uncaught Error: Call to undefined method category_tree::getData() in /includes/modules/content/header/cm_header_breadcrumb_headertags.php:52 Stack trace: #0 /includes/system/versioned/1.0.7.9/osc_template.php(106): cm_header_breadcrumb_headertags->execute() #1 /templates/default/includes/components/header.php(15): oscTemplate->getContent('header') #2 /templates/override/includes/components/template_top.php(61): require('/xxx...') #3 /templates/default/includes/pages/product_info.php(13): require('/xxx...') #4 /loja/product_info.php(25): require('/xxx...') #5 {main} thrown in /includes/modules/content/header/cm_header_breadcrumb_headertags.php on line 52

 

Share this post


Link to post
Share on other sites

PHP 7.0

found a few more:

PHP Notice:  Undefined variable: arry in /admin/header_tags_seo_ajax.php on line 222

PHP Notice:  Uninitialized string offset: 1 in /admin/header_tags_test.php on line 612

 

Share this post


Link to post
Share on other sites

@Owl SauronThe attached should fix all of the issues you found. Just upload the files over the existing ones to apply.

HTS_QUCIK_FIX.zip

Share this post


Link to post
Share on other sites

PHP 7.0

other previous bugs:

cm_pi_description_headertags.php (content product_info) has a problem. When you try to install that module it does not show with a module name and after installed it gets inactive.

 

it did fixed a few and new ones came:

Fatal error: Uncaught Error: Call to undefined method category_tree::getData() in /includes/modules/content/index_nested/cm_in_category_listing_headertags.php:27 Stack trace: #0 /includes/system/versioned/1.0.7.9/osc_template.php(106): cm_in_category_listing_headertags->execute() #1 /templates/default/includes/pages/index.php(23): oscTemplate->getContent('index_nested') #2 /index.php(17): require('/xxx...') #3 {main} thrown in /includes/modules/content/index_nested/cm_in_category_listing_headertags.php on line 27

 

Recreate these steps:

catalog-> Fruit gives the above error

catalog-> Vegetables messes the site structure

 

 

 

Share this post


Link to post
Share on other sites
16 minutes ago, Owl Sauron said:

cm_pi_description_headertags.php (content product_info) has a problem.

Missed that one. Please edit that file and change

const CONFIG_KEY_BASE = 'MODULE_CONTENT_PI_DESCRIPTION_HEADERTAGS';

to

const CONFIG_KEY_BASE = 'MODULE_CONTENT_PI_DESCRIPTION_HEADERTAGS_';

For the second problem, in that file change

      $category_name  = $OSCOM_category->getData($current_category_id, 'name');

to

      $category_name = $GLOBALS['category_tree']->get($GLOBALS['current_category_id'], 'name');

 

Share this post


Link to post
Share on other sites

That last change should be change

      $category_name  = $OSCOM_category->getData($current_category_id, 'name');
      $category_level = $OSCOM_category->setMaximumLevel(1);
      $category_array = $OSCOM_category->buildBranchArray($current_category_id, $category_level);

to

      $category_name = $GLOBALS['category_tree']->get($GLOBALS['current_category_id'], 'name');
      $category_level = $GLOBALS['category_tree']->setMaximumLevel(1);
      $category_array = $GLOBALS['category_tree']->buildBranchArray($current_category_id, $category_level);

 

Share this post


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

$category_name = $GLOBALS['category_tree']->get($GLOBALS['current_category_id'], 'name'); $category_level = $GLOBALS['category_tree']->setMaximumLevel(1); $category_array = $GLOBALS['category_tree']->buildBranchArray($current_category_id, $category_level);

 

[28-Feb-2021 14:38:38 Europe/Lisbon] PHP Fatal error:  Uncaught Error: Call to undefined method category_tree::setMaximumLevel() in /includes/modules/content/index_nested/cm_in_category_listing_headertags.php:28
Stack trace:
#0 /includes/system/versioned/1.0.7.9/osc_template.php(106): cm_in_category_listing_headertags->execute()
#1 /templates/default/includes/pages/index.php(23): oscTemplate->getContent('index_nested')
#2 /index.php(17): require('/xxx...')
#3 {main}
  thrown in /includes/modules/content/index_nested/cm_in_category_listing_headertags.php on line 28

Share this post


Link to post
Share on other sites
On 2/27/2021 at 6:50 PM, Jack_mcs said:

const CONFIG_KEY_BASE = 'MODULE_CONTENT_PI_DESCRIPTION_HEADERTAGS_';

you forgot that change on the last "include.zip"

 

cm_pi_headertags_seo.php -> language file typo:  Show additional worrds on the product info page.

 

Aside from those, the module seems to work flawlessly

 

 

Share this post


Link to post
Share on other sites
7 hours ago, Owl Sauron said:

you forgot that change on the last "include.zip"

No, the last one only included the fix for the last problem. 

 

7 hours ago, Owl Sauron said:

cm_pi_headertags_seo.php -> language file typo:  Show additional worrds on the product info page.

I don't know what this refers to.

Share this post


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

I don't know what this refers to.

includes/languages/modules/content/product_info/cm_pi_headertags_seo.php

define('MODULE_CONTENT_PRODUCT_INFO_HTS_ADDITIONAL_WORDS_DESCRIPTION', 'Show additional worrds on the product info page.');

you have an "extra" "r".

 

well... theres enough changes/fixes so in my humble opinion a module update would be great since, as it is (at least for me), its now working flawlessly.

 

 

Share this post


Link to post
Share on other sites

Thanks for pointing out the typo. It has been that way from when it was first added but was never noticed.

Share this post


Link to post
Share on other sites

Hello Jack,

 

I noticed that after installation of Header Tags SEO every pages shows the ceid p.e.:

www.mysite/index.php?cPath=99&ceid=a9ed5271fea4afeb20f5b3182a7b566c

It has been decades ago that I have seen that?

Share this post


Link to post
Share on other sites
2 hours ago, revamp said:

every pages shows the ceid p.e.:

That's the session ID for Phoenix (maybe Frozen). HTS doesn't have anything to do with the url so that is not caused by the addon. It might be that you are using the wrong set of files for the update. Please sure the ones you use match your oscommerce version.

Share this post


Link to post
Share on other sites

In 1.0.7.15 file /admin/header_tags_seo.php

line 979

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
});

is the }); needed.

 

Share this post


Link to post
Share on other sites
Posted (edited)
8 hours ago, MyBookShop said:

is the }); needed.

No, it isn't. You can probably delete the line above it too. I have tested it but I don't think it is needed in Phoenix.

Thank you for posting the mistake. Please let me know of any others you may find.

Edited by Jack_mcs

Share this post


Link to post
Share on other sites
Posted (edited)

Hi Jack,

Today I noticed that from admin page control, I had entered the keywords assigned to the "product_info.php" pages but these do not appear when I edit the products web page (same issue for the title and description too).

On the other hand, no problem for other generic pages of type "index.php", "shipping.php", etc.

Do you know where the problem is coming from?
Could this be because I am using rewritable URLs?

And if so, how to get around this problem?

Cordially.

admin_page_control.jpg

xml_product_page_render.jpg

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

@milerwanI tested it, in Phoenix, and it works as expected. It could have to do with the cache of the url rewriter so you may want to try clearing that. If that's not it, please let me know what version of oscommerce you are using so I can test in that version.

Share this post


Link to post
Share on other sites

I have clearing cache of URL rewriting but nothing changes.
Version of oscommerce is 2.3.4BS and I'm using Ultimate SEO V 2.2d.

My base version is 3.3.4 and I have changed files to update to 3.3.5.
Maybe I have forgotten to changes some files during the process ?


Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

I tested that setup and it worked correctly so it seems to be something on your end. You could try running the reset cache option in Ultimate SEO and then disable it. Reload the page on the shop side to make sure the rewriter is turned off and see if that helps. You may need to clear your browsers cache.

Version 3.3.4 is quite old. The current one is 3.3.13. It's possible one of the updates would fix the problem though I don't recall that problem ever being mentioned. Also, while you say your version is 3.3.4, your image shows version 3.3.6. So it might be that you have files from each that is causing the problem.

Also, unrelated to this, I meant to mention your keywords. You have to be careful when using too many keywords. While google doesn't use them, they do check them. If they find too many entries in that tag that are not mentioned on the page, they may consider it to be "keyword stuffing" and that can cause the page's ranking to suffer. There's no limit on the number of keywords you can have but they need to be mentioned on the page for best results.

Share this post


Link to post
Share on other sites

OK I understood my concern...
Need to check the "Root" radio button and put number to add "page_description" and/or "page_keywords" (or "page_title").

Finally it works well. Sorry for the inconvenience.

NB: In includes/functions/header_tags, into the "function tep_header_tag_page($file)", I have quoted this script below because, when no "page_description" or no "page_keywords" registered, the page displays the "pathinfo($_SERVER['SCRIPT_FILENAME'])" with default keywords even if the "default_keywords" radio button is not checked.
But maybe it is the purpose of this script... ^^
 

  //if nothing else is set, force the page name and default settings, if present   
  $path_parts = pathinfo($_SERVER['SCRIPT_FILENAME']);
  $pageName = substr($path_parts['basename'], 0, strpos($path_parts['basename'], '.')) . ' ';
  $pageName = ucwords(preg_replace("/[^A-Za-z0-9]/", " ", $pageName));

  if (! tep_not_null($header_tags_array['title'])) $header_tags_array['title'] = $pageName . (tep_not_null($tmpTags['def_title']) ? HEADER_TAGS_SEPARATOR_DESCRIPTION . ' ' . $tmpTags['def_title'] : '');
  //if (! tep_not_null($header_tags_array['title_alt'])) $header_tags_array['title_alt'] = (tep_not_null($tmpTags['prod_title_alt']) ? HEADER_TAGS_SEPARATOR_DESCRIPTION . ' ' . $tmpTags['def_title'] : '');
  if (! tep_not_null($header_tags_array['description'])) $header_tags_array['description'] = $pageName . (tep_not_null($tmpTags['def_desc']) ? HEADER_TAGS_SEPARATOR_DESCRIPTION . ' ' . $tmpTags['def_desc'] : '');
  if (! tep_not_null($header_tags_array['keywords'])) $header_tags_array['keywords'] = $pageName . (tep_not_null($tmpTags['def_keywords']) ? HEADER_TAGS_SEPARATOR_KEYWORD . ' ' . $tmpTags['def_keywords'] : '');
  if (! tep_not_null($header_tags_array['logo']))  $header_tags_array['logo'] = $pageName . (tep_not_null($tmpTags['def_logo_text']) ? HEADER_TAGS_SEPARATOR_DESCRIPTION . ' ' . $tmpTags['def_logo_text'] : '');

 


Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

The default items are used when the page isn't set up with its own tags. Checking the use default checkboxes is not needed in those cases. For pages like are set to use tags from the items, like categories and products, you need to be sure to run fill tags so that there are not any empty items. I've seen the failure in the case of the latter where there were missing entries. I didn't think it was worth adding code to check since not having filled in items defeats the purpose of the addon.

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

×