how to display product detail description on produ

2019-04-05 08:18发布

I want to show a detailed product description after a short description on the product listing page.

I'm doing this

<?
echo $_product->getDescription();
?>

but nothing shows up.

I also tried this

Mage::getModel('catalog/product')->load($_product->getProductId())->getDescription();

but to no success.

6条回答
看我几分像从前
2楼-- · 2019-04-05 08:49

The correct code is:

<?php

$my_product = Mage::getModel('catalog/product')->load($_product->getId());

echo $my_product->getDescription();

?>
查看更多
做自己的国王
3楼-- · 2019-04-05 08:53

Try setting product attribute for descrption field "Used in Product Listing" to "YES". That will solve your problem and avoid redundant model load

查看更多
Luminary・发光体
4楼-- · 2019-04-05 08:53

for 1.6.2 it is:

path:

<?php

    $my_product =
        Mage::getModel('catalog/product')->load($_item->getProductId());

    echo $my_product->getDescription();

?>
查看更多
不美不萌又怎样
5楼-- · 2019-04-05 09:05

$_product->getProductId() is not the function call you want, it is $_product->getId() :)

I advice you to take a look at the template in .../template/catalog/product/view/description.phtml. That template prints the description for the product view page, so you'll want a similar thing on the list page.

查看更多
孤傲高冷的网名
6楼-- · 2019-04-05 09:05

This works in 1.7.0.2

<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getDescription()), 'short_description') ?></div>

查看更多
倾城 Initia
7楼-- · 2019-04-05 09:10

Try this, I have used this. It's working on magento 1.7

<?php echo $_product->_data['short_description']; ?>
查看更多
登录 后发表回答