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.

Follow Robbie Hodge:

One Response to “Remove Double Spacing from Magento Descriptions”

  1. I did this and it fixed the double-spacing issue…. but now the bulleted lists and numbered lists no longer appear correctly.

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.