首页 > 解决方案 > Magento:如何将商店设置转移到默认范围?

问题描述

我的一间店铺设置不当,很多设置都是在 scope_id 1 中进行的,而不是 0。

我需要找到在 scope_id 1 中所做的所有设置并将它们传输(复制)到 scope id 0 中。然后,也许我可以从 scope_id 1 中删除这些设置。

这可以使用哪个 SQL 查询来完成?

提前感谢所有答案。

core_config_data 表视图

标签: phpmysqlsqlmagento

解决方案


您可以通过执行更新连接来完成此操作,您可以在其中连接core_config_data到自身并在每个连接的表上设置条件scope_id,然后您只需删除存储 1 值,这样它们就不会覆盖存储 0 设置:

update core_config_data store0
left join core_config_data store1
on store1.path = store0.path
where store0.scope_id = 0
and store1.scope_id = 1
and store1.value is not null;

在上面的更新之后,您可以在运行下面的删除语句之前检查您的 scope=0 值以确保:

delete from core_config_data where scope_id = 1;

推荐阅读