You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shopware staging环境system_config.yaml配置销售渠道遇未识别选项错误

问题解答

原因说明

你遇到的问题并非文档错误,而是对system_config.yaml的作用理解有误:该文件仅用于定义全局默认系统配置,Symfony的配置验证规则只允许default这一个顶层键,因此直接添加销售渠道ID会触发配置验证错误。

正确实现方式

要针对特定销售渠道配置参数,有以下几种可行方案:

  • 后台手动配置
    进入Shopware后台,依次点击「设置」→「系统配置」,在页面顶部切换到目标销售渠道,找到core.listing.allowBuyInListing参数并设置为false即可。

  • CLI命令导入配置
    创建单独的渠道配置文件(例如channel_config.yaml),内容如下:

    0188da12724970b9b4a708298259b171:
      core.listing.allowBuyInListing: false
    

    然后执行Shopware CLI命令导入:

    bin/console system:config:import channel_config.yaml
    
  • 插件迁移脚本自动化配置
    如果需要在部署过程中自动配置,可在插件的迁移类中使用SystemConfigService设置渠道级参数,示例代码:

    use Shopware\Core\System\SystemConfig\SystemConfigService;
    use Doctrine\DBAL\Connection;
    use Shopware\Core\Framework\Migration\MigrationStep;
    
    class Migration1234567890ChannelConfig extends MigrationStep
    {
        public function getCreationTimestamp(): int
        {
            return 1234567890;
        }
    
        public function update(Connection $connection): void
        {
            $systemConfigService = $this->container->get(SystemConfigService::class);
            $channelId = '0188da12724970b9b4a708298259b171';
            $systemConfigService->set('core.listing.allowBuyInListing', false, $channelId);
        }
    }
    

内容的提问来源于stack exchange,提问作者Martin Locke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.11 23:52:32