TDCadmin Posted August 6, 2013 Share Posted August 6, 2013 Hey all. I know that when you create a product i presta it says something about how you cant use characters like " <>;:" etc. in Product Names Is there anyway to make product names have line breaks? I want to use <br> in some of my names to make them split at a certain word. Any advise? Link to comment Share on other sites More sharing options...
vekia Posted August 6, 2013 Share Posted August 6, 2013 it isn't possible due to the the object definition (product class) 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128), moreover, many modules like homefeatured etc. remove the html tags from the name variable Link to comment Share on other sites More sharing options...
eduard02 Posted November 18, 2013 Share Posted November 18, 2013 Hi, Same problem to me, just want to use product name in two lines, brand name and product name. Any solution for this on presta 1.5.6? Thank you. Link to comment Share on other sites More sharing options...
Carolina Custom Designs Posted November 18, 2013 Share Posted November 18, 2013 No, it isn't possible. Marty Shue Link to comment Share on other sites More sharing options...
vekia Posted November 18, 2013 Share Posted November 18, 2013 just wondering about some kind of workaround if you use product name like: THIS IS, PRODUCT NAME and in template file you can use something like: {$product->name|replace:',':'<br/>'} it's not ideal, but it will work result: Link to comment Share on other sites More sharing options...
Do You Speak Graphic Posted June 3, 2014 Share Posted June 3, 2014 Hallo... I'm looking for the same kind of solution for a shop I'm building... In this case the products are movie titles and it can happens that the same title comes in different editions. let's make an example: I have two editions of the same movie: 1) X-Men: Final Conflict - DVD Edition 2) X-Men: Final Conflict - Blu-Ray Collector's Edition Now... in grid list (both in home page or category pages, etc. the title is written on one single line, while the best solution should be: 1) X-Men: Final Conflict DVD Edition 2) X-Men: Final Conflict Blu-Ray Collector's Edition Sometimes it's even worst, since I have very loooong title, like this: Full Metal Panic: The Second Raid Intégrale DVD + OAV - Edition Collector As you can see, in this last case, the way the text is formatted is ugly and I'd need something like: Full Metal Panic: The Second Raid Intégrale DVD + OAV Edition Collector Any idea? Maybe I can put some details in the short description... In the previous examples it would be: TITLE: X-Men: Final Conflict SH. DESC.: DVD Edition TITLE: X-Men: Final Conflict SH. DESC.: Blu-Ray Collector's Edition TITLE: Full Metal Panic: The Second Raid SH. DESC.: Intégrale DVD + OAV - Edition Collector But depending to which theme I use, the short description doesn't appear in the grid view of Home Page Featuted or New products... I'm getting really mad and any help would be appreciated... Link to comment Share on other sites More sharing options...
vekia Posted June 4, 2014 Share Posted June 4, 2014 you can try with this replace: {$product->name|replace:' - ':'<br/>'} Link to comment Share on other sites More sharing options...
Do You Speak Graphic Posted June 4, 2014 Share Posted June 4, 2014 you can try with this replace: {$product->name|replace:' - ':'<br/>'} Thanks Vekia... where should I put this code? Link to comment Share on other sites More sharing options...
som3body Posted June 11, 2014 Share Posted June 11, 2014 Hello there Iam also interested about that. Very useful hack. Do I need(or can I) replace the "{$product->name|escape:'htmlall':'UTF-8'}" to {$product->name|replace:' - ':'<br/>'} in the product.tpl? Iam using prestashop1.5.5 Thanks in advance of any replies. Link to comment Share on other sites More sharing options...
Do You Speak Graphic Posted August 28, 2015 Share Posted August 28, 2015 you can try with this replace: {$product->name|replace:' - ':'<br/>'} Hello (after all these months)... I still have to figure it out where to put this code :-/// Link to comment Share on other sites More sharing options...
gabdara Posted August 29, 2015 Share Posted August 29, 2015 Your product name should be set like: My product - new line If you want this hack in product list: https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/themes/default-bootstrap/product-list.tpl#L118 {$product.name|replace:' - ':'<br/>'} You could also add the |truncate:45 if you want to limit the characters, but don't add the escape parameter. In product page: https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/themes/default-bootstrap/product.tpl#L158 If you want the product name split on new line use the code from vekia: {$product->name|replace:' - ':'<br/>'} Otherwise if you only want to display the name of the product without the ' - ' and no new line use: {$product->name|replace:' - ':' '} Warning! The code above treats only the display of product list and product page but there are many pages on which the product name is displayed and it will include the dash. Link to comment Share on other sites More sharing options...
vekia Posted August 29, 2015 Share Posted August 29, 2015 Hello (after all these months)... I still have to figure it out where to put this code :-/// to product-list.tpl file Link to comment Share on other sites More sharing options...
brave Posted April 24, 2017 Share Posted April 24, 2017 (edited) I try to use this option in Prestashop 1.7, but doesn't work, include the <br/> syntax on the title: https://www.dropbox.com/s/x6rlq3xy2mhsm17/intro-hicoman.png?dl=0 Edited April 24, 2017 by brave (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted April 24, 2017 Share Posted April 24, 2017 you will have to add nofilter modifier to each avaialble instance of {$product.name} in your theme's files for example: {$product.name nofilter} Link to comment Share on other sites More sharing options...
brave Posted April 24, 2017 Share Posted April 24, 2017 you will have to add nofilter modifier to each avaialble instance of {$product.name} in your theme's files for example: {$product.name nofilter} Perfect. https://www.dropbox.com/s/8vjngsbdn4hzcyr/intro-hicoman-fix.png?dl=0 Thanks!! Link to comment Share on other sites More sharing options...
Recommended Posts