Magento editor automatic line break issue when adding a new product

I am adding a new product in Magento CE 1.7.0.2. I entered HTML code in the Short Description attribute.

MY PROBLEM: I really don't know where these extras come from <br>

. Even the WYSIWYG editor doesn't show these <br>

, but they do appear on the website's product page. Please, help.

WHAT I AM LONGING IN:

<p>Product Description:</p>
<table border="1" cellspacing="0" cellpadding="5px">
    <tr>
        <td>Category</td>
        <td>Specials</td>
    </tr>
    <tr>
        <td>Texure</td>
        <td>Digitally Printed on High Quality Matte Paper</td>
    </tr>
</table>

      

WHAT IS THIS DISPLAY:

<p>Product Description:</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<table border="1" cellspacing="0" cellpadding="5px">
    <tr>
        <td>Category</td>
        <td>Specials</td>
    </tr>
    <tr>
        <td>Texure</td>
        <td>Digitally Printed on High Quality Matte Paper</td>
    </tr>
</table>

      

+3


source to share


2 answers


I found the answer to this link .



+10


source


These extra breaks are caused by a function nl2br()

that needs to be removed.

To resolve this for a short description , open your app / design / frontend / [package] / [theme] /template/catalog/product/view.phtml, find:

<?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?>

and replace it with:

<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>



To resolve this for description , open app / design / frontend / [package] / [theme] /template/catalog/product/view/description.phtml, find:

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

and repeat it like this:

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

Source

+1


source







All Articles