Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nyeyint/14fdef16b2365a3dc55d48f12358b609 to your computer and use it in GitHub Desktop.
Save nyeyint/14fdef16b2365a3dc55d48f12358b609 to your computer and use it in GitHub Desktop.
SELECT p.entity_id AS prod,
prod_varchar.value,
p.sku AS sku,
eaov.value AS brand,
cp.category_id AS cp_category_id,
cp.`position` AS cp_position,
c.`entity_id` AS c_category_id,
cat_varchar.value AS CatName,
c.`entity_type_id` AS c_entity_type_id,
c.`attribute_set_id` AS c_attribute_set_id,
c.`parent_id` AS c_parent_id,
c.`path` AS c_path,
c.`position` AS c_position,
c.`level` AS c_level,
c.`children_count` AS c_children_count
FROM catalog_product_entity AS p
LEFT JOIN catalog_category_product AS cp
ON p.entity_id = cp.product_id
LEFT JOIN catalog_category_entity AS c
ON cp.category_id = c.entity_id
LEFT JOIN catalog_category_entity_varchar AS cat_varchar
ON c.entity_id = cat_varchar.entity_id
AND cat_varchar.attribute_id = 111
LEFT JOIN catalog_product_entity_varchar AS prod_varchar
ON p.entity_id = prod_varchar.entity_id
AND prod_varchar.attribute_id = 96
LEFT JOIN eav_attribute AS ea
ON p.entity_type_id = ea.entity_type_id
LEFT JOIN catalog_product_entity_int AS ce_int
ON p.entity_id = ce_int.entity_id
AND ea.attribute_id = ce_int.attribute_id
LEFT JOIN eav_attribute_option_value as eaov
ON ce_int.value = eaov.option_id
WHERE 1
AND c.entity_id = 345
AND eaov.value = 'DTS'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment