问题
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