Last active
August 22, 2018 04:11
-
-
Save trabulium/438b27d192d854185db6b4835a4bece5 to your computer and use it in GitHub Desktop.
Magento 1: Find orphaned simple products with no parent configurable
This file contains 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 | |
type_id,sku, cpev.value, | |
CASE when cpei2.value = 1 THEN "Enabled" ELSE "Disabled" END | |
from catalog_product_entity a | |
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 | |
left join catalog_product_entity_int cpei on cpei.`entity_id` = a.entity_id AND cpei.attribute_id = '91' #visibility | |
left join catalog_product_entity_int cpei2 on cpei2.`entity_id` = a.entity_id AND cpei2.attribute_id = '84' #status | |
left join catalog_product_entity_varchar cpev on cpev.`entity_id` = a.entity_id AND cpev.attribute_id = '60' #name | |
where | |
cpr.parent_id is null | |
and a.type_id != 'configurable' | |
and cpei.value = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment