【问题标题】:Magento - Exclude products with no image from list - Unknown column small_imageMagento - 从列表中排除没有图像的产品 - 未知列 small_image
【发布时间】:2016-01-26 01:53:42
【问题描述】:

参考:模板/目录/产品/list.phtml 我正在尝试从没有图像的 Magento 列表中过滤所有产品。我在 $productCollection 中添加了以下内容:

->addAttributeToFilter('small_image', array('neq' => 'no_selection'))

我收到以下错误: a:5:{i:0;s:2550:"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.small_image' in 'where 子句'

- The small_image column is included in catalog_product_flat
- I have re-indexed.
- $_product->getSmallImage() returns correctly - image URL or no_selection

【问题讨论】:

    标签: magento filter product


    【解决方案1】:

    在产品集合->addAttributeToFilter('image', array('neq' => 'no_selection')) 上试试这个而不是small_image。

    【讨论】:

    • 试过了,还是不行。但是,这不会引发任何错误消息——这很奇怪,因为图像不包含在 catalogue_product_flat 中。如果我在后端关闭产品平面,那么一切都很好,但我更愿意同时使用平面和非平面选项。
    猜你喜欢
    • 1970-01-01
    • 2013-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多