如何通过观察者从目录搜索和 magento 目录中过滤空白产品图像



我需要从目录和目录搜索中过滤Magento中的空白图像产品。但它在目录上工作正常。BT在目录搜索中不行。

我在搜索中搜索产品时出错....

  Column not found: 1054 Unknown column 'e.small_image' in 'where clause'"

我的观察者配置.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Nine_Catalog>
            <version>1.0.0</version>
        </Nine_Catalog>
    </modules>
    <global>
        <events>
            <catalog_block_product_list_collection>
                <observers>
                    <filter_blank_image> // unique idrntifer
                     <type>model</type>
                        <class>Nine_Catalog_Model_Observer</class>
                        <method>filterBlankImage</method>
                    </filter_blank_image>
                </observers>
            </catalog_block_product_list_collection>
        </events>
        </global>
</config>

my observer
------------------
 class Nine_Catalog_Model_Observer extends Varien_Event_Observer{
    public function filterBlankImage(Varien_Event_Observer $observer)
    {
        $collection = $observer->getEvent()->getCollection();
       return  $collection->addAttributeToFilter('small_image',array('neq'=>'no_selection'));
    }
    }
您需要

将"在产品列表中使用"的属性更改为"是",以便在平面集合中使用它。

最新更新