Question

we have some 1000 products in site.

for some products we uploaded 1, for some2 .... for some 5 images.

if we upload only one image, than for that image we selected small, base, thumbinal in backend

we exported all products using system > import/export> export all produts.

but in csv under small, base, thumbinal columns , we can see that image name.

its going to be manual process if we check like this.

is there any way we can find the products with only one image

Was it helpful?

Solution

You can use bellow custom code for the images count

$products  = Mage::getModel('catalog/product')->getCollection();
        foreach($products as $product) {
            $product->load();
            $galleryData = $product->getData('media_gallery');
            echo "Product Sku: ".$product->getSku()." & Image count : ".count($galleryData['images']);
            echo '<br>';
        }

If your need only image products then use code

 $products  = Mage::getModel('catalog/product')->getCollection();
        foreach($products as $product) {
            $product->load();
            $galleryData = $product->getData('media_gallery');
            if(count($galleryData['images'])==1) {
                echo "Product Sku: ".$product->getSku();

            }
            echo '<br>';
        }
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top