Forums / Bug Reports / [Done 1.3.9a] default category meta tags not working after removing custom tags

[Done 1.3.9a] default category meta tags not working after removing custom tags

Locked

Views: 7,749

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
17 Jul 2008, 10:03 AM
#1
cochlear avatar

cochlear

Zen Follower

Join Date:
Apr 2007
Location:
Sydney
Posts:
110
Plugin Contributions:
0

[Done 1.3.9a] default category meta tags not working after removing custom tags

While experiementing with the category meta tags, I notice that once custom meta tags are defined for a category, it seems impossible to restore to the previous default tags.

I completely removed custom tags so that admin biohazard button goes from orange to black again, but the default tags do not re-appear. So despite admin saying "meta tags undefined", Zen Cart actually remains in the "custom-tag" state. Is this the expected behaviour?

17 Jul 2008, 10:22 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

If you remove the metatags, leaving them blank, the expected behavior is that the default metatags would be generated.

What is the URL where this can be seen?

Note: If you were expecting them to suddenly change on Google, you'll have to wait to be re-indexed by the search engines.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

17 Jul 2008, 10:51 AM
#3
cochlear avatar

cochlear

Zen Follower

Join Date:
Apr 2007
Location:
Sydney
Posts:
110
Plugin Contributions:
0

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

DrByte thank you for your fast response! The site is not live yet so I'm not talking about google, but rather the browser page title and meta tags in the source document (they are all empty).

I was able to duplicate this on an almost 100% new install. But I'll test again on a brand new install just to make sure.

17 Jul 2008, 11:55 AM
#4
cochlear avatar

cochlear

Zen Follower

Join Date:
Apr 2007
Location:
Sydney
Posts:
110
Plugin Contributions:
0

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

OK I just installed a new database and 1.3.8, and the unexpected behaviour persists.

This is what I did:

  1. Install new Zen Cart with test products, keep default settings

  2. In admin, click the biohazard button for Mixed Product Types category, at this time the button is black

  3. Write something in meta description, save; biohazard button automatically turns orange

  4. Click again the biohazard button for Mixed Product Types category, delete everything so that all meta boxes are empty; save

  5. Biohazard button is now black, which is expected. But if you go to store, click the Mixed Product Types category, you see nothing in browser's title bar, except maybe "Mozilla Firefox". Meta tags are empty in page source. So that's why I think Zen Cart remains in "custom tags" state.

In step 3-4 you can alternatively simply click save without entering any meta tag, and you get to step 5.

I tested this with XAMPP 1.6.6
Apache 2.2.8
MySQL 5.0.51a
PHP 5.2.5

18 Jul 2008, 5:46 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

Thanks for the detailed steps.

Confirmed as a bug in 1.3.x.

Moving to bug reports area.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

18 Jul 2008, 5:51 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

Workaround:

edit /admin/categories.php
around line 240 you'll see a block of code like this:```
// bof: categories meta tags
case 'update_category_meta_tags':
// add or update meta tags
//die('I SEE ' . $action . ' - ' . $_POST['categories_id']);
$categories_id = $_POST['categories_id'];
$languages = zen_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$language_id = $languages[$i]['id'];
$check = $db->Execute("select *
from " . TABLE_METATAGS_CATEGORIES_DESCRIPTION . "
where categories_id = '" . (int)$categories_id . "'
and language_id = '" . (int)$language_id . "'");
if ($check->RecordCount() > 0) {
$action = 'update_category_meta_tags';
} else {
$action = 'insert_categories_meta_tags';
}

    $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
                            'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
                            'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));

    if ($action == 'insert_categories_meta_tags') {
      $insert_sql_data = array('categories_id' => $categories_id,
                               'language_id' => $language_id);
      $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

      zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array);
    } elseif ($action == 'update_category_meta_tags') {
      if (empty($_POST['metatags_title'][$language_id]) && empty($_POST['metatags_keywords'][$language_id]) && empty($_POST['metatags_description'][$language_id])) {
        $remove_categories_metatag = "DELETE from " . TABLE_METATAGS_CATEGORIES_DESCRIPTION . " WHERE categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'";
        $db->Execute($remove_categories_metatag);
      } else {
        zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
      }
    }
  }

  zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
  break;
  // eof: categories meta tags  

change it to this:
// bof: categories meta tags
case 'update_category_meta_tags':
// add or update meta tags
//die('I SEE ' . $action . ' - ' . $_POST['categories_id']);
$categories_id = $_POST['categories_id'];
$languages = zen_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$language_id = $languages[$i]['id'];
$check = $db->Execute("select *
from " . TABLE_METATAGS_CATEGORIES_DESCRIPTION . "
where categories_id = '" . (int)$categories_id . "'
and language_id = '" . (int)$language_id . "'");
if ($check->RecordCount() > 0) {
$action = 'update_category_meta_tags';
} else {
$action = 'insert_categories_meta_tags';
}
if (empty($_POST['metatags_title'][$language_id]) && empty($_POST['metatags_keywords'][$language_id]) && empty($_POST['metatags_description'][$language_id])) {
$action = 'delete_category_meta_tags';
}

    $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
                            'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
                            'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));

    if ($action == 'insert_categories_meta_tags') {
      $insert_sql_data = array('categories_id' => $categories_id,
                               'language_id' => $language_id);
      $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

      zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array);
    } elseif ($action == 'update_category_meta_tags') {
      zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
    } elseif ($action == 'delete_category_meta_tags') {
      $remove_categories_metatag = "DELETE from " . TABLE_METATAGS_CATEGORIES_DESCRIPTION . " WHERE categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'";
      $db->Execute($remove_categories_metatag);
    }
  }

  zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
  break;
  // eof: categories meta tags  

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 Mar 2009, 6:44 PM
#7
121webconsultancy avatar

121webconsultancy

New Zenner

Join Date:
May 2007
Posts:
42
Plugin Contributions:
0

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

So glad I found this thread and the appropriate workaround. Thanks DrByte. :)

121webconsultancy - Professional Website Design & Internet Marketing

14 Aug 2009, 12:40 PM
#8
vinyl_signs avatar

vinyl_signs

Zen Follower

Join Date:
Jun 2007
Location:
Shropshire UK
Posts:
125
Plugin Contributions:
0

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

I tried this workaround and it did not work - until I removed the record from the database Table: meta_tags_categories_description

22 Aug 2009, 6:01 AM
#9
australican avatar

australican

Zen Follower

Join Date:
Jan 2009
Location:
Victoria Australia
Posts:
100
Plugin Contributions:
0

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

Vinyl Signs:

I tried this workaround and it did not work - until I removed the record from the database Table:
meta_tags_categories_description

Ditto.
(Only I would have said that the workaround works, but you must also remove the record from the database.)
David

21 Nov 2009, 4:42 PM
#10
karms avatar

karms

New Zenner

Join Date:
Nov 2009
Posts:
8
Plugin Contributions:
0

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

can anyone describe how to delete the meta_tags_categories_description record from the database table using phpMyAdmin ?

21 Nov 2009, 5:12 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

  1. Identify the problematci category_id ... it shows beside the category name in your admin categories page.
  2. Use that category_id in this SQL statement:```
    DELETE from metatags_categories_description WHERE categories_id = [B]CATEGORY_ID_HERE[/B];

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Nov 2009, 1:57 AM
#12
karms avatar

karms

New Zenner

Join Date:
Nov 2009
Posts:
8
Plugin Contributions:
0

Re: [Done 1.3.9a] default category meta tags not working after removing custom tags

Worked like a champ! Thanks!