douchensou6969 2014-02-20 06:52
浏览 41
已采纳

magento的满载产品

On product list/grid magento already has collection of products, and get from it products using foreach.

$_productCollection=$this->getLoadedProductCollection();
...
foreach ($_productCollection as $_product):

But these products don't have all necessary properties. I'm not sure, but i thing they have no inventory data. But i need some elements of _data array. I know only one way how to do that:

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

Is there any another way, how to reload product properties?

  • 写回答

1条回答 默认 最新

  • douji4948 2014-02-20 07:58
    关注

    If you need some data in the product list, edit the attribute in the backend and set the field "Used in product listing" to Yes.
    Save it and rebuild your indexes.

    There is also the option of loading the product inside the foreach loop but this can lead to performance issues.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发