Jump to content

[Solved] In the product page show the title of product + price


Recommended Posts

Hello, after searching in the forum i have found that the code to edit the title of the product page is in the classes/tools.php, in the line return self::completeMetaTags($row, $row['name']);

Now I would like to change it to show the title of product + price of the product.

For example, in place of show in the title PS3 - GamesShop I would like to sho PS3 300 euros - GamesShop.

Anyone would know the exact variable to put in this line of the code?

thanks

Link to comment
Share on other sites

Please replace following code inside getMetaTags($id_lang) of /classes/Tool.php

Before change

               $row = Db::getInstance()->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 = '.intval($id_lang).' AND pl.id_product = '.intval($id_product).' AND p.active = 1');
               if ($row)
               {
                   if (empty($row['meta_description']))
                       $row['meta_description'] = strip_tags($row['description_short']);
                   return self::completeMetaTags($row, $row['name']);
               }





After change

               $row = Db::getInstance()->getRow('
               SELECT `price`, `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 = '.intval($id_lang).' AND pl.id_product = '.intval($id_product).' AND p.active = 1');
               $cur = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
               if ($row)
               {
                   if (empty($row['meta_description']))
                       $row['meta_description'] = strip_tags($row['description_short']);
                   return self::completeMetaTags($row, $row['name'] . ' ' . self::ps_round(self::convertPrice($row['price']),2). ' ' . $cur->sign . ' ');
               }

  • Like 1
Link to comment
Share on other sites

  • 10 months later...
  • 1 year later...
  • 3 months later...
  • 2 months later...

Please replace following code inside getMetaTags($id_lang) of /classes/Tool.php

 

Before change

$row = Db::getInstance()->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 = '.intval($id_lang).' AND pl.id_product = '.intval($id_product).' AND p.active = 1');                if ($row)                {                    if (empty($row['meta_description']))                        $row['meta_description'] = strip_tags($row['description_short']);                    return self::completeMetaTags($row, $row['name']);                }

 

 

After change

$row = Db::getInstance()->getRow('                SELECT `price`, `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 = '.intval($id_lang).' AND pl.id_product = '.intval($id_product).' AND p.active = 1');                $cur = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));                if ($row)                {                    if (empty($row['meta_description']))                        $row['meta_description'] = strip_tags($row['description_short']);                    return self::completeMetaTags($row, $row['name'] . ' ' . self::ps_round(self::convertPrice($row['price']),2). ' ' . $cur->sign . ' ');                }

 

Did that and it shows the price without VAT. How do I need to modify the code to display price including VAT?

Link to comment
Share on other sites

×
×
  • Create New...