alexcat Posted February 25, 2011 Share Posted February 25, 2011 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 More sharing options...
shokinro Posted February 26, 2011 Share Posted February 26, 2011 Please replace following code inside getMetaTags($id_lang) of /classes/Tool.phpBefore 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 . ' '); } 1 Link to comment Share on other sites More sharing options...
alexcat Posted February 26, 2011 Author Share Posted February 26, 2011 A lot of thanks, very useful reply!!! Link to comment Share on other sites More sharing options...
bradmoulton Posted January 13, 2012 Share Posted January 13, 2012 This code wil not work in my latest version? Any work arounds? Link to comment Share on other sites More sharing options...
martinkokes.cz Posted July 10, 2013 Share Posted July 10, 2013 This code wil not work in my latest version? Any work arounds? $row['meta_title'] = $row['name'] . ' ' . self::ps_round(self::convertPrice($row['price']),2). ' ' . $cur->sign; Link to comment Share on other sites More sharing options...
Alexmp4 Posted October 24, 2013 Share Posted October 24, 2013 Hi, Someone have a solution for showing the price in Title meta for prestashop 1.5.4 and later ? thx Link to comment Share on other sites More sharing options...
SkyHiRider Posted January 8, 2014 Share Posted January 8, 2014 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 More sharing options...
Recommended Posts