Created
May 3, 2017 23:31
-
-
Save trabulium/c84c78495ff26eefb5b5f91eb9861a13 to your computer and use it in GitHub Desktop.
Find Orphan Simple Products without Parent Configurable
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 | |
type_id,sku, cpev.value | |
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_varchar cpev on cpev.entity_id = a.entity_id | |
left join catalog_product_entity_int cpei on cpei.entity_id = a.entity_id | |
where | |
# add this if you want to filter by no category | |
# cp.product_id is null | |
cpr.parent_id is null | |
and a.type_id != 'configurable' | |
and cpev.attribute_id = 60 | |
#visibility attribute = 91 and not visible = 1 | |
and cpei.attribute_id = 91 and cpei.value = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment