-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
* NTR: show mollie payment js if needed * NTR: added comments * NTR: Fixes
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,43 @@ | ||
{% sw_extends '@Storefront/storefront/base.html.twig' %} | ||
|
||
{% block base_main %} | ||
|
||
|
||
{# pages where apple pay requires js with their mollie_applepaydirect_restrictions names as values #} | ||
{% 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 %} | ||
|
||
{# requirement check for apple pay direct #} | ||
{% if mollie_applepaydirect_enabled == true or mollie_applepay_enabled == true %} | ||
{% 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 %} | ||
|
||
<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 == true %} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
boxblinkracer
Collaborator
|
||
<script src="{{ asset('bundles/molliepayments/mollie-payments.js', 'asset') }}"></script> | ||
{% endif %} | ||
|
||
{{ parent() }} | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ public static function getSubscribedEvents() | |
public function onStorefrontRender(StorefrontRenderEvent $event): void | ||
{ | ||
try { | ||
$applePayEnabled = $this->applePay->getActiveApplePayID($event->getSalesChannelContext()); | ||
$applePayEnabled = (bool) $this->applePay->getActiveApplePayID($event->getSalesChannelContext()); | ||
This comment has been minimized.
Sorry, something went wrong.
boxblinkracer
Collaborator
|
||
} catch (\Exception $ex) { | ||
$applePayEnabled = false; | ||
} | ||
|
maybe rename implementJS to addJsToPage? or something like this?