cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.2.5 / view whether product is enabled/disabled in SQL

Magento 2.2.5 / view whether product is enabled/disabled in SQL

I need to be able to see whether the product status is enabled/disabled via sql.

So far I figured out that you need to go to

catalog_product_entity_int
attribute_id = 97
value should be 1 or 2

but my issue is there's always two records with the same entity_id and attribute_id = 97
one with value 1 other with value 2

only thing that is different is value_id...

for example
value_id "17125" attribute_id "97"store_id "1" entity_id"2401" value"1"
value_id "17121" attribute_id "97"store_id "0" entity_id"2401" value"2"

etc.

confused... what is value_id? i only have one store, is it normal to have two store_id???



1 REPLY 1

Re: Magento 2.2.5 / view whether product is enabled/disabled in SQL

Hello romans_polevecko

 

You can use this query to find disable product list 

SELECT entity_id FROM `catalog_product_entity_int`
WHERE attribute_id = (
    SELECT attribute_id FROM `eav_attribute`
    WHERE `attribute_code` LIKE 'status'
) AND `catalog_product_entity_int`.value = 2

You can use this query to find enable product list 

 

SELECT entity_id FROM `catalog_product_entity_int`
WHERE attribute_id = (
    SELECT attribute_id FROM `eav_attribute`
    WHERE `attribute_code` LIKE 'status'
) AND `catalog_product_entity_int`.value = 1
With all product attribute and information then please use this query. 
select
  `eav_attribute`.`attribute_id` AS `attribute_id`,
  `catalog_product_entity_int`.`entity_id` AS `entity_id`,
  `catalog_product_entity_int`.`value` AS `value`,
  `eav_attribute`.`attribute_code` AS `attribute_code`,
  `catalog_product_entity`.`sku` AS `sku`,
  `catalog_product_entity`.`created_at` AS `created_at`,
  `catalog_product_entity`.`updated_at` AS `updated_at`
from
  ((`eav_attribute`
  join `catalog_product_entity_int` on ((`eav_attribute`.`attribute_id` = `catalog_product_entity_int`.`attribute_id`)))
  join `catalog_product_entity` on ((`catalog_product_entity_int`.`entity_id` = `catalog_product_entity`.`entity_id`)))
where
  ((`eav_attribute`.`attribute_code` = 'status') and
  (`catalog_product_entity_int`.`value` = 1))
if issue solved and help ,Click Kudos & Accept as Solution