Skip to content

Commit

Permalink
NTR: fix ppe tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalij Mik committed Apr 24, 2024
1 parent 31939b0 commit 77f655a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ export default class PayPalExpressPlugin extends Plugin {
init() {

// Shopware 6.4 has product-detail-quantity-select, shopware 6.5 product-detail-quantity-input
const shopwareQuantityInput = document.querySelector('#productDetailPageBuyProductForm *[class*="product-detail-quantity"]:not(div)');
let shopwareQuantityInput = document.querySelector('#productDetailPageBuyProductForm *[class*="quantity"]:not(div)');
if(shopwareQuantityInput === null){
return;
}


const paypalExpressQuantityInput = document.querySelector('#molliePayPalExpressProductDetailForm input[name="quantity"]');
if(paypalExpressQuantityInput === null){
return;
Expand Down
4 changes: 3 additions & 1 deletion src/Resources/views/storefront/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
{% set includeJsInHeader = true %}
{% endif %}

{% set restrictions = mollie_applepaydirect_restrictions | merge(mollie_paypalexpress_restrictions) %}

{# requirement check for apple pay direct #}
{% if mollie_applepaydirect_enabled == true or mollie_applepay_enabled == true or mollie_paypalexpress_enabled == true %}

{% if currentRoute in onlyShowHere|keys and (onlyShowHere[currentRoute] not in mollie_applepaydirect_restrictions or onlyShowHere[currentRoute] not in mollie_paypalexpress_restrictions) %}
{% if currentRoute in onlyShowHere|keys and onlyShowHere[currentRoute] not in restrictions %}
{% set includeJsInHeader = true %}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% sw_extends '@Storefront/storefront/component/buy-widget/buy-widget-form.html.twig' %}

{% block buy_widget_buy_button %}
{% block buy_widget_buy_container %}

{% if mollie_subscriptions_enabled and product.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 }}">
Expand Down Expand Up @@ -35,14 +35,35 @@
{% endblock %}
{% endif %}


{% endblock %}

{% endblock %}

{% block buy_widget_buy_form_inner %}
{{ parent() }}

{% block page_product_detail_buy_container_paypal_express %}
{% if mollie_paypalexpress_enabled and ('pdp' not in mollie_paypalexpress_restrictions) %}
{% block page_product_detail_buy_container_mollie_paypal_express_component %}
<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>
{% set product = page.product %}
<form id="molliePayPalExpressProductDetailForm" action="{{ path('frontend.mollie.paypal-express.start') }}"
data-form-csrf-handler="true"
method="POST">
{% if mollie_csrf_available %}
{% include '@MolliePayments/storefront/csrf/components/paypal-express-button-csrf.twig' %}
{% endif %}
<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>
{% endblock %}
{% endif %}

{% endblock %}

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

{% block page_product_detail_buy_form_inner %}
{{ parent() }}

{% block page_product_detail_buy_container_paypal_express %}
{% if mollie_paypalexpress_enabled and ('pdp' not in mollie_paypalexpress_restrictions) %}
{% block page_product_detail_buy_container_mollie_paypal_express_component %}
Expand All @@ -49,8 +48,7 @@
{% if mollie_csrf_available %}
{% include '@MolliePayments/storefront/csrf/components/paypal-express-button-csrf.twig' %}
{% endif %}

<input type="hidden" name="productId" value="{{ product.id }}">
<input type="hidden" name="productId" value="{{ product.id }}" />
<input
type="hidden"
name="quantity"
Expand Down

0 comments on commit 77f655a

Please sign in to comment.