Skip to content

Commit 045afe0

Browse files
authored
Merge pull request #439 from OXID-eSales/PSPAYPAL-918_Button_configuration
Pspaypal 918 button configuration
2 parents 610d293 + f6342fd commit 045afe0

9 files changed

Lines changed: 236 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [2.6.0] - 2025-??-??
8+
9+
### NEW
10+
11+
- PayPal-Buttons are configurable
712

813
## [2.5.3] - 2025-04-04
914

metadata.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
'en' => 'Use of the online payment service from PayPal. Documentation: <a href="https://docs.oxid-esales.com/modules/paypal-checkout/en/latest/" target="_blank">PayPal Checkout</a>'
6262
],
6363
'thumbnail' => 'out/img/paypal.png',
64-
'version' => '2.5.3',
64+
'version' => '2.6.0-rc.1',
6565
'author' => 'OXID eSales AG',
6666
'url' => 'https://www.oxid-esales.com',
6767
'email' => 'info@oxid-esales.com',
@@ -572,5 +572,33 @@
572572
'value' => false,
573573
'group' => null
574574
],
575+
[
576+
'name' => 'oscPayPalButtonStyleLayout',
577+
'type' => 'select',
578+
'constraints' => 'vertical|horizontal',
579+
'value' => 'vertical',
580+
'group' => null
581+
],
582+
[
583+
'name' => 'oscPayPalButtonStyleColor',
584+
'type' => 'select',
585+
'constraints' => 'gold|blue|silver|white|black',
586+
'value' => 'gold',
587+
'group' => null
588+
],
589+
[
590+
'name' => 'oscPayPalButtonStyleShape',
591+
'type' => 'select',
592+
'constraints' => 'rect|pill|sharp',
593+
'value' => 'rect',
594+
'group' => null
595+
],
596+
[
597+
'name' => 'oscPayPalButtonStyleLabel',
598+
'type' => 'select',
599+
'constraints' => 'paypal|checkout|buynow|pay|installment',
600+
'value' => 'paypal',
601+
'group' => null
602+
],
575603
],
576604
];

src/Core/Config.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,26 @@ public function getPayPalCheckoutBannerColorScheme(): string
318318
return $this->getServiceFromContainer(ModuleSettings::class)->getPayPalCheckoutBannerColorScheme();
319319
}
320320

321+
public function getPayPalButtonStyleLayout(): string
322+
{
323+
return $this->getServiceFromContainer(ModuleSettings::class)->getPayPalButtonStyleLayout();
324+
}
325+
326+
public function getPayPalButtonStyleColor(): string
327+
{
328+
return $this->getServiceFromContainer(ModuleSettings::class)->getPayPalButtonStyleColor();
329+
}
330+
331+
public function getPayPalButtonStyleShape(): string
332+
{
333+
return $this->getServiceFromContainer(ModuleSettings::class)->getPayPalButtonStyleShape();
334+
}
335+
336+
public function getPayPalButtonStyleLabel(): string
337+
{
338+
return $this->getServiceFromContainer(ModuleSettings::class)->getPayPalButtonStyleLabel();
339+
}
340+
321341
public function getPayPalStandardCaptureStrategy(): string
322342
{
323343
return $this->getServiceFromContainer(ModuleSettings::class)->getPayPalStandardCaptureStrategy();

src/Service/ModuleSettings.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,26 @@ public function getPayPalCheckoutBannersColorScheme(): string
341341
return (string)$this->getSettingValue('oscPayPalBannersColorScheme');
342342
}
343343

344+
public function getPayPalButtonStyleLayout(): string
345+
{
346+
return (string)$this->getSettingValue('oscPayPalButtonStyleLayout');
347+
}
348+
349+
public function getPayPalButtonStyleColor(): string
350+
{
351+
return (string)$this->getSettingValue('oscPayPalButtonStyleColor');
352+
}
353+
354+
public function getPayPalButtonStyleShape(): string
355+
{
356+
return (string)$this->getSettingValue('oscPayPalButtonStyleShape');
357+
}
358+
359+
public function getPayPalButtonStyleLabel(): string
360+
{
361+
return (string)$this->getSettingValue('oscPayPalButtonStyleLabel');
362+
}
363+
344364
public function loginWithPayPalEMail(): bool
345365
{
346366
return (bool)$this->getSettingValue('oscPayPalLoginWithPayPalEMail');

views/admin/de/admin_lang.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,30 @@
4545
'HELP_OSC_PAYPAL_BUTTON_PLACEMEMT' => 'Schalten Sie die Anzeige der PayPal-Schaltflächen um',
4646
'OSC_SHOW_PAYPAL_PAYLATER_BUTTON' => '"Später Bezahlen"-Button anzeigen?',
4747
'HELP_OSC_SHOW_PAYPAL_PAYLATER_BUTTON' => 'Neben den klassischen PayPal-Button gibt es ein "Später Bezahlen"-Button, der unter dem Standardbutton angezeigt werden kann. Ist der aktiviert, bekommt der Kunde direkt die Möglichkeit, die Ware später zu zahlen.',
48+
"OSC_PAYPAL_STYLE_BUTTON_TITLE" => "Anpassung der Schaltflächen",
49+
"OSC_PAYPAL_STYLE_BUTTON_LAYOUT" => "Layout",
50+
"OSC_PAYPAL_STYLE_BUTTON_LAYOUT_HORIZONTAL" => "Horizontal",
51+
"OSC_PAYPAL_STYLE_BUTTON_LAYOUT_VERTICAL" => "Vertikal",
52+
"OSC_PAYPAL_STYLE_BUTTON_LAYOUT_HELP" => "Festlegen, wie die Schaltflächen angezeigt werden, wenn mehrere Schaltflächen verfügbar sind",
53+
"OSC_PAYPAL_STYLE_BUTTON_COLOR" => "Farbe",
54+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_GOLD" => "Gold",
55+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_BLUE" => "Blau",
56+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_SILVER" => "Silber",
57+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_WHITE" => "Weiß",
58+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_BLACK" => "Schwarz",
59+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_HELP" => "",
60+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE" => "Form",
61+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE_RECT" => "Rechteckig",
62+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE_SHARP" => "Scharfkantig",
63+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE_PILL" => "Rund",
64+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE_HELP" => "",
65+
"OSC_PAYPAL_STYLE_BUTTON_LABEL" => "Etikett",
66+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_PAYPAL" => "Paypal",
67+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_CHECKOUT" => "Direkt zu PayPal",
68+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_BUYNOW" => "PayPal jetzt kaufen",
69+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_PAY" => "Mit PayPal zahlen",
70+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_INSTALLMENT" => "Installment",
71+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_HELP" => "",
4872

4973
'OSC_PAYPAL_EXPRESS_LOGIN_TITLE' => 'Login mit PayPal',
5074
'OSC_PAYPAL_LOGIN_WITH_PAYPAL_EMAIL' => 'Im Shop beim Kauf automatisch einloggen',

views/admin/en/admin_lang.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,30 @@
4545
'HELP_OSC_PAYPAL_BUTTON_PLACEMEMT' => 'Toggle the display of PayPal buttons',
4646
'OSC_SHOW_PAYPAL_PAYLATER_BUTTON' => 'Show "Pay later"-Button?',
4747
'HELP_OSC_SHOW_PAYPAL_PAYLATER_BUTTON' => 'In addition to the classic PayPal button, there is a "Pay later"-button that can be displayed below the standard button. If it is activated, the customer has the option of paying for the goods later.',
48+
"OSC_PAYPAL_STYLE_BUTTON_TITLE" => "Buttons Customization",
49+
"OSC_PAYPAL_STYLE_BUTTON_LAYOUT" => "Layout",
50+
"OSC_PAYPAL_STYLE_BUTTON_LAYOUT_HORIZONTAL" => "Horizontal",
51+
"OSC_PAYPAL_STYLE_BUTTON_LAYOUT_VERTICAL" => "Vertical",
52+
"OSC_PAYPAL_STYLE_BUTTON_LAYOUT_HELP" => "Determine how the buttons show up when multiple buttons are available",
53+
"OSC_PAYPAL_STYLE_BUTTON_COLOR" => "Color",
54+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_GOLD" => "Gold",
55+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_BLUE" => "Blue",
56+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_SILVER" => "Silver",
57+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_WHITE" => "White",
58+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_BLACK" => "Black",
59+
"OSC_PAYPAL_STYLE_BUTTON_COLOR_HELP" => "",
60+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE" => "Shape",
61+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE_RECT" => "Rect",
62+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE_SHARP" => "Sharp",
63+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE_PILL" => "Pill",
64+
"OSC_PAYPAL_STYLE_BUTTON_SHAPE_HELP" => "",
65+
"OSC_PAYPAL_STYLE_BUTTON_LABEL" => "Label",
66+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_PAYPAL" => "Paypal",
67+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_CHECKOUT" => "Checkout",
68+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_BUYNOW" => "Buy now",
69+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_PAY" => "Pay",
70+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_INSTALLMENT" => "Installment",
71+
"OSC_PAYPAL_STYLE_BUTTON_LABEL_HELP" => "",
4872

4973
'OSC_PAYPAL_EXPRESS_LOGIN_TITLE' => 'Login with PayPal',
5074
'OSC_PAYPAL_LOGIN_WITH_PAYPAL_EMAIL' => 'Automatically log in to shop during checkout',

views/admin/tpl/oscpaypalconfig.tpl

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,100 @@
231231
</div>
232232
</div>
233233

234+
<div class="card">
235+
<div class="card-header" id="heading10">
236+
<h4 class="collapsed" data-toggle="collapse" data-target="#collapse_button_style" aria-expanded="false" aria-controls="collapse_button_style">
237+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_TITLE"}]
238+
</h4>
239+
</div>
240+
241+
<div id="collapse_button_style" class="collapse" aria-labelledby="heading10" data-parent="#accordion">
242+
<div class="card-body">
243+
<div class="form-group">
244+
<label for="style-button-layout">[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LAYOUT"}]</label>
245+
<div class="controls">
246+
<select name="conf[oscPayPalButtonStyleLayout]" id="style-button-layout" class="form-control">
247+
<option value="horizontal" [{if $config->getPayPalButtonStyleLayout() == 'horizontal'}]selected[{/if}]>
248+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LAYOUT_HORIZONTAL"}]
249+
</option>
250+
<option value="vertical" [{if $config->getPayPalButtonStyleLayout() == 'vertical'}]selected[{/if}]>
251+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LAYOUT_VERTICAL"}]
252+
</option>
253+
</select>
254+
</div>
255+
<span class="help-block">[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LAYOUT_HELP"}]</span>
256+
</div>
257+
<div class="form-group">
258+
<label for="style-button-color">[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_COLOR"}]</label>
259+
<div class="controls">
260+
<select name="conf[oscPayPalButtonStyleColor]" id="style-button-color" class="form-control">
261+
<option value="gold" [{if $config->getPayPalButtonStyleColor() == 'gold'}]selected[{/if}]>
262+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_COLOR_GOLD"}]
263+
</option>
264+
<option value="blue" [{if $config->getPayPalButtonStyleColor() == 'blue'}]selected[{/if}]>
265+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_COLOR_BLUE"}]
266+
</option>
267+
<option value="silver" [{if $config->getPayPalButtonStyleColor() == 'silver'}]selected[{/if}]>
268+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_COLOR_SILVER"}]
269+
</option>
270+
<option value="white" [{if $config->getPayPalButtonStyleColor() == 'white'}]selected[{/if}]>
271+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_COLOR_WHITE"}]
272+
</option>
273+
<option value="black" [{if $config->getPayPalButtonStyleColor() == 'black'}]selected[{/if}]>
274+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_COLOR_BLACK"}]
275+
</option>
276+
</select>
277+
</div>
278+
<span class="help-block">[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_COLOR_HELP"}]</span>
279+
</div>
280+
<div class="form-group">
281+
<label for="style-button-shape">[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_SHAPE"}]</label>
282+
<div class="controls">
283+
<select name="conf[oscPayPalButtonStyleShape]" id="style-button-shape" class="form-control">
284+
<option value="rect" [{if $config->getPayPalButtonStyleShape() == 'rect'}]selected[{/if}]>
285+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_SHAPE_RECT"}]
286+
</option>
287+
<option value="sharp" [{if $config->getPayPalButtonStyleShape() == 'sharp'}]selected[{/if}]>
288+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_SHAPE_SHARP"}]
289+
</option>
290+
<option value="pill" [{if $config->getPayPalButtonStyleShape() == 'pill'}]selected[{/if}]>
291+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_SHAPE_PILL"}]
292+
</option>
293+
</select>
294+
</div>
295+
<span class="help-block">[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_SHAPE_HELP"}]</span>
296+
</div>
297+
<div class="form-group">
298+
<label for="style-button-label">[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LABEL"}]</label>
299+
<div class="controls">
300+
<select name="conf[oscPayPalButtonStyleLabel]" id="style-button-label" class="form-control">
301+
<option value="paypal" [{if $config->getPayPalButtonStyleLabel() == 'paypal'}]selected[{/if}]>
302+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LABEL_PAYPAL"}]
303+
</option>
304+
<option value="checkout" [{if $config->getPayPalButtonStyleLabel() == 'checkout'}]selected[{/if}]>
305+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LABEL_CHECKOUT"}]
306+
</option>
307+
<option value="buynow" [{if $config->getPayPalButtonStyleLabel() == 'buynow'}]selected[{/if}]>
308+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LABEL_BUYNOW"}]
309+
</option>
310+
<option value="pay" [{if $config->getPayPalButtonStyleLabel() == 'pay'}]selected[{/if}]>
311+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LABEL_PAY"}]
312+
</option>
313+
[{*
314+
<option value="installment" [{if $config->getPayPalButtonStyleLabel() == 'installment'}]selected[{/if}]>
315+
[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LABEL_INSTALLMENT"}]
316+
</option>
317+
*}]
318+
</select>
319+
320+
</div>
321+
<span class="help-block">[{oxmultilang ident="OSC_PAYPAL_STYLE_BUTTON_LABEL_HELP"}]</span>
322+
</div>
323+
</div>
324+
</div>
325+
</div>
326+
327+
234328
<div class="card">
235329
<div class="card-header" id="heading3">
236330
<h4 class="collapsed" data-toggle="collapse" data-target="#collapse3" aria-expanded="false" aria-controls="collapse3">

views/tpl/shared/page/account/account_vaulting_paypal.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[{assign var="config" value=$oViewConf->getPayPalCheckoutConfig()}]
12
[{capture append="oxidBlock_content"}]
23
[{assign var="template_title" value="OSC_PAYPAL_VAULTING_MENU"|oxmultilangassign}]
34

@@ -16,6 +17,12 @@
1617
<script>
1718
window.onload = function () {
1819
paypal.Buttons({
20+
style: {
21+
layout: '[{$config->getPayPalButtonStyleLayout()}]',
22+
color: '[{$config->getPayPalButtonStyleColor()}]',
23+
shape: '[{$config->getPayPalButtonStyleShape()}]',
24+
label: '[{$config->getPayPalButtonStyleLabel()}]'
25+
},
1926
createVaultSetupToken: async () => {
2027
const result = await fetch(
2128
"[{oxgetseourl ident=$oViewConf->getGenerateSetupTokenLink()}]",

views/tpl/shared/paymentbuttons.tpl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[{assign var="config" value=$oViewConf->getPayPalCheckoutConfig()}]
12
[{block name="oscpaypal_paymentbuttons"}]
23
[{oxhasrights ident="PAYWITHPAYPALEXPRESS"}]
34
[{$oViewConf->setSDKIsNecessary()}]
@@ -17,6 +18,12 @@
1718
FUNDING_SOURCES.forEach(function (fundingSource) {
1819
// Initialize the buttons
1920
let button = paypal.Buttons({
21+
style: {
22+
layout: '[{$config->getPayPalButtonStyleLayout()}]',
23+
color: '[{$config->getPayPalButtonStyleColor()}]',
24+
shape: '[{$config->getPayPalButtonStyleShape()}]',
25+
label: '[{$config->getPayPalButtonStyleLabel()}]'
26+
},
2027
fundingSource: fundingSource,
2128
createOrder: function (data, actions) {
2229
return fetch('[{$sSelfLink|cat:"cl=oscpaypalproxy&fnc=createOrder&paymentid="|cat:$buttonId|cat:"&context=continue&stoken="|cat:$sToken}]', {
@@ -80,6 +87,12 @@
8087
});
8188
[{else}]
8289
button = paypal.Buttons({
90+
style: {
91+
layout: '[{$config->getPayPalButtonStyleLayout()}]',
92+
color: '[{$config->getPayPalButtonStyleColor()}]',
93+
shape: '[{$config->getPayPalButtonStyleShape()}]',
94+
label: '[{$config->getPayPalButtonStyleLabel()}]'
95+
},
8396
[{if $oViewConf->getCountryRestrictionForPayPalExpress()}]
8497
onShippingChange: function (data, actions) {
8598
if (!countryRestriction.includes(data.shipping_address.country_code)) {

0 commit comments

Comments
 (0)