eCommerce Hosting Tips: Fixing the Automatic Line Breaks in Magento

Leave a Comment
By default, Magento’s application editor (Tiny MCE) can insert an automatic line break when every you enter onto a new line – even if you'll be unable to view the or tags within the HTML.
eCommerce Hosting Tips & Tricks
This is caused by a PHP operate nl2br, that inserts an HTML line break before all newlines in a string. The nl2br function is used for the short description and the long description in Magento, you'll be able to resolve the automatic line breaks by removing the function like below:
<div><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>

Change it to: 
<div><?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?></div>

Now, locate the description.phtml file (/app/design/frontend/[package]/[theme]/template/catalog/product/view/description.phtml) and search for:
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($_description), 'description') ?>

Then, change to:

<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?> 

Ready to get started?

Thanks to Magento’s user-friendly interface and nice customization options, it’s simple to optimize your web site for Google and different search engines. From sitemaps to page titles, every ways in this Magento SEO guide can improve your rankings.

eCommerce Hosting Tips: Fixing the Automatic Line Breaks in Magento

Would you prefer to find out a lot of about making a web store using Magneto? read our blog posts on selecting the Best, Cheap and Recommended Magento Hosting.
Next PostNewer Post Previous PostOlder Post Home

0 comments:

Post a comment