如何在Magento的产品列表模板页面上添加产品简短描述?

时间:2013-07-31 00:32:16

标签: magento magento-1.7

我想将产品简短说明添加到产品列表模板页面,我发现这篇文章: http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-3-magento-controller-dispatch

它说:Blocks refer directly back to the models for their data. In other words, the Action Controller does not pass them a data structure. 那么,是否应该将简短描述的代码添加到Block类中?但Block类是Magento Core类: Mage_Catalog_Block_Product_List 我不应该编辑这个课,对吧?所以我该怎么做?创建我自己的Block类扩展Mage_Catalog_Block_Product_List并将showProductShortDescription方法添加到它?如果是,我应该创建自己的模块吗?

谢谢!

1 个答案:

答案 0 :(得分:14)

你可以在list.phtml文件中使用它。

$_product->getShortDescription();

但Magento不会在产品列表页面上加载所有属性。 转到管理平台目录 - >属性 - >管理属性并编辑简短描述属性。

将“在产品列表中使用”设置为“是”。保存并清除缓存。

相关问题