0

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

2

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>';
        }
        }
  • i will check it..... – Baby in Magento Oct 28 '15 at 10:35
  • 1
    Please add code in your file <?php require_once('app/Mage.php'); Mage::app('default'); class TEST { public function index() { $products = Mage::getModel('catalog/product')->getCollection(); foreach($products as $product) { $product->load($product->getId()); $galleryData = $product->getData('media_gallery'); $galleryData = $product->getData('media_gallery'); echo "Product Sku: ".$product->getSku()." & Image count : ".count($galleryData['images']); echo '<br>'; } } } $obj = new TEST(); $obj->index(); ?> – Abdul Oct 28 '15 at 11:15
  • 1
    but it is working my end – Abdul Oct 28 '15 at 11:19
  • 1
    <?php require_once('app/Mage.php'); Mage::app('default'); class TEST { public function index() { $products = Mage::getModel('catalog/product')->getCollection(); foreach($products as $product) { $product->load($product->getId()); $galleryData = $product->getData('media_gallery'); $galleryData = $product->getData('media_gallery'); echo "Product Sku: ".$product->getSku()." & Image count : ".count($galleryData['images']); echo '<br>'; } } } $obj = new TEST(); $obj->index(); ?> – Abdul Oct 28 '15 at 11:30
  • 1
    If comment help full then add vote me...:) – Abdul Oct 28 '15 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.