Seems like this should be a findable question but I could not locate it.
Where is the category NAME stored in the magento database? I can see catalog_category_entity
has the key ID, and then there are the other EAV tables. But I cannot find the actual name of the category stored in any table prefixed by catalog_category
.
At least with products the catalog_products_entity table has the SKU (some human-readable value) in it.
Magento 2 categories are the building blocks of the catalog and provide ease of navigation to the customers. While Magento 2 products are the heart of an online store. If you have built a new Magento 2 store, the primary step is to add new category and product in Magento 2.
Category pages serve as a bridge between the homepage and the product pages, bringing the customers one step closer to finding the right products. They are an essential step in a customer purchase path for customers browsing the store using the main navigation as opposed to search.
You can get the root category ID in Magento 2 by calling the getRootCateogryId() function in the phtml file.
Magento 2 allows store admins to add and remove products from the category under Magento 2 Admin panel > CATALOG > Categories > Products in Categories section.
The categories names are in the table catalog_category_entity_varchar
The request you are looking for :
select cat.*, cv.value as `category_name` from `catalog_category_entity` as cat
join `catalog_category_entity_varchar` as cv on cat.entity_id = cv.`entity_id`
join `eav_attribute` as att on att.`attribute_id` = cv.`attribute_id`
join `eav_entity_type` as aty on att.`entity_type_id` = aty.`entity_type_id`
where aty.`entity_model` = 'catalog/category' and att.`attribute_code` = 'name' and cv.`store_id` = 0
Please note that this is the name of your categories for your default store view.
If you do have multiple store or store view in your magento you just have to adapt the condition cv.`store_id` = 0
.
The list of your stores can be found in the table core_store
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With