Search code examples
shopware6

Is there a preview mode for shopware 6 apps?


is there a built-in solution for shopware 6 apps to be previewed? For example my app shows messages and I want the shop owner to see the messages in a preview before he activates the messages globally in the shop. How do I obtain this functionality? Thank you very much for help.


Solution

  • There's no such thing out of the box. If the preview doesn't have to be behind an authentication and may just broadly be hidden, then you could use a query parameter to decide on showing the message, even if the general display is turned off.

    {% if config('MyApp.config.globallyActive') or app.request.query.has('previewEnabled') %}
       <p>My Message visible if globally active or preview is enabled</p>
    {% endif %}
    

    Then inform the shop owner to visit a page where a message would be shown using the previewEnabled query parameters:
    http://shop.example.tld/some-page-with-the-message?previewEnabled