Removing <br/> from product descriptions in Magento

With the new Magento 1.4 WYSIWYG editors were introduced for all textaera fields. The editor insert line breaks (\r\n) in the HTML code to make the code more readable (I guess). That's OK, but Magento still converts the text in the textarea to HTML like there was no markup resulting in too many line breaks in the HTML code.

To remove all the unnecessary br's in product pages:


echo $this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($_description), 'description')
change to:
echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description')


echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description')
change to:
echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description')

Basically remove the nl2br() function where it is necessary.

No comments: