Skip to content

Commit

Permalink
NTR: display privacy note checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalij Mik committed Oct 17, 2024
1 parent baf5c5d commit 6673e0e
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
<input type="hidden" name="mode" value="{{ mode }}"/>

{% block mollie_apple_pay_direct_button %}

{% if mollie_express_required_data_protection %}
{% sw_include '@Storefront/storefront/component/privacy-notice.html.twig' %}
{% endif %}

<button type="submit" data-shop-url="{{ seoUrl('frontend.home.page') }}" class="btn btn-primary btn-block btn-buy apple-pay-button-with-text apple-pay-button-black js-apple-pay mollie-express-button w-100 d-none">
{# space to match height other buttons #}
&nbsp;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% block mollie_express_privacy_notice %}

{% if mollie_express_required_data_protection and visible %}
{% sw_include '@Storefront/storefront/component/privacy-notice.html.twig' %}
{% endif %}

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

{% if mollie_subscriptions_enabled and product.translated.customFields.mollie_payments_product_subscription_enabled %}
<div class="d-grid">
<button class="btn btn-primary btn-block btn-buy" title="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}" aria-label="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}">
<button class="btn btn-primary btn-block btn-buy"
title="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}"
aria-label="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}">
{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}
</button>
</div>
Expand All @@ -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 %}
<div class="row g-2 form-row mt-2 justify-content-end js-apple-pay-container mollie-apple-pay-direct-pdp">
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' with {cols: 'col-8'} %}
</div>

{% 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 %}
<form id="molliePayPalExpressProductDetailForm" action="{{ path('frontend.mollie.paypal-express.start') }}"
data-form-csrf-handler="true"
method="POST">

<input type="hidden" name="productId" value="{{ product.id }}" />
<input
type="hidden"
name="quantity"
value="{{ product.minPurchase }}"
/>
<div class="row g-2 form-row mt-2 justify-content-end">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %}
</div>
</form>
<div class="row g-2 form-row mt-2 justify-content-end">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %}
</div>
{% endblock %}
{% endif %}
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@
{{ 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 %}
<div class="mt-2 js-apple-pay-container mollie-apple-pay-direct-offcanvas">
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' %}
</div>
{% 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 %}
<form id="molliePayPalExpressOffcanvasForm" action="{{ path('frontend.mollie.paypal-express.start', { }) }}" method="GET" >
<div class="mt-2 justify-content-end">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' %}
</div>
</form>
<div class="mt-2 justify-content-end">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' %}
</div>
{% endblock %}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
<div class="mt-2 d-none only-support-apple-pay js-apple-pay-container mollie-apple-pay-direct-listing">
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' %}
Expand All @@ -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 %}
<form class="molliePayPalExpressProductListingForm" action="{{ path('frontend.mollie.paypal-express.start') }}"
data-form-csrf-handler="true"
method="POST">
<input type="hidden" name="productId" value="{{ product.id }}">



<div class="mt-2">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' %}
</div>
</form>
{% endblock %}
{% endif %}
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
<form id="molliePayPalExpressRegisterForm" action="{{ path('frontend.mollie.paypal-express.start', { }) }}" method="GET">
<div class="mt-3 mb-3">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-5'} %}
</div>
</form>
<div class="mt-3 mb-3">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-5'} %}
</div>
{% endblock %}
{% endif %}
{% endblock %}
20 changes: 13 additions & 7 deletions src/Resources/views/storefront/page/checkout/cart/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,27 @@

{% 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 %}
<div class="mt-2 js-apple-pay-container mollie-apple-pay-direct-cart">
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' %}
</div>
{% endblock %}
{% endif %}

{% if mollie_paypalexpress_enabled and ('cart' not in mollie_paypalexpress_restrictions) %}
{% if paypalExpressVisible %}
{% block page_checkout_aside_actions_mollie_paypal_express_component %}
<form id="molliePayPalExpressCartForm" action="{{ path('frontend.mollie.paypal-express.start', { }) }}" method="GET">
<div class="mt-2">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' %}
</div>
</form>
<div class="mt-2">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' %}
</div>
{% endblock %}
{% endif %}
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
<div class="row g-2 form-row mt-2 justify-content-end js-apple-pay-container mollie-apple-pay-direct-pdp">
{% include '@MolliePayments/mollie/component/apple-pay-direct-button.twig' with {cols: 'col-8'} %}
Expand All @@ -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 %}
<form id="molliePayPalExpressProductDetailForm" action="{{ path('frontend.mollie.paypal-express.start') }}"
data-form-csrf-handler="true"
method="POST">

<input type="hidden" name="productId" value="{{ product.id }}" />
<input
type="hidden"
name="quantity"
value="{{ product.minPurchase }}"
/>
<div class="row g-2 form-row mt-2 justify-content-end">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %}
</div>
</form>
<div class="row g-2 form-row mt-2 justify-content-end">
{% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %}
</div>
{% endblock %}
{% endif %}
{% endblock %}
Expand All @@ -60,7 +55,9 @@
{% block page_product_detail_buy_button %}

{% if mollie_subscriptions_enabled and page.product.translated.customFields.mollie_payments_product_subscription_enabled %}
<button class="btn btn-primary btn-block btn-buy" title="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}" aria-label="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}">
<button class="btn btn-primary btn-block btn-buy"
title="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}"
aria-label="{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}">
{{ "molliePayments.subscriptions.product.addToCartText"|trans|sw_sanitize }}
</button>
{% else %}
Expand Down

0 comments on commit 6673e0e

Please sign in to comment.