0
votes

I have imported more than 55k products in magento. And i found that some of the products don't have images imported.

Can you give me a way how can i export the products having no images ?

I have tried to export the product having image value as 'no_selection' but, it gives me only 2-3 items. Then i tried to cross verify those entity_id which have no images into 'catalog_product_entity_varchar' table. And i surprised by not finding when some entity_id presents in 'catalog_product_entity' table but not in 'catalog_product_entity_varchar' table.

Can anyone give me a way to solve this problem.

Any help will really be appreciated.

Regards

2

2 Answers

0
votes

Does this query help?

SELECT t0.sku
FROM catalog_product_entity AS t0
WHERE NOT EXISTS(
  SELECT NULL 
  FROM catalog_product_entity_media_gallery AS t1
  WHERE (t1.entity_id = t0.entity_id)
  )
0
votes

If you only need SKUs, one method I have used in the past is via a Magento shell script. This example will output only SKU's (one per line) for only those products which have no value for the image attribute.

<?php

error_reporting(E_ALL);
error_reporting(-1);

require_once 'app/Mage.php';

Mage::app();

$collection = Mage::getModel('catalog/product')->getCollection();

foreach($collection as $product){

        $productId = $product->getId();
        $prod = Mage::getModel('catalog/product')->load($productId);
        $hasImage = Mage::helper('catalog/image')->init($prod, 'image');

        if (!$hasImage){
                echo $prod->getSku() . "\n";
        }
}

?>

I put this into "list-noimages.php, and into my Magento root folder. Only use this in development environment, or very limited on production. Run it via shell as so:

php list-noimages.php

For that many products you can output to a file:

php list-noimages.php >> skus.txt

Otherwise visit the file via your web browser and save the output.