Senza categoria

EdiSES – Lista categorie

SELECT
  cce.entity_id AS category_id,
  ccev.value AS category_name,
  cce.parent_id,
  CASE
    WHEN cce.parent_id = 1 THEN 'Principale'
    ELSE 'Sottocategoria'
  END AS tipo_categoria,
  ccei.value AS is_active
FROM
  catalog_category_entity AS cce
  JOIN catalog_category_entity_varchar AS ccev ON cce.entity_id = ccev.entity_id
  JOIN eav_attribute AS ea ON ccev.attribute_id = ea.attribute_id
  AND ea.attribute_code = 'name'
  JOIN catalog_category_entity_int AS ccei ON cce.entity_id = ccei.entity_id
  JOIN eav_attribute AS eai ON ccei.attribute_id = eai.attribute_id
  AND eai.attribute_code = 'is_active'
WHERE
  ccev.store_id = 0
  AND ccei.value = 1
GROUP by
  category_id;