I have this SQL query to get all Magento Categories.
SELECT DISTINCT
cc.entity_id AS id,
cc.`value` AS path,
cc1.`value` AS `NAME`,
cce.`level`,
cce.parent_id
FROM
catalog_category_entity_varchar cc
JOIN catalog_category_entity_varchar cc1 ON cc.entity_id = cc1.entity_id
JOIN eav_entity_type ee ON cc.entity_type_id = ee.entity_type_id
JOIN catalog_category_entity cce ON cc.entity_id = cce.entity_id
WHERE
cc.attribute_id = '57'
AND cc1.attribute_id = '41'
AND ee.entity_model = 'catalog/category'
This returns all categories except the one I created a new category from Magento backend but that is not showing.
That category is published and has no products in it.
Following image is from catalog_category_entity_varchar
table.
entity_id = 449
is showing when I run that query, because it has attribute_id = 57 and 41
But I am talking about entity_id = 452
that is not showing, because it does not have attribute_id = 57
.
I want to ask Magento experts, what does attribute_id = 57
belong to? and how can I fix this query to fetch all categories?
PS
I want Pure SQL query, No Magento code!