Skip to content

Instantly share code, notes, and snippets.

@trabulium
Created May 3, 2017 23:31
Show Gist options
  • Save trabulium/c84c78495ff26eefb5b5f91eb9861a13 to your computer and use it in GitHub Desktop.
Save trabulium/c84c78495ff26eefb5b5f91eb9861a13 to your computer and use it in GitHub Desktop.
Find Orphan Simple Products without Parent Configurable
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