问题描述
我要在Magento CE 1.7.0.2中添加新产品.我在简短说明属性中输入了HTML代码.
I'm adding a new product in Magento CE 1.7.0.2. I entered the HTML code in Short Description attribute.
我的问题:我真的不知道这些额外的<br>
来自何处.甚至所见即所得的编辑器也没有显示这些<br>
,但是它们出现在网站的产品页面上.请帮忙.
MY PROBLEM: I really don't know where these extra <br>
coming from. Even the WYSIWYG editor is not showing these <br>
but they are appearing on the website's product page. Please help.
我输入的内容:
<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>
正在显示的内容:
<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>
推荐答案
这些其他中断是由nl2br()
函数引起的,应该删除.
These additional breaks are caused by nl2br()
function that should be removed.
要针对简短说明解决此问题,请打开app/design/frontend/[package]/[theme]/template/catalog/product/view.phtml,找到:
To resolve this for short description, open app/design/frontend/[package]/[theme]/template/catalog/product/view.phtml, find:
<?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?>
并替换为:
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
要针对描述解决此问题,请打开app/design/frontend/[package]/[theme]/template/catalog/product/view/description.phtml,找到:
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 relace this by:
<?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getDescription(), 'description') ?>
这篇关于Magento编辑器在添加新产品时自动换行问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!