how to display product detail description on product listing page?

杀马特。学长 韩版系。学妹 提交于 2019-12-09 15:16:23

问题


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.


回答1:


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




回答2:


The correct code is:

<?php

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

echo $my_product->getDescription();

?>



回答3:


$_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.




回答4:


for 1.6.2 it is:

path:

<?php

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

    echo $my_product->getDescription();

?>



回答5:


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

<?php echo $_product->_data['short_description']; ?>



回答6:


This works in 1.7.0.2

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



来源:https://stackoverflow.com/questions/6027532/how-to-display-product-detail-description-on-product-listing-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!