Skip to content

Commit

Permalink
NTR: show mollie payment js if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
GuentherHade committed Feb 21, 2024
1 parent e584842 commit 8d5b031
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/Resources/views/storefront/base.html.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
{% sw_extends '@Storefront/storefront/base.html.twig' %}

{% block base_main %}

{% block mollie_payments_js_control %}
{% set onlyShowHere = {
'frontend.checkout.confirm.page' : '',
'frontend.checkout.cart.page' : 'cart',
'frontend.navigation.page' : 'plp',
'frontend.account.edit-order.page' : '',
'frontend.detail.page' : 'pdp'
} %}


{% set currentRoute = app.request.attributes.get('_route') %}
{% set implementJS = false %}

{# js always required on this pages #}
{% if currentRoute == 'frontend.checkout.cart.page' or currentRoute == 'frontend.checkout.confirm.page' %}
{% set implementJS = true %}
{% endif %}
{% if mollie_applepaydirect_enabled %}
{% if currentRoute in onlyShowHere|keys and onlyShowHere[currentRoute] not in mollie_applepaydirect_restrictions %}
{% set implementJS = true %}
{% endif %}
{% if 'offcanvas' not in mollie_applepaydirect_restrictions %}
{% set implementJS = true %}
{% endif %}
{% endif %}
{% endblock %}

<script>
window.mollie_javascript_use_shopware = '{{ mollie_javascript_use_shopware }}'
</script>
{% if mollie_javascript_use_shopware != '1' %}
{% if mollie_javascript_use_shopware != '1' and implementJS %}
<script src="{{ asset('bundles/molliepayments/mollie-payments.js', 'asset') }}"></script>
{% endif %}
{{ parent() }}
Expand Down

0 comments on commit 8d5b031

Please sign in to comment.