borisdifiore Posted July 16, 2016 Share Posted July 16, 2016 Hi, I would like to make ® symbol in superscript format in Category name field and Product name field.Actually I'm not able to get in the fields Category name end Product name the ® for example: I want to get this : Category® Product® and I get this Category® and Product® I can't use <sup>R<sup> command in category and product name fields due to <> are forbidden... Any suggestion? Thank you in advanceBoris Link to comment Share on other sites More sharing options...
rocky Posted July 16, 2016 Share Posted July 16, 2016 Since PrestaShop doesn't allow HTML in category and product names, I think you'll have to modify all the references to the category names and product names in your theme's TPL files. For example, in product.tpl, change all references like this: {$product->name|escape:'html':'UTF-8'} to this: {$product->name|escape:'html':'UTF-8'|replace:'®':'<sup>®</sup>'} Add that replace part to all the right strings and the ® will become superscript. 1 Link to comment Share on other sites More sharing options...
borisdifiore Posted July 16, 2016 Author Share Posted July 16, 2016 (edited) Hi Rocky, thank you very much I'll try, but I noticed that the TM is accepted in the some field and made superscript TM by prestashop itself..... How is it possible with TM and not with R? Thank you Boris Edited July 16, 2016 by borisdifiore (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted July 17, 2016 Share Posted July 17, 2016 That's because ™ is superscript within the font itself, so there's no need to make it superscript. PrestaShop isn't making the ™ superscript. 1 Link to comment Share on other sites More sharing options...
borisdifiore Posted July 17, 2016 Author Share Posted July 17, 2016 It doesn't work I make changes in product.tpl in theme/default-boostrap/product.tpl..... Since PrestaShop doesn't allow HTML in category and product names, I think you'll have to modify all the references to the category names and product names in your theme's TPL files. For example, in product.tpl, change all references like this: {$product->name|escape:'html':'UTF-8'} to this: {$product->name|escape:'html':'UTF-8'|replace:'®':'<sup>®</sup>'} Add that replace part to all the right strings and the ® will become superscript. Link to comment Share on other sites More sharing options...
rocky Posted July 17, 2016 Share Posted July 17, 2016 It works fine on my PrestaShop v1.6.1.6 test site. I changed line 158 of themes/default-bootstrap/product.tpl from: <h1 itemprop="name">{$product->name|escape:'html':'UTF-8'}</h1> to: <h1 itemprop="name">{$product->name|escape:'html':'UTF-8'|replace:'®':'<sup>®</sup>'}</h1> Then I see the following: 1 Link to comment Share on other sites More sharing options...
borisdifiore Posted July 17, 2016 Author Share Posted July 17, 2016 Done the some and also cache cleared after the line change you suggested, but unfortunately I didn't get the successfully result you got.... that is exactly what I want for products and Categories I have in production the some Prestashop version you tested It works fine on my PrestaShop v1.6.1.6 test site. I changed line 158 of themes/default-bootstrap/product.tpl from: <h1 itemprop="name">{$product->name|escape:'html':'UTF-8'}</h1> to: <h1 itemprop="name">{$product->name|escape:'html':'UTF-8'|replace:'®':'<sup>®</sup>'}</h1> Then I see the following: screenshot.png Link to comment Share on other sites More sharing options...
rocky Posted July 17, 2016 Share Posted July 17, 2016 There's nothing more I can do unless I log in to your website and try it myself. 1 Link to comment Share on other sites More sharing options...
rakepl Posted July 17, 2016 Share Posted July 17, 2016 Hello Rocky, Is there any way to modify that will have superscript in price ? For example in case of borisdifiore $18.16 will displayed $1816. Thank you Link to comment Share on other sites More sharing options...
borisdifiore Posted July 17, 2016 Author Share Posted July 17, 2016 There's nothing more I can do unless I log in to your website and try it myself. Thank you Rocky for your interest and help, but my costumer denied to allow your log in fr security reasons. Don't take it personal....Something is going wrong but I can't understand why.... Link to comment Share on other sites More sharing options...
rocky Posted July 17, 2016 Share Posted July 17, 2016 @rakepl Yes, you could do that by overriding the Tools::displayPrice function and modifying the formatNumber JavaScript function. For example, create override/classes/Tools.php with the following: <?php class Tools extends ToolsCore { public static function displayPrice($price, $currency = null, $no_utf8 = false, Context $context = null) { $formatted_price = ToolsCore::displayPrice($price, $currency, $no_utf8, $context); if ($currency === null) { $currency = $context->currency; } elseif (is_int($currency)) { $currency = Currency::getCurrencyInstance((int)$currency); } if (is_array($currency)) { $c_format = $currency['format']; } elseif (is_object($currency)) { $c_format = $currency->format; } else { return false; } $decimal = (($c_format == 2 || $c_format == 3) ? ',' : '.'); return str_replace($decimal, '<sup>', $formatted_price).'</sup>'; } } and then change line 56 of js/tools.js from: return abs_val_string + virgule + (deci_string > 0 ? deci_string : '00'); to: // return abs_val_string + virgule + (deci_string > 0 ? deci_string : '00'); return abs_val_string + '<sup>' + (deci_string > 0 ? deci_string : '00').'</sup>'; Remember to go to Advanced Parameters > Performance and then click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop finds the override. Link to comment Share on other sites More sharing options...
borisdifiore Posted January 9, 2017 Author Share Posted January 9, 2017 Hi rocky, i tryed again and... it works!!!! may be some upadate allowed me. Now I would like to make the some change in categories name, products and so on. which are the tpl files I have to edit? Link to comment Share on other sites More sharing options...
rictools Posted January 10, 2017 Share Posted January 10, 2017 A lot ... Link to comment Share on other sites More sharing options...
borisdifiore Posted January 10, 2017 Author Share Posted January 10, 2017 A lot ... Thank you ric.... but please can you list them? Link to comment Share on other sites More sharing options...
rictools Posted January 10, 2017 Share Posted January 10, 2017 Thank you ric.... but please can you list them? No, I'd have to search like you can search too, and it depends a lot from the settings and modules you are using. This forum is to help you to help yourself, not to do all your work. Link to comment Share on other sites More sharing options...
borisdifiore Posted January 11, 2017 Author Share Posted January 11, 2017 No, I'd have to search like you can search too, and it depends a lot from the settings and modules you are using. This forum is to help you to help yourself, not to do all your work. Thank you for your time. I was not asking to do my job, and before ask I already search but without success. I know the philosophy of the forum. have a nice day Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now