类别名称存储在 magento 中的什么位置?

where are category NAMES stored in magento?

看起来这应该是一个可以找到的问题,但我找不到它。

类别名称存储在 magento 数据库中的什么位置?我可以看到 catalog_category_entity 有密钥 ID,然后还有其他 EAV table。但是我找不到存储在任何前缀为 catalog_category 的 table 中的类别的实际名称。

至少 catalog_products_entity table 的产品中有 SKU(一些人类可读的值)。

类别名称在 table catalog_category_entity_varchar

您要查找的请求:

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

请注意,这是您默认商店视图的类别名称。
如果您的 magento 中确实有多个商店或商店视图,您只需调整条件 cv.`store_id` = 0.
您的商店列表可以在 table core_store

中找到

'name' 是 VARCHAR 类型的 EAV 属性,因此您可以在 catalog_category_entity_varchar table 上找到该属性的值,但它包含 VARCHAR 类型的所有属性值,因此要仅查询 name 属性的值,您必须找到属性 id 是什么,您可以在 eav_attributes table 中使用类似以下内容找到它:

SELECT * FROM  `eav_attribute` WHERE  `entity_type_id` = ##CATEGORY ENTITY TYPE ID## AND  `attribute_code` =  'name'

如果你有身份证件,那么这行得通:

SELECT DISTINCT value, entity_id FROM catalog_category_entity_varchar WHERE entity_id IN (ID's of the category) AND attribute_id = 111 AND STORE = 0

确保将 "ID's of the category" 替换为以逗号分隔的 ID 和商店 ID。 ) 是默认商店 ID。