Jump to content

Both short description and product name for <title> tag


roboy

Recommended Posts

Hello,

 

I am trying to change the way Prestashop is generating the <title> tag for a product page when no meta information has been provided for the product. By default Prestashop is using the product name as <title> tag and I understand that the tag is set in /classes/Tools.php, somewhere between line 650-700.

 

I would like to change that so that Prestashop instead sets the tag so that it looks like this:

 

"Short Description - Name"

 

I have managed to change from Name to Short Description:

 

    /* Products specifics meta tags */
  if ($id_product = self::getValue('id_product'))
  {
   $row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
   SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`, `description`
   FROM `'._DB_PREFIX_.'product` p
   LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`)
   WHERE pl.id_lang = '.(int)($id_lang).' AND pl.id_product = '.(int)($id_product).' AND p.active = 1');
   if ($row)
   {
 if (empty($row['meta_description']))
  $row['meta_description'] = strip_tags($row['description']);
 return self::completeMetaTags($row, strip_tags($row['description_short']));
   }
  }

 

But how can I make Prestashop use both Short Description AND Name for the <title> tag, in the way that I mentioned above?

 

Any help would be much appreciated.

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...