Created
April 5, 2016 15:25
-
-
Save bkozora/2105376448b3fc0707e68caecaaedda1 to your computer and use it in GitHub Desktop.
Magento - Grab Orphaned Enabled Products
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
* | |
FROM | |
catalog_product_entity a | |
LEFT JOIN | |
catalog_product_entity_int ei ON ei.entity_id = a.entity_id | |
LEFT JOIN | |
catalog_category_product cp ON cp.`product_id` = a.entity_id | |
LEFT JOIN | |
catalog_product_relation cpr ON cpr.child_id = a.entity_id | |
WHERE | |
cp.product_id IS NULL | |
AND cpr.parent_id IS NULL | |
AND a.type_id != 'configurable' | |
AND ei.attribute_id = 89 | |
AND ei.value = 1 | |
/* | |
AND attribute_id = (SELECT | |
attribute_id | |
FROM | |
`eav_attribute` | |
WHERE | |
`attribute_code` LIKE 'status') | |
AND `ei`.`value` = 1 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment