在数据库中将“包含在导航菜单中”设置为“是”

时间:2014-09-02 09:48:54

标签: magento

我想将所有类别的Include in Navigation Menu设置为Yes

有谁可以告诉我这个值在哪个表中?

3 个答案:

答案 0 :(得分:1)

Magento使用eav模型在数据库中保存值。

您必须在“eav_attribute”表中搜索名为“include_in_menu”的属性。

此属性具有“attribute_id”,将在其他表中检索。

在我的安装中,此属性具有attribute_id = 67,存储为INTEGER(int)

在magento上,所有属性都有一个你可以在eav_attribute表上找到的类型。

您想要更新类别,我们必须更新保存类别的整数属性“include_in_menu”的表。

正如您在数据库中看到的那样,您有很多类别表:

catalog_category_entity,catalog_category_entity_datetime,catalog_category_entity_decimal,catalog_category_entity_int ...

您必须从第一个表中选择所有类别:从catalog_category_entity中选择entity_id

在必须选择与good属性类型相关的表中的attribute_id之后。这是所有INTEGER属性的“catalog_category_entity_int”... 从catalog_category_entity_int中选择值,其中attribute_id = 67,store_id = ...

如果您有多个商店,请注意......所有商店都在同一张桌子上。

现在你只需要在所选行上将值更新为“1”。

对不起我的英语,我是法国人......

祝你好运 塞德里克

答案 1 :(得分:1)

这个答案适用于Magento EE 2.2.2。

根据Cedric的回答,我使用以下查询通过Sequel Pro从菜单中删除所有类别。

您可以通过运行

从菜单中删除所有类别
UPDATE catalog_category_entity_int SET value='0' WHERE attribute_id='67'

您可以通过运行

将所有类别添加到菜单中
UPDATE catalog_category_entity_int SET value='1' WHERE attribute_id='67'

然后刷新你的缓存(php bin / magento cache:flush),你应该在前端看到你的更改。

同样,要小心你正在影响的'store_id'

答案 2 :(得分:0)

您可以使用以下查询来更新所有类别:

update catalog_category_entity_int cci
inner join eav_attribute a on a.attribute_id = cci.attribute_id
set cci.value = 1
where a.attribute_code = 'include_in_menu';