Update instructions for updating Header Tags SEO version 3.2.2 to Header Tags SEO V 3.2.3 by Jack_mcs - oscommerce-solution.com

***************************************************************************************
1) Run the following mysql statements

delete from configuration where configuration_key like 'HEADER_TAGS_ENABLE_TINYMCE_%';
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function)
 VALUES (NULL,'Clear Cache', 'HEADER_TAGS_CLEAR_CACHE', 'false', 'Remove all Header Tags cache entries from the database.', '543', '9', 'tep_cfg_select_option(array(\'clear\', \'false\'), ', now(), 'header_tags_reset_cache');
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function)
 VALUES (NULL,'Enable Cache', 'HEADER_TAGS_ENABLE_CACHE', 'GZip', 'Enables cache for Header Tags. The GZip option will use gzip to try to increase speed but may be a little slower if the Header Tags data is small.', '543', '30', 'tep_cfg_select_option(array(\'None\', \'Normal\', \'GZip\'),', now(), NULL);
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function)
 VALUES (NULL, 'Enable an HTML Editor', 'HEADER_TAGS_ENABLE_HTML_EDITOR', 'No Editor', 'Use an HTML editor, if selected. !!! Warning !!! The selected editor must be installed for it to work!!!)', '543', 34, 'tep_cfg_select_option(array(\'CKEditor\', \'FCKEditor\', \'TinyMCE\', \'No Editor\'),', now(), NULL);
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function)
 VALUES (NULL,'Enable HTML Editor for Category Descriptions', 'HEADER_TAGS_ENABLE_EDITOR_CATEGORIES', 'false', 'Enables the selected HTML editor for the categories description box. The editor must be installed for this to work.', '543', '35', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), NULL);
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function)
 VALUES (NULL,'Enable HTML Editor for Meta Descriptions', 'HEADER_TAGS_ENABLE_EDITOR_META_DESC', 'false', 'Enables the selected HTML editor for the meta tag description box. The editor must be installed for this to work.', '543', '36', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), NULL);
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, use_function)
 VALUES (NULL,'Enable HTML Editor for Products', 'HEADER_TAGS_ENABLE_EDITOR_PRODUCTS', 'false', 'Enables the selected HTML editor for the products description box. The editor must be installed for this to work.', '543', '39', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now(), NULL);
CREATE TABLE IF NOT EXISTS headertags_cache (
  title text,
  data text
) TYPE=MyISAM;

***************************************************************************************
2) Upload all files in the catalog directory. If you are using pseudo pages, you will 
   need to delete and re-enter one pseudo page for each contribution that uses them.

***************************************************************************************
3) In admin/categories.php,

    --------------------------------------------------------------------------
FIND (around line 100):

        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
        break;
      case 'delete_category_confirm':

ADD ABOVE:

        /*** Begin Header Tags SEO ***/
        if (HEADER_TAGS_ENABLE_CACHE != 'None') {
          require_once(DIR_WS_FUNCTIONS . 'header_tags.php');
          ResetCache_HeaderTags('index.php', 'c_' . $categories_id);
        }
        /*** End Header Tags SEO ***/

    --------------------------------------------------------------------------
FIND (around line 158):

        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
        break;
      case 'delete_product_confirm':

ADD ABOVE:

        /*** Begin Header Tags SEO ***/
        if (HEADER_TAGS_ENABLE_CACHE != 'None') {
          require_once(DIR_WS_FUNCTIONS . 'header_tags.php');
          ResetCache_HeaderTags('index.php', 'c_' . $categories_id);
        }
        /*** End Header Tags SEO ***/

    --------------------------------------------------------------------------
FIND (around line 189):

        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));
        break;
      case 'move_category_confirm':

ADD ABOVE:

        /*** Begin Header Tags SEO ***/
        if (HEADER_TAGS_ENABLE_CACHE != 'None') {
          require_once(DIR_WS_FUNCTIONS . 'header_tags.php');
          ResetCache_HeaderTags('product_info.php', 'p_' . $product_id);
        }
        /*** End Header Tags SEO ***/

    --------------------------------------------------------------------------
FIND (around line 307):

          tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
        }
        break;
      case 'copy_to_confirm':

ADD ABOVE:

          /*** Begin Header Tags SEO ***/
          if (HEADER_TAGS_ENABLE_CACHE != 'None') {
            require_once(DIR_WS_FUNCTIONS . 'header_tags.php');
            ResetCache_HeaderTags('product_info.php', 'p_' . $products_id);
          }
          /*** End Header Tags SEO ***/

    --------------------------------------------------------------------------
FIND (around line 386):

<?php // START tinyMCE Anywhere
if (HEADER_TAGS_ENABLE_TINYMCE_META_DESC == 'true' || HEADER_TAGS_ENABLE_TINYMCE_CATEGORIES == 'true' || HEADER_TAGS_ENABLE_TINYMCE_PRODUCTS == 'true')
{
if ($action == 'new_product' || $action == 'new_category' || $action == 'edit_category') { // No need to put JS on all pages.
  $languages = tep_get_languages(); // Get all languages
// Build list of textareas to convert
    $str = '';
  for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
      if (HEADER_TAGS_ENABLE_TINYMCE_META_DESC  == 'true') $str .= "products_head_desc_tag[".$languages[$i]['id']."],";
      if (HEADER_TAGS_ENABLE_TINYMCE_CATEGORIES == 'true') $str .= "categories_htc_description[".$languages[$i]['id']."],";
      if (HEADER_TAGS_ENABLE_TINYMCE_PRODUCTS == 'true') $str .= "products_description[".$languages[$i]['id']."],";
  }  //end for each language
  $mce_str = rtrim ($str,","); // Removed the last comma from the string.
// You can add more textareas to convert in the $str, be careful that they are all separated by a comma.
  echo '<script language="javascript" type="text/javascript" src="includes/javascript/tiny_mce/tiny_mce.js"></script>';
  include "includes/javascript/tiny_mce/general.php";
  }
} // END tinyMCE Anywhere
?>

REPLACE WITH:

<?php
/*** Begin Header Tags SEO ***/
switch (HEADER_TAGS_ENABLE_HTML_EDITOR)
{
   case 'CKEditor':
     echo '<script type="text/javascript" src="./ckeditor/ckeditor.js"></script>';
   break;

   case 'FCKEditor':
   break;

   case 'TinyMCE':
     if (HEADER_TAGS_ENABLE_HTML_EDITOR != 'No Editor' && (HEADER_TAGS_ENABLE_EDITOR_META_DESC == 'true' || HEADER_TAGS_ENABLE_EDITOR_CATEGORIES == 'true' || HEADER_TAGS_ENABLE_EDITOR_PRODUCTS == 'true'))
     {
       if ($action == 'new_product' || $action == 'new_category' || $action == 'edit_category') { // No need to put JS on all pages.
         $languages = tep_get_languages(); // Get all languages
       // Build list of textareas to convert
         $str = '';
         for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
           if (HEADER_TAGS_ENABLE_EDITOR_META_DESC  == 'true') $str .= "products_head_desc_tag[".$languages[$i]['id']."],";
           if (HEADER_TAGS_ENABLE_EDITOR_CATEGORIES == 'true') $str .= "categories_htc_description[".$languages[$i]['id']."],";
           if (HEADER_TAGS_ENABLE_EDITOR_PRODUCTS == 'true') $str .= "products_description[".$languages[$i]['id']."],";
         }  //end for each language
         $mce_str = rtrim ($str,","); // Removed the last comma from the string.
       // You can add more textareas to convert in the $str, be careful that they are all separated by a comma.
         echo '<script language="javascript" type="text/javascript" src="includes/javascript/tiny_mce/tiny_mce.js"></script>';
         include "includes/javascript/tiny_mce/general.php";
       }
     }
   break;

   default: break;
}
/*** End Header Tags SEO ***/
?>

    --------------------------------------------------------------------------
FIND (around line 622):

               <td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

REPLACE WITH:

                <!-- *** Begin Header Tags SEO *** //-->
                <td class="main">
                <?php
                  if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'No Editor' || HEADER_TAGS_ENABLE_EDITOR_PRODUCTS == 'false')
                    echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id'])));
                  else
                  {
                    if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'FCKEditor') {
                      echo tep_draw_fckeditor('products_description[' . $languages[$i]['id'] . ']', '600', '300', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id'])));
                    } else if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'CKEditor') {
                      echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '110', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id'])), 'id = "products_description[' . $languages[$i]['id'] . ']" class="ckeditor"');
                    } else {
                      echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id'])));
                    }
                  }
                ?>
                </td>
                <!-- *** End Header Tags SEO *** //-->

    --------------------------------------------------------------------------
FIND (around line 677):

                <td class="main"><?php echo tep_draw_textarea_field('products_head_desc_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($products_head_desc_tag[$languages[$i]['id']]) ? stripslashes($products_head_desc_tag[$languages[$i]['id']]) : tep_get_products_head_desc_tag($pInfo->products_id, $languages[$i]['id']))); ?></td>

REPLACE WITH:

                <!-- *** Begin Header Tags SEO *** //-->
                <td class="main">
                <?php
                  if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'No Editor' || HEADER_TAGS_ENABLE_EDITOR_META_DESC == 'false')
                    echo tep_draw_textarea_field('products_head_desc_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($products_head_desc_tag[$languages[$i]['id']]) ? stripslashes($products_head_desc_tag[$languages[$i]['id']]) : tep_get_products_head_desc_tag($pInfo->products_id, $languages[$i]['id'])));
                  else
                  {
                    if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'FCKEditor') {
                      echo tep_draw_fckeditor('products_head_desc_tag[' . $languages[$i]['id'] . ']', '600', '300', (isset($products_head_desc_tag[$languages[$i]['id']]) ? $products_head_desc_tag[$languages[$i]['id']] : tep_get_products_head_desc_tag($pInfo->products_id, $languages[$i]['id'])));
                    } else if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'CKEditor') {
                      echo tep_draw_textarea_field('products_head_desc_tag[' . $languages[$i]['id'] . ']', 'soft', '110', '15', (isset($products_head_desc_tag[$languages[$i]['id']]) ? $products_head_desc_tag[$languages[$i]['id']] : tep_get_products_head_desc_tag($pInfo->products_id, $languages[$i]['id'])), 'id = "products_head_desc_tag[' . $languages[$i]['id'] . ']" class="ckeditor"');
                    } else {
                      echo tep_draw_textarea_field('products_head_desc_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_head_desc_tag[$languages[$i]['id']]) ? $products_head_desc_tag[$languages[$i]['id']] : tep_get_products_head_desc_tag($pInfo->products_id, $languages[$i]['id'])));
                    }
                  }
                 ?>
                 </td>
                <!-- *** End Header Tags SEO *** //-->

    --------------------------------------------------------------------------
FIND (around line 1083):

          $category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'soft', 30, 5, '');

REPLACE WITH:

          if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'No Editor' || HEADER_TAGS_ENABLE_EDITOR_META_DESC == 'false')
            $headertags_editor_str = tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'soft', 30, 5, '');
          else
          {
            if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'FCKEditor') {
              $headertags_editor_str = tep_draw_fckeditor('categories_htc_description[' . $languages[$i]['id'] . ']', 600, 300, '');
            } else if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'CKEditor') {
              $headertags_editor_str = tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'soft', 30, 5, '', 'id = "categories_htc_description[' . $languages[$i]['id'] . ']" class="ckeditor"');
            } else {
              $headertags_editor_str = tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'soft', 30, 5, '');
            }
          }

          $category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . $headertags_editor_str;

    --------------------------------------------------------------------------
FIND (around line 1126):

          $category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'soft', 30, 5, tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));

REPLACE WITH:

          if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'No Editor' || HEADER_TAGS_ENABLE_EDITOR_META_DESC == 'false')
            $headertags_editor_str = tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'soft', 30, 5, tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));
          else
          {
            if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'FCKEditor') {
              $headertags_editor_str = tep_draw_fckeditor('categories_htc_description[' . $languages[$i]['id'] . ']', 600, 300, tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));
            } else if (HEADER_TAGS_ENABLE_HTML_EDITOR == 'CKEditor') {
              $headertags_editor_str = tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'soft', 30, 5, tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']), 'id = "categories_htc_description[' . $languages[$i]['id'] . ']" class="ckeditor"');
            } else {
              $headertags_editor_str = tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'soft', 30, 5, tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));
            }
          }

          $category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . $headertags_editor_str;

***************************************************************************************
4) In admin/manufacturers.php,

FIND (in two places):

        if (USE_CACHE == 'true') {
          tep_reset_cache_block('manufacturers');
        }

ADD BENEATH:

        /*** Begin Header Tags SEO ***/
        if (HEADER_TAGS_ENABLE_CACHE == 'true') {
          require_once(DIR_WS_FUNCTIONS . 'header_tags.php');
          ResetCache_HeaderTags('index.php', 'm_' . $manufacturers_id);
        }
        /*** End Header Tags SEO ***/

***************************************************************************************
5) In admin/includes/database_tables.php,

FIND:

  define('TABLE_HEADERTAGS', 'headertags');

ADD BENEATH:

  define('TABLE_HEADERTAGS_CACHE', 'headertags_cache');

***************************************************************************************
6) In admin/includes/functions/general.php,

FIND

  /*** End Header Tags SEO ***/

ADD ABOVE:

  function header_tags_reset_cache($action)
  {
    switch ($action) {
    case 'clear':
     tep_db_query("truncate TABLE " . TABLE_HEADERTAGS_CACHE);
     break;
    default: return 'false';
    }
    return 'false';
  }

***************************************************************************************
7) In includes/database_tables.php,

FIND:

  define('TABLE_HEADERTAGS', 'headertags');

ADD BENEATH:

  define('TABLE_HEADERTAGS_CACHE', 'headertags_cache');

