Magento 2: Deactivate Products without images

update catalog_product_entity_int
-- select * from catalog_product_entity_int
set catalog_product_entity_int.value = 2
where (catalog_product_entity_int.attribute_id = 97) and catalog_product_entity_int.entity_id in (
select entity_id from (
Select distinct(product.entity_id)
FROM bitnami_magento.catalog_product_entity product
left join catalog_product_entity_media_gallery_value_to_entity valentity on valentity.entity_id = product.entity_id
left join catalog_product_entity_media_gallery image on image.value_id = valentity.value_id and (image.attribute_id in (90))
inner join catalog_product_entity_int status_t on (status_t.entity_id = product.entity_id) and (status_t.attribute_id=97 and status_t.value=1)
where product.entity_id not in (select entity_id from catalog_product_entity_media_gallery_value_to_entity)
) as c )

Leave a Reply