Jump to content

Category name to Meta_title, meta_description in products! ?


Recommended Posts

Who got to add to products - category names, manufacturers in meta_title, meta_description.

Because the names of the products in title and description description_short - not enough.

The question most likely lies in the \classes\Tools.php

:unsure:

(for example title: Product name | category name from manufacturer name )

 

/* 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`
               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']))
                   if (empty($row['meta_title']))                    
                   $row['meta_title'] = $row['name']. ' | '. strip_tags($row['description_short']).' - '.Configuration::get('PS_SHOP_NAME');;
                   $row['meta_description'] = $row['name']. ' > ' .strip_tags($row['description_short']);
                   return self::completeMetaTags($row, $row['name']);
               }
           }

 

I would be very grateful for the help!

Link to comment
Share on other sites

×
×
  • Create New...