Is your product description or short description spaced out in magento even though you haven’t added any line breaks? It happens because magento adds automatic line breaks into the content description and short description area using the PHP’s nl2br function.
To get rid of this extra line spacing, you can update the PHP echo statement in your template’s view.phtml and / or description.phtml depending on how your template is designed:
e.g. under app/design/frontend/<your-package>/<your-theme>/template/catalog/product/view.phtml
<?php if ($_product->getShortDescription()):?> <div class="short-description"> <h2><?php echo $this->__('Quick Overview') ?></h2> <div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div> </div> <?php endif;?>
You can notice the use of nl2br function above in the second echo statement. So just remove that function. The above code should look like this:
<?php if ($_product->getShortDescription()):?> <div class="short-description"> <h2><?php echo $this->__('Quick Overview') ?></h2> <div class="std"><?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?></div> </div> <?php endif;?>
Just follow the same steps to remove nl2br function for the main product description if required. If your website is picking the detailed product description from the default magento’s theme then you will not be required to do this as nl2br is already removed in latest versions of magento (starting Magento 1.4.1).
Leave A Comment