Skip to content

Commit 0913cd2

Browse files
committed
MC-33420: PayPal button disappears when enable Customize Button
1 parent 9378142 commit 0913cd2

File tree

2 files changed

+28
-48
lines changed

2 files changed

+28
-48
lines changed

app/code/Magento/Paypal/Setup/Patch/Data/UpdateSmartButtonLabel.php

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@
1616
*/
1717
class UpdateSmartButtonLabel implements DataPatchInterface, PatchVersionInterface
1818
{
19-
/**
20-
* @var array
21-
*/
22-
private $labelSettingsToUpdate = [
23-
'paypal/style/checkout_page_button_label',
24-
'paypal/style/cart_page_button_label',
25-
'paypal/style/mini_cart_page_button_label',
26-
'paypal/style/product_page_button_label',
27-
];
28-
2919
/**
3020
* @var ModuleDataSetupInterface
3121
*/
@@ -47,26 +37,26 @@ public function __construct(
4737
public function apply()
4838
{
4939
$this->moduleDataSetup->getConnection()->startSetup();
50-
$connection = $this->moduleDataSetup->getConnection();
51-
52-
$select = $connection->select()
53-
->from($this->moduleDataSetup->getTable('core_config_data'), ['path','scope', 'scope_id', 'value'])
54-
->where('path IN (?)', $this->labelSettingsToUpdate)
55-
->where('value = ?', 'credit');
56-
57-
foreach ($connection->fetchAll($select) as $pair) {
58-
$value = $pair['path'] === 'paypal/style/product_page_button_label' ? 'buynow' : 'paypal';
59-
$this->moduleDataSetup->getConnection()
60-
->insertOnDuplicate(
61-
$this->moduleDataSetup->getTable('core_config_data'),
62-
[
63-
'scope' => $pair['scope'],
64-
'scope_id' => $pair['scope_id'],
65-
'path' => $pair['path'],
66-
'value' => $value
67-
]
68-
);
69-
}
40+
$this->moduleDataSetup->getConnection()->update(
41+
$this->moduleDataSetup->getTable('core_config_data'),
42+
['value' => 'paypal'],
43+
[
44+
'path IN (?)' => [
45+
'paypal/style/checkout_page_button_label',
46+
'paypal/style/cart_page_button_label',
47+
'paypal/style/mini_cart_page_button_label'
48+
],
49+
'value = ? ' => 'credit'
50+
]
51+
);
52+
$this->moduleDataSetup->getConnection()->update(
53+
$this->moduleDataSetup->getTable('core_config_data'),
54+
['value' => 'buynow'],
55+
[
56+
'path IN (?)' => ['paypal/style/product_page_button_label'],
57+
'value = ? ' => 'credit'
58+
]
59+
);
7060
return $this->moduleDataSetup->getConnection()->endSetup();
7161
}
7262

app/code/Magento/Paypal/Setup/Patch/Data/UpdateSmartButtonSize.php

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,14 @@ public function __construct(
4747
public function apply()
4848
{
4949
$this->moduleDataSetup->getConnection()->startSetup();
50-
$connection = $this->moduleDataSetup->getConnection();
51-
52-
$select = $connection->select()
53-
->from($this->moduleDataSetup->getTable('core_config_data'), ['path','scope', 'scope_id', 'value'])
54-
->where('path IN (?)', $this->sizeSettingsToUpdate)
55-
->where('value = \'large\' OR value=\'medium\'');
56-
foreach ($connection->fetchAll($select) as $pair) {
57-
$this->moduleDataSetup->getConnection()
58-
->insertOnDuplicate(
59-
$this->moduleDataSetup->getTable('core_config_data'),
60-
[
61-
'scope' => $pair['scope'],
62-
'scope_id' => $pair['scope_id'],
63-
'path' => $pair['path'],
64-
'value' => 'responsive'
65-
]
66-
);
67-
}
50+
$this->moduleDataSetup->getConnection()->update(
51+
$this->moduleDataSetup->getTable('core_config_data'),
52+
['value' => 'responsive'],
53+
[
54+
'path IN (?)' => $this->sizeSettingsToUpdate,
55+
'value NOT IN (?) ' => ['responsive']
56+
]
57+
);
6858
return $this->moduleDataSetup->getConnection()->endSetup();
6959
}
7060

0 commit comments

Comments
 (0)