Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config overrides in system_config have no effect in api/_action/system-config #215

Open
sjerdo opened this issue Aug 2, 2023 · 3 comments
Labels
kind/bug Something isn't working

Comments

@sjerdo
Copy link

sjerdo commented Aug 2, 2023

PHP Version

8.2.7

Shopware Version

v6.5.3.3

Actual behaviour

We use the BucsItTimeline plugin to show a timeline of order events at the order detail page. We'd like to show this timeline at the bottom of the page. The BucsItTimeline plugin contains configuration options to set the position of the timeline card.

We set this config in frosh_tools.yaml

frosh_tools:
    system_config:
        default:
            BucsItTimeline.config.orderPosition: "bottom"

The override is included in the result of AbstractSystemConfigLoader->load(), but this method is not considered for SystemConfigService->getDomain() which is used by Shopware route /api/_action/system-config in SystemConfigController::getConfigurationValues()

The result for the system-config array includes the default value:

{
    "BucsItTimeline.config.defaultHeight": 600,
    "BucsItTimeline.config.defaultCollapsed": false,
    "BucsItTimeline.config.orderPosition": "top",
    "BucsItTimeline.config.customerPosition": "bottom"
}

Expected behaviour

The result for the system-config API response should include the overridden value for BucsItTimeline.config.orderPosition:

{
    "BucsItTimeline.config.defaultHeight": 600,
    "BucsItTimeline.config.defaultCollapsed": false,
    "BucsItTimeline.config.orderPosition": "bottom",
    "BucsItTimeline.config.customerPosition": "bottom"
}

Steps to Reproduce?

  • Install plugin BucsItTimeline
  • Install FroshTools bundle
  • Set config in config/packages/frosh_tools.yaml:
frosh_tools:
    system_config:
        default:
            BucsItTimeline.config.orderPosition: "bottom"
  • Open an order detail page
  • BucsItTimeline is positioned at the top instead of the bottom.
GET /api/_action/system-config?domain=BucsItTimeline.config HTTP/1.1
Accept: application/vnd.api+json
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,nl;q=0.7

HTTP/1.1 200 OK
...
Content-Type: application/json
Content-Length: 118

{
    "BucsItTimeline.config.defaultHeight": 600,
    "BucsItTimeline.config.defaultCollapsed": false,
    "BucsItTimeline.config.orderPosition": "top",
    "BucsItTimeline.config.customerPosition": "bottom"
}
@sjerdo sjerdo added the kind/bug Something isn't working label Aug 2, 2023
@shyim
Copy link
Member

shyim commented Aug 2, 2023

Is it just displaying problem?

@sjerdo
Copy link
Author

sjerdo commented Aug 2, 2023

Well, for this plugin it is just a displaying problem. We could override the templates to show the timeline card at the correct position, but we'd rather not override these plugin admin Twig files.

I'm not aware of any other issues, since we don't override that many configuration values. However, all settings retrieved by Admin API method systemConfigApiService.getValues() do only return the configuration from the database and are not overridden by FroshTools ConfigSystemConfigLoader.

@tinect
Copy link
Member

tinect commented Jan 9, 2024

This uses \Shopware\Core\System\SystemConfig\SystemConfigService::getDomain. It looks like this can be fixed by subscribing onto SystemConfigDomainLoadedEvent and manipulating the config.

You are welcome to add a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants