cancel
Showing results for 
Search instead for 
Did you mean: 

Convert new line characters to <br> in product short description and description - nl2br

Convert new line characters to <br> in product short description and description - nl2br

My product description and short descriptions all have new line characters in the database...

I would like magento 2 to convert those new lines to <br> tags using nl2br on the front end.
I'm using ultimo theme.

 

I see where magento does 

<?php echo $block->getChildHtml('product.info.main'); ?>
 but after that, I can't seem to drill down any more. 
 
How do I do this on Magento 2.2.3
 
 

 

 

4 REPLIES 4

Re: Convert new line characters to <br> in product short description and description - nl2br

Re: Convert new line characters to <br> in product short description and description - nl2br

Strange.. .not seeing those files that in my source. I think perhaps there's a difference between git source files and the final files encapulated in the install zip download for mage 2.2.3

 

When I switch to luma it doesn't use nl2br... I can't find any reference to it anywhere.

 

 

 

 

Re: Convert new line characters to <br> in product short description and description - nl2br

I see that the helper file checks for two states... 

(!$attribute->getIsHtmlAllowedOnFront() && !$attribute->getIsWysiwygEnabled())

Problem is magento 2.2.3 admin-->store-->product attribute -->storefront_properties...

Doesn't have an option for affecting ishtmlallowedonfront... but it does have option for iswysiwygenabled.

 

How do I set the attribute's ishtmlallowedonfront value in magento's admin?

Re: Convert new line characters to <br> in product short description and description - nl2br

Hi @ElliotGage,

 

Can you check with this option?

 

Área de trabajo 1_003.png