How can I find all products without images in Magento?

前端 未结 10 751
Happy的楠姐
Happy的楠姐 2020-12-18 03:39

I have some thousand products and want to find all products without an image. I tried to search for (no image) in the admin products grid, but no result. How can I make an S

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-18 03:52

    I tried all but this works for me when flat catalog is enable

    $products = Mage::getModel('catalog/product')
        ->getCollection()
        ->addAttributeToSelect('*')
        ->addAttributeToFilter(
            array(
                array(
                    'attribute' => 'image',
                    'null' => '1'
                ),
                array(
                    'attribute' => 'small_image',
                    'null' => '1'
                ),
                array(
                    'attribute' => 'thumbnail',
                    'null' => '1'
                ),
                array(
                    'attribute' => 'image',
                    'nlike' => '%/%/%'
                ),
                array(
                    'attribute' => 'small_image',
                    'nlike' => '%/%/%'
                ),
                array(
                    'attribute' => 'thumbnail',
                    'nlike' => '%/%/%'
                )
            ),
            null,
            'left'
        );
    

提交回复
热议问题