Skip to content

Commit 418f4e8

Browse files
authored
Merge pull request #450 from OXID-eSales/PSPAYPAL920_ButtonConditions_
Condition for Button-JS-Integration
2 parents 898dc97 + 64ac5ef commit 418f4e8

4 files changed

Lines changed: 31 additions & 37 deletions

File tree

views/blocks/layout/base_js.tpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
[{$smarty.block.parent}]
22
[{include file='modules/osc/paypal/base_js.tpl'}]
3-
[{if method_exists($oView, 'getPayment') && $oView->isPayPalCheckoutPayment()}]
4-
[{include file='modules/osc/paypal/base_paypal_payment_controller_config.tpl'}]
5-
[{include file='modules/osc/paypal/base_paypal_button_config.tpl'}]
6-
[{/if}]
3+
[{include file='modules/osc/paypal/base_paypal_payment_controller_config.tpl'}]
4+
[{include file='modules/osc/paypal/base_paypal_button_config.tpl'}]

views/tpl/shared/layout/base_paypal_button_config.tpl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
[{assign var="config" value=$oViewConf->getPayPalCheckoutConfig()}]
2-
3-
[{if $oViewConf->isPayPalCheckoutActive()}]
1+
[{if $oViewConf->isPayPalCheckoutActive() && $oViewConf->isSDKNecessary()}]
2+
[{assign var="config" value=$oViewConf->getPayPalCheckoutConfig()}]
43
<script>
54
(function (){
65
const PayPalButtonStyleConfigurator = function(){
Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
1-
[{if isset($oView) && isset($oViewConf)}]
2-
[{if method_exists($oView, 'getPayment') && method_exists($oViewConf, 'getPayPalCheckoutConfig')}]
3-
[{assign var="payment" value=$oView->getPayment()}]
4-
[{assign var="paymentId" value=$payment->getId()}]
5-
[{assign var="sSelfLink" value=$oViewConf->getSslSelfLink()|replace:"&amp;":"&"}]
6-
[{assign var="purchaseUnits" value=$oView->getPurchaseUnits()}]
7-
[{assign var="oPPconfig" value=$oViewConf->getPayPalCheckoutConfig()}]
8-
[{assign var="isSandBox" value=$oPPconfig->isSandbox()}]
9-
[{assign var="captureStrategy" value=$oPPconfig->getPayPalStandardCaptureStrategy()}]
1+
[{if method_exists($oView, 'isPayPalCheckoutPayment') && $oView->isPayPalCheckoutPayment()}]
2+
[{assign var="payment" value=$oView->getPayment()}]
3+
[{assign var="paymentId" value=$payment->getId()}]
4+
[{assign var="sSelfLink" value=$oViewConf->getSslSelfLink()|replace:"&amp;":"&"}]
5+
[{assign var="purchaseUnits" value=$oView->getPurchaseUnits()}]
6+
[{assign var="oPPconfig" value=$oViewConf->getPayPalCheckoutConfig()}]
7+
[{assign var="isSandBox" value=$oPPconfig->isSandbox()}]
8+
[{assign var="captureStrategy" value=$oPPconfig->getPayPalStandardCaptureStrategy()}]
109

11-
<script>
12-
const PayPalPaymentControllerConfigurator = function () {
13-
return {
14-
shopOrderErrorUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=logError&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
15-
shopOrderCreationStatusUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=createShopOrder&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
16-
shopOrderPatchingStatusUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=patchShopOrder&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
17-
shopOrderDeleteUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=deleteShopOrder&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
18-
payPalOrderDetailsUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=fetchPayPalOrderDetails&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
19-
updateOxUserWithPayPalCustomerIdUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=updateOxUserWithPayPalCustomerId&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
20-
errorLogUrl: '[{$sSelfLink|cat:"cl=payment&payerror=2&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
21-
shopThankYouPageUrl: '[{$sSelfLink|cat:"cl=thankyou&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
22-
deliveryAddressId: '[{$oView->getDeliveryAddressMD5()}]',
23-
purchaseUnits: [{$purchaseUnits}],
24-
buttonSelector: '#[{$paymentId}]',
25-
captureStrategy: '[{if $captureStrategy == 'directly'}]CAPTURE[{else}]AUTHORIZE[{/if}]'
26-
}
27-
};
28-
</script>
29-
30-
[{/if}]
10+
<script>
11+
const PayPalPaymentControllerConfigurator = function () {
12+
return {
13+
shopOrderErrorUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=logError&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
14+
shopOrderCreationStatusUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=createShopOrder&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
15+
shopOrderPatchingStatusUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=patchShopOrder&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
16+
shopOrderDeleteUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=deleteShopOrder&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
17+
payPalOrderDetailsUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=fetchPayPalOrderDetails&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
18+
updateOxUserWithPayPalCustomerIdUrl: '[{$sSelfLink|cat:"cl=ajaxpay&fnc=updateOxUserWithPayPalCustomerId&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
19+
errorLogUrl: '[{$sSelfLink|cat:"cl=payment&payerror=2&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
20+
shopThankYouPageUrl: '[{$sSelfLink|cat:"cl=thankyou&aid="|cat:$aid|cat:"&stoken="|cat:$sToken}][{if $isSandBox}]&XDEBUG_SESSION=PHPSTORM[{/if}]',
21+
deliveryAddressId: '[{$oView->getDeliveryAddressMD5()}]',
22+
purchaseUnits: [{$purchaseUnits}],
23+
buttonSelector: '#[{$paymentId}]',
24+
captureStrategy: '[{if $captureStrategy == 'directly'}]CAPTURE[{else}]AUTHORIZE[{/if}]'
25+
}
26+
};
27+
</script>
3128
[{/if}]

views/tpl/shared/widget/minibasket/dd_layout_page_header_icon_menu_minibasket_functions.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[{if $oViewConf->showPayPalExpressInMiniBasket()}]
1+
[{if $oViewConf->showPayPalExpressInMiniBasket() && $oViewConf->getTopActiveClassName() neq "order" && $oViewConf->getTopActiveClassName() neq "payment"}]
22
[{include file="modules/osc/paypal/paymentbuttons.tpl" buttonId="PayPalPayButtonNextCart1" buttonClass="float-right pull-right paypal-button-wrapper small"}]
33
<div class="float-right pull-right paypal-button-or">
44
[{"OR"|oxmultilangassign|oxupper}]

0 commit comments

Comments
 (0)