Remove Double Spacing from Magento Descriptions

Magento’s out of the box WYSIWYG editor annoying adds a line break after each time you press enter or return. I found this to be very frustrating when I was creating descriptions and even more annoying when I was copy and pasting descriptions. No other eCommerce platform or WYSIWYG system I’ve worked for did this odd extra spacing. In the end its quite an easy fix:

Open File: /app/design/frontend/default/-YOURTEMPLATE-/template/catalog/product/view/description.phtml

Locate this code:

1
<?php echo $this->helper(’catalog/output’)->productAttribute($this->getProduct(), nl2br($this->getProduct()->getDescription()), ‘description’) ?>

Replace it with this code:

1
<?php echo $this->helper(’catalog/output’)->productAttribute($this->getProduct(), $this->getProduct()->getDescription(), ‘description’) ?>

The code which causes this extra spacing is nl2br(). So if you need to adjust it in future versions or other fields just find the nl2br() call.

Read More