我目前在view.phtml中调用了我的简短描述
<?php if ($_product->getShortDescription()):?>
<div class="short-description">
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
</div>
<?php endif;?>
我想将此添加到我的长描述中(目前由description.phtml调用)。
我已经尝试将这段代码添加到description.phtml
<?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?>
然而,当我这样做时,标签完全消失了。有没有办法可以合并Magento中的短描述和长描述,或者只是一种将简短描述添加到描述选项卡而不会破坏的方法?
答案 0 :(得分:0)
您需要添加以下代码才能在short_description
description.phtml
值
<?php $_short_description = $this->getProduct()->getShortDescription();?>
然后添加此
<?php if ($_short_description): ?>
<div class="std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_short_description, 'short_description') ?>
</div>
<?php endif; ?>
答案 1 :(得分:0)
将核心文件从此url app / design / frontend / base / default / template / catalog / product / view / description.phtml复制到app / design / frontend / yourtheme / default / template / catalog / product / view / description一个.phtml
如果你想结合简短和日志描述,请尝试下面的代码
<?php $_description = $this->getProduct()->getDescription(); ?>
<?php $_short_description = $this->getProduct()->getShortDescription(); ?>
<?php if ($_description && $_short_description): ?>
<h2><?php echo $this->__('Details') ?></h2>
<div class="std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description')." ".$this->helper('catalog/output')->productAttribute($this->getProduct(), $_short_description, 'shortDescription') ?>
</div>
<?php elseif($_description) : ?>
<h2><?php echo $this->__('Details') ?></h2>
<div class="std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description');?>
</div>
<?php endif; ?>
&#13;
如果你只是想做空,那么从上面删除长描述代码
希望这会帮助你
由于