Shape-and-Shift / shopware-shortcode

Use Wordpress like Shortcodes in Shopware 6
MIT License
15 stars 3 forks source link

Shortcodes plugin causing issues on pages without an URL #8

Closed ChristopherDosin closed 2 years ago

ChristopherDosin commented 2 years ago

We have found a compatibility issue with the Shortcodes plugin and plugins that contains html forms (ex. ).

When we submit a form with a post request, this will load a new page and will trigger ResponseSubscriber where an error is returned (see image below). This error is produced by the subscriber ResponseSubscriber at sas/shortcode/src/Subscriber/ResponseSubscriber.php because the $host returns null when the page is loaded by a form.Back in stock notifications.

image

LarsPauwels commented 2 years ago

If any questions, please ask.

pedramham commented 2 years ago

If any questions, please ask.

Hi @LarsPauwels . I created a simple form plugin to simulate this bug.But i could not make this error.Can you help me how to create this bug.

https://github.com/pedramham/testFormPlugin

LarsPauwels commented 2 years ago

We had a problem with the combination of the shortcode plugin and the back in stock plugin (https://store.shopware.com/en/zeobv82482397379/back-in-stock-notifications-plugin-of-the-month.html). If I compare your test with the plugin setup then I found out that the submit endpoint contains the store-api scope instead of the storefront scope. image

LarsPauwels commented 2 years ago

So I think you need to change the scope in the file src/Controller/SubmitFormController.php.

ChristopherDosin commented 2 years ago

@LarsPauwels So in this case it should be fixed within the GetNotified plugin you use, right?

LarsPauwels commented 2 years ago

As far as I can see this would fix it.

ChristopherDosin commented 2 years ago

Okay, then i will close this issue. If there're any problems feel free to create a new one or re-open it.

LarsPauwels commented 2 years ago

Super. I will test this right now.

LarsPauwels commented 2 years ago

I looked at it and there are multiple plugins using this way. So I can't change alle the plugins that use a different scope. The problem is that if a different scope is used the host null is. So In the shortcode plugin needs to be a check of some sort the prevent this error.