Jump to content

[SOLVED] Meta Description Failing only on category pages


Recommended Posts

Hello,
For some reason our meta description shows no content, only on category pages (so far).
I took over this site, as the previous person got in over his head. I had never evaluated PrestaShop, so far I like it pretty well. The store had been highly modified, to the point that I wasn't even sure what version it started out with.

Anyway, I have gotten good results writing my own scripts to derive metatags with very good relevancy ratings (over 2800 products).

I am trying to finish up things and move on, but the stinking category pages show with empty meta descriptions.
As far as I can tell, they are all using the same header.tpl and it works everywhere else that I have tested.

The shop is at http://hydro-earth.com - so if anyone can figure this out, I would likely share the scripts written to derive the high (94% - 100%) relevancy ratings..

Thanks, and I hope to hear from somebody soon!!

Link to comment
Share on other sites

The script that I wrote populated all of them. I wondered that perhaps the fact that they were populated outside the system and not through the category tab that maybe the system didn't realize that there was data there, so I did one manually. Still no luck!

Link to comment
Share on other sites

Okay,
So nobdoy else has this problen...

the meta description tag doesn't even show up with the way I found this:
{if isset($meta_description) AND $meta_description}
<meta name="description" content="{$meta_description|escape:htmlall:'UTF-8'}" />
{/if}

if I strip off the if stuff and just have this

<meta name="description" content="{$meta_description|escape:htmlall:'UTF-8'}" />

Then I get:

<title>Hydroponics - by Hydro-Earth, North Providence, RI, 02904</title>
<meta name="description" content="" />
<meta name="keywords" content="Hydroponics, Pumps - Air & Water, Hydro Components, Climate Control / Co2, Growing Media, pH/EC Maintenance, Hydro Systems, Seed Starting & Cloning, Water Filtration, Hydro-Earth, North Providence, Rhode Island, RI, organic gardening, Hydroponics systems, grow lights" />

So, it is gettint the meta title and meta keywords from the right fields, just no meta description

Does anybody have a guess at what is up?

Thanks,
Jay

Link to comment
Share on other sites

I found this bug report that looks like it is about this issue. Unfortunately, the solution doesn't make any sense to me. At least, it does let us know where the problem could be occurring. It is lines 417-430 of classes/Tools.php that gets the category metadescription:

/* Categories specifics meta tags */
elseif ($id_category = Tools::getValue('id_category'))
{
   $row = Db::getInstance()->getRow('
   SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
   FROM `'._DB_PREFIX_.'category_lang`
   WHERE id_lang = '.intval($id_lang).' AND id_category = '.intval($id_category));
   if ($row)
   {
       if (empty($row['meta_description']))
           $row['meta_description'] = strip_tags($row['description']);
       return self::completeMetaTags($row, Category::hideCategoryPosition($row['name']));
   }
}



It appears the code checks if the meta_description field is empty. If it is, it uses the description as the meta_description. You could try adding the following before the following before line 426 to check the meta_description from the database:

echo $row['meta_description'];



This might give you an idea of what is going on.

Link to comment
Share on other sites

Hello Rocky,
How very nice of you to provide me with said detail!
I Changed (commented out) the code to this:

/* Categories specifics meta tags */

elseif ($id_category = Tools::getValue('id_category'))

{

$row = Db::getInstance()->getRow('
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
FROM `'._DB_PREFIX_.'category_lang`
WHERE id_lang = '.intval($id_lang).' AND id_category = '.intval($id_category));
if ($row)
{

/*if (!empty($row['meta_description']))
$row['meta_description'] = strip_tags($row['description']);
*/

return self::completeMetaTags($row, Category::hideCategoryPosition($row['name']));
}
}

And POW! there it is.

Thanks.

If I can help you in any way, let me know!

Jay
Link to comment
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
×
×
  • Create New...