Magento disable products with no images

I am trying to disable a lot of products that do not have images in my Magento installation.

The following SQL query is supposed to get all products with no images but I need a way to set all products with no images to status disabled?

SELECT * FROM catalog_product_entity_media_gallery
        RIGHT OUTER JOIN catalog_product_entity
            ON catalog_product_entity.entity_id = talog_product_entity_media_gallery.entity_id 
   WHERE catalog_product_entity_media_gallery.value is NULL

Here is what you are looking for Kode:

-- here you set every one as DISABLED (id 2)
UPDATE catalog_product_entity_int SET value = 2 
-- here you are change just the attribute STATUS
WHERE attribute_id = 4
    -- here you are looking for the products that match your criteria
    AND entity_id IN (
        -- your original search
        SELECT entity_id 
        FROM catalog_product_entity_media_gallery
        RIGHT OUTER JOIN catalog_product_entity ON catalog_product_entity.entity_id = catalog_product_entity_media_gallery.entity_id 
        WHERE catalog_product_entity_media_gallery.value is NULL
    );

How can i hide products with no images on frontend, Instead of checking each product manually you can use Store Diagnostic tool that allows you to detect and get a list of products with no images and then either filter them and set status to disabled in bulk or export it and make them temporarily disabled via import, until you are ready to make them visible to public. Magento 2 provides "compare products" functionality out of the box, but not every store needs this feature. Unfortunately, there is no simple way to disable compare products in Magento. This simple extension will allow you to remove the compare products feature.

I use this for magento 2.2.3

update catalog_product_entity_int m
left join eav_attribute a on a.entity_type_id = 4 and a.attribute_id = m.attribute_id
set value = 2
where
  a.attribute_code = 'status'
  and m.entity_id in
    (
      select m.entity_id
      from catalog_product_entity m
      left join catalog_product_entity_media_gallery_value_to_entity a
        on a.entity_id = m.entity_id
      where a.value_id is null
    )
;

How to count disabled products with no images from querey in , To check Product and images via sql query you have to query 4 tables,. 1 - catalog_product_entity ( for product ids ). Magento consider this with 'no_selection' by default for the products having no image so simply we can use a query to search with 'no_selection' in the database to search the products having no image. Please comment your reviews and Upvote the answer if you like, also please visit us at ghrix.com and feel

This will obviously apply to any other attribute, so just change the code as necessary.

enabled = 1
disabled = 2

UPDATE catalog_product_entity_int cpei, catalog_product_entity cpe
SET cpei.value = "2"
WHERE cpe.entity_id = cpei.entity_id
AND cpe.sku LIKE '%SKU%'
AND cpei.attribute_id = 273

Also you can refer detail Document link

let me know if i can help you further

Magento, Magento – View products without product image / Hide. Posted on 16. May 2013 by Covos. Picture. New products have arrived and are set directly in the  1. How to manage Product Images In Magento 2: First, you Open the product in Edit mode. Then, you can do anything below: Upload an Image: You can do in 2 ways . Drag an image from your desktop, and drop it in the “ Camera ” Icon tiles the Images and Videos Box.

I have modified it slightly and this worked for me

Removed WHERE attribute_id = 4 and updated SELECT entity_id to SELECT catalog_product_entity.entity_id

UPDATE catalog_product_entity_int SET value = 2 
WHERE entity_id IN(
        SELECT catalog_product_entity.entity_id 
        FROM catalog_product_entity_media_gallery
        RIGHT OUTER JOIN catalog_product_entity ON catalog_product_entity.entity_id = catalog_product_entity_media_gallery.entity_id 
        WHERE catalog_product_entity_media_gallery.value is NULL
    );

Disabling vs. Hiding a product in Magento, Disabling a product in Magento. What it does: The product will no longer appear on the frontend in any way (not site search, not category listings). If a customer  Expand Product Stock Options and configure: To manage inventory and use all Magento features, set Manage Stock to Yes (default). To disable Magento Inventory Management, deselect the Use system value checkbox and set Manage Stock to No. When complete, click Save Config. Product Stock Options. Manage stock for a store. See Configure Global Options.

How to Work with Cache in Magento - RocketTheme, Disabling the caching feature in Magento is a great first step during initial setup. If you are changing images on products, and not seeing the new images on  Enable/Disable Cache Types In Magento 2 Backend. In your Magento backend, go to System > Tools > Cache Management. Check the box on which cache type you want to enable/disable. Then on the top left corner, select the appropriate action (Enable/Disable) and click the Submit button. Using Command Line

Magento 2 Add Images To Product Programmatically – Mageplaza, Method 1: Add Or Remove Media Images Programmatically By Using The Magento_Catalog Module Classes. Firstly, I will describe the process of adding and  How To Fix Magento Image Upload Button Not Showing Have your Magento upload buttons gone missing on the backend for all of your products? This seems to be a common problem with Magneto websites, but there is a very easy way to fix this!

How to detect products without images in Magento, If not, change permissions to 777 * Check if your images were uploaded to correct How do I bulk remove Magento Custom Options for selected products? Possible reason 3: Magento cannot resize images due low PHP memory limit. Magento resize images using GD library, however if there is no sufficient amount of memory for such operation Magento will return a placeholder image. Solution: Increase your memory limit. You should open your .htaccess file and find this string: php_value memory_limit 256M

Comments
  • I'm still not sure what the query would be and I don't want to try as I will most likely mess the db up
  • if possible take backup first then try :(
  • @KodeMatt you would be insane to do this on production, this is why you have a development build.