diff --git a/src/Resources/views/mollie/component/apple-pay-direct-button.twig b/src/Resources/views/mollie/component/apple-pay-direct-button.twig index 90902e6a6..cdb6af217 100644 --- a/src/Resources/views/mollie/component/apple-pay-direct-button.twig +++ b/src/Resources/views/mollie/component/apple-pay-direct-button.twig @@ -33,11 +33,6 @@ {% block mollie_apple_pay_direct_button %} - - {% if mollie_express_required_data_protection %} - {% sw_include '@Storefront/storefront/component/privacy-notice.html.twig' %} - {% endif %} - @@ -16,54 +18,50 @@ {% block buy_widget_buy_form_inner %} {{ parent() }} - {% block page_product_detail_buy_container_apple_direct %} - {# this is for Shopware < 6.4 #} - {% set buyableLegacy = (not page.product.isCloseout or (page.product.availableStock >= page.product.minPurchase)) and page.product.childCount <= 0 %} - {# this is for Shopware >= 6.4 #} - {% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %} - - {% set productPrice = 0 %} - - {% if product.calculatedPrices|length == 1 %} - {% set productPrice = product.calculatedPrices.first.unitPrice %} - {% else %} - {% set productPrice = product.calculatedPrice.unitPrice %} - {% if listPrice.percentage > 0 %} - {% set productPrice = listPrice.price %} - {% endif %} + + + {# this is for Shopware < 6.4 #} + {% set buyableLegacy = (not page.product.isCloseout or (page.product.availableStock >= page.product.minPurchase)) and page.product.childCount <= 0 %} + {# this is for Shopware >= 6.4 #} + {% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %} + + {% set productPrice = 0 %} + + {% if product.calculatedPrices|length == 1 %} + {% set productPrice = product.calculatedPrices.first.unitPrice %} + {% else %} + {% set productPrice = product.calculatedPrice.unitPrice %} + {% if listPrice.percentage > 0 %} + {% set productPrice = listPrice.price %} {% endif %} + {% endif %} - {% if mollie_applepaydirect_enabled and ('pdp' not in mollie_applepaydirect_restrictions) and ((buyableLegacy) or (buyable and productPrice) > 0) %} - {% block page_product_detail_buy_container_apple_direct_component %} + {% set applePayVisible = mollie_applepaydirect_enabled and ('pdp' not in mollie_applepaydirect_restrictions) and ((buyableLegacy) or (buyable and productPrice) > 0) %} + {% set paypalExpressVisible = mollie_paypalexpress_enabled and ('pdp' not in mollie_paypalexpress_restrictions) and ((buyableLegacy) or (buyable and productPrice) > 0) %} + {% set noticeVisible = applePayVisible or paypalExpressVisible %} + + {% sw_include '@MolliePayments/mollie/component/express-privacy-notice.html.twig' with {visible:noticeVisible} %} + + + + {% block page_product_detail_buy_container_apple_direct %} + + {% if applePayVisible %} + {% block page_product_detail_buy_container_apple_direct_component %}
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' with {cols: 'col-8'} %}
- {% endblock %} {% endif %} - - {% endblock %} {% block page_product_detail_buy_container_paypal_express %} - {% if mollie_paypalexpress_enabled and ('pdp' not in mollie_paypalexpress_restrictions) %} + {% if paypalExpressVisible %} {% block page_product_detail_buy_container_mollie_paypal_express_component %} - {% set product = page.product %} -
- - - -
- {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %} -
-
+
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %} +
{% endblock %} {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig b/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig index 932150463..55b637d4b 100644 --- a/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig +++ b/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig @@ -5,7 +5,14 @@ {{ parent() }} {% if page.cart.lineItems|length > 0 %} - {% if mollie_applepaydirect_enabled and ('offcanvas' not in mollie_applepaydirect_restrictions) %} + {% set applePayVisible = mollie_applepaydirect_enabled and ('offcanvas' not in mollie_applepaydirect_restrictions) %} + {% set paypalExpressVisible = mollie_paypalexpress_enabled and ('offcanvas' not in mollie_paypalexpress_restrictions) %} + {% set noticeVisible = applePayVisible or paypalExpressVisible %} + + {% sw_include '@MolliePayments/mollie/component/express-privacy-notice.html.twig' with {visible:noticeVisible} %} + + + {% if applePayVisible %} {% block component_offcanvas_cart_actions_checkout_apple_direct_component %}
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' %} @@ -13,13 +20,11 @@ {% endblock %} {% endif %} - {% if mollie_paypalexpress_enabled and ('offcanvas' not in mollie_paypalexpress_restrictions) %} + {% if paypalExpressVisible %} {% block component_offcanvas_cart_actions_checkout_mollie_paypal_express_component %} -
-
- {% include '@MolliePayments/mollie/component/paypal-express-button.twig' %} -
-
+
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' %} +
{% endblock %} {% endif %} diff --git a/src/Resources/views/storefront/component/product/card/action.html.twig b/src/Resources/views/storefront/component/product/card/action.html.twig index 346165196..14de3e083 100644 --- a/src/Resources/views/storefront/component/product/card/action.html.twig +++ b/src/Resources/views/storefront/component/product/card/action.html.twig @@ -5,20 +5,26 @@ {{ parent() }} - {% block component_product_box_action_buy_apple_direct %} - - {% set productPrice = 0 %} + {% set productPrice = 0 %} - {% if product.calculatedPrices|length == 1 %} - {% set productPrice = product.calculatedPrices.first.unitPrice %} - {% else %} - {% set productPrice = product.calculatedPrice.unitPrice %} - {% if listPrice.percentage > 0 %} - {% set productPrice = listPrice.price %} - {% endif %} + {% if product.calculatedPrices|length == 1 %} + {% set productPrice = product.calculatedPrices.first.unitPrice %} + {% else %} + {% set productPrice = product.calculatedPrice.unitPrice %} + {% if listPrice.percentage > 0 %} + {% set productPrice = listPrice.price %} {% endif %} + {% endif %} + + {% set applePayVisible = mollie_applepaydirect_enabled and ('plp' not in mollie_applepaydirect_restrictions) and productPrice > 0 %} + {% set paypalExpressVisible = mollie_paypalexpress_enabled and ('plp' not in mollie_paypalexpress_restrictions) and productPrice > 0 %} + {% set noticeVisible = applePayVisible or paypalExpressVisible %} + + {% sw_include '@MolliePayments/mollie/component/express-privacy-notice.html.twig' with {visible:noticeVisible} %} - {% if mollie_applepaydirect_enabled and ('plp' not in mollie_applepaydirect_restrictions) and productPrice > 0 %} + {% block component_product_box_action_buy_apple_direct %} + + {% if applePayVisible %} {% block component_product_box_action_buy_apple_direct_component %}
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' %} @@ -28,19 +34,11 @@ {% endblock %} {% block component_product_box_action_buy_paypal_express %} - {% if mollie_paypalexpress_enabled and ('plp' not in mollie_paypalexpress_restrictions) %} + {% if paypalExpressVisible %} {% block component_offcanvas_cart_actions_checkout_mollie_paypal_express_component %} -
- - - -
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' %}
-
{% endblock %} {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/page/checkout/address/index.html.twig b/src/Resources/views/storefront/page/checkout/address/index.html.twig index e0d2886de..38546a42d 100644 --- a/src/Resources/views/storefront/page/checkout/address/index.html.twig +++ b/src/Resources/views/storefront/page/checkout/address/index.html.twig @@ -4,13 +4,17 @@ {{ parent() }} - {% if mollie_paypalexpress_enabled and ('register' not in mollie_paypalexpress_restrictions) %} + + {% set paypalExpressVisible = mollie_paypalexpress_enabled and ('register' not in mollie_paypalexpress_restrictions) %} + {% set noticeVisible = applePayVisible or paypalExpressVisible %} + + {% sw_include '@MolliePayments/mollie/component/express-privacy-notice.html.twig' with {visible:paypalExpressVisible} %} + + {% if paypalExpressVisible %} {% block page_checkout_address_mollie_paypal_express_component %} -
-
- {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-5'} %} -
-
+
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-5'} %} +
{% endblock %} {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/page/checkout/cart/index.html.twig b/src/Resources/views/storefront/page/checkout/cart/index.html.twig index 95155cd39..81d0c4095 100644 --- a/src/Resources/views/storefront/page/checkout/cart/index.html.twig +++ b/src/Resources/views/storefront/page/checkout/cart/index.html.twig @@ -21,7 +21,15 @@ {% block page_checkout_aside_actions %} {{ parent() }} - {% if mollie_applepaydirect_enabled and ('cart' not in mollie_applepaydirect_restrictions) %} + + {% set applePayVisible = mollie_applepaydirect_enabled and ('cart' not in mollie_applepaydirect_restrictions) %} + {% set paypalExpressVisible = mollie_paypalexpress_enabled and ('cart' not in mollie_paypalexpress_restrictions) %} + {% set noticeVisible = applePayVisible or paypalExpressVisible %} + + {% sw_include '@MolliePayments/mollie/component/express-privacy-notice.html.twig' with {visible:noticeVisible} %} + + + {% if applePayVisible %} {% block page_checkout_aside_actions_apple_direct_component %}
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' %} @@ -29,13 +37,11 @@ {% endblock %} {% endif %} - {% if mollie_paypalexpress_enabled and ('cart' not in mollie_paypalexpress_restrictions) %} + {% if paypalExpressVisible %} {% block page_checkout_aside_actions_mollie_paypal_express_component %} -
-
- {% include '@MolliePayments/mollie/component/paypal-express-button.twig' %} -
-
+
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' %} +
{% endblock %} {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig b/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig index 3a8fd6263..c44f81861 100755 --- a/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig +++ b/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig @@ -2,26 +2,33 @@ {% block page_product_detail_buy_form_inner %} {{ parent() }} - {% block page_product_detail_buy_container_apple_direct %} - {# this is for Shopware < 6.4 #} - {% set buyableLegacy = (not page.product.isCloseout or (page.product.availableStock >= page.product.minPurchase)) and page.product.childCount <= 0 %} - {# this is for Shopware >= 6.4 #} - {% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %} - {% set productPrice = 0 %} + {# this is for Shopware < 6.4 #} + {% set buyableLegacy = (not page.product.isCloseout or (page.product.availableStock >= page.product.minPurchase)) and page.product.childCount <= 0 %} + {# this is for Shopware >= 6.4 #} + {% set buyable = product.available and product.childCount <= 0 and product.calculatedMaxPurchase > 0 %} + + {% set productPrice = 0 %} - {% if product.calculatedPrices|length == 1 %} - {% set productPrice = product.calculatedPrices.first.unitPrice %} - {% else %} - {% set productPrice = product.calculatedPrice.unitPrice %} + {% if product.calculatedPrices|length == 1 %} + {% set productPrice = product.calculatedPrices.first.unitPrice %} + {% else %} + {% set productPrice = product.calculatedPrice.unitPrice %} - {% if listPrice.percentage > 0 %} - {% set productPrice = listPrice.price %} - {% endif %} + {% if listPrice.percentage > 0 %} + {% set productPrice = listPrice.price %} {% endif %} + {% endif %} - {% if mollie_applepaydirect_enabled and ('pdp' not in mollie_applepaydirect_restrictions) and ((buyableLegacy) or (buyable and productPrice) > 0) %} + {% set applePayVisible = mollie_applepaydirect_enabled and ('pdp' not in mollie_applepaydirect_restrictions) and ((buyableLegacy) or (buyable and productPrice) > 0) %} + {% set paypalExpressVisible = mollie_paypalexpress_enabled and ('pdp' not in mollie_paypalexpress_restrictions) and ((buyableLegacy) or (buyable and productPrice) > 0) %} + {% set noticeVisible = applePayVisible or paypalExpressVisible %} + + {% sw_include '@MolliePayments/mollie/component/express-privacy-notice.html.twig' with {visible:noticeVisible} %} + + {% block page_product_detail_buy_container_apple_direct %} + {% if applePayVisible %} {% block page_product_detail_buy_container_apple_direct_component %}
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' with {cols: 'col-8'} %} @@ -31,23 +38,11 @@ {% endblock %} {% block page_product_detail_buy_container_paypal_express %} - {% if mollie_paypalexpress_enabled and ('pdp' not in mollie_paypalexpress_restrictions) %} + {% if paypalExpressVisible %} {% block page_product_detail_buy_container_mollie_paypal_express_component %} - {% set product = page.product %} -
- - - -
- {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %} -
-
+
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %} +
{% endblock %} {% endif %} {% endblock %} @@ -60,7 +55,9 @@ {% block page_product_detail_buy_button %} {% if mollie_subscriptions_enabled and page.product.translated.customFields.mollie_payments_product_subscription_enabled %} - {% else %}