php - Magento:如何将商店设置转移到默认范围?
问题描述
我的一间店铺设置不当,很多设置都是在 scope_id 1 中进行的,而不是 0。
我需要找到在 scope_id 1 中所做的所有设置并将它们传输(复制)到 scope id 0 中。然后,也许我可以从 scope_id 1 中删除这些设置。
这可以使用哪个 SQL 查询来完成?
提前感谢所有答案。
解决方案
您可以通过执行更新连接来完成此操作,您可以在其中连接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;
推荐阅读
- amazon-web-services - 建筑学?业务逻辑与大数据分离
- apache-spark - 如何收集流数据集(到 Scala 值)?
- python - Keras 在训练分类 LSTM 序列到序列模型时给出 nan
- python - 为什么给定输入的 Keras 中的简单 CNN 网络会出错
- excel-formula - 如何连接连续的单元格范围
- linux - 以一个用户身份运行一些命令,并访问另一个用户设置的变量
- html - Angular 7 组件在 html 上显示图像的问题。为什么图片不显示?
- javascript - 在页面加载时打开 javascript 模式
- python-3.x - 在请求之间共享全局字典
- docker - 如何在 Ubuntu Artful (17.10) 上安装 Docker 18.09