File tree Expand file tree Collapse file tree 8 files changed +14
-37
lines changed
Block/Express/InContext/Minicart
templates/express/in-context/shortcut
blank/Magento_Paypal/web/css/source/module
luma/Magento_Paypal/web/css/source/module
dev/tests/functional/tests/app/Magento
Catalog/Test/Block/Product Expand file tree Collapse file tree 8 files changed +14
-37
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class Button extends Template implements ShortcutInterface
26
26
27
27
const BUTTON_ELEMENT_INDEX = 'button_id ' ;
28
28
29
- const BUTTON_ELEMENT_CLASS_NAME = 'button_class ' ;
29
+ const LINK_DATA_ACTION = 'link_data_action ' ;
30
30
31
31
const CART_BUTTON_ELEMENT_INDEX = 'add_to_cart_selector ' ;
32
32
@@ -137,9 +137,9 @@ public function getContainerId()
137
137
/**
138
138
* @return string
139
139
*/
140
- public function getButtonClassName ()
140
+ public function getLinkAction ()
141
141
{
142
- return $ this ->getData (self ::BUTTON_ELEMENT_CLASS_NAME );
142
+ return $ this ->getData (self ::LINK_DATA_ACTION );
143
143
}
144
144
145
145
/**
Original file line number Diff line number Diff line change 92
92
<item name =" template" xsi : type =" string" >Magento_Paypal::express/in-context/shortcut/button.phtml</item >
93
93
<item name =" alias" xsi : type =" string" >paypal.express-in-context.mini-cart</item >
94
94
<item name =" button_id" xsi : type =" string" >paypal-express-in-context-mini-cart</item >
95
- <item name =" button_class " xsi : type =" string" >paypal-express -in-context-checkout</item >
95
+ <item name =" link_data_action " xsi : type =" string" >paypal-in-context-checkout</item >
96
96
</argument >
97
97
<argument name =" payment" xsi : type =" object" >Magento\Paypal\Model\Express</argument >
98
98
</arguments >
Original file line number Diff line number Diff line change @@ -11,19 +11,19 @@ use Magento\Paypal\Block\Express\InContext\Minicart\Button;
11
11
*/
12
12
$ config = [
13
13
'Magento_Paypal/js/in-context/button ' => [
14
- 'id ' => $ block ->getContainerId (),
15
- 'paypalButtonClass ' => $ block ->getButtonClassName ( ),
16
- 'paypalButton ' => Button::PAYPAL_BUTTON_ID ,
17
- 'addToCartSelector ' => $ block ->getAddToCartSelector ()
14
+ 'id ' => $ block ->escapeHtml ( $ block -> getContainerId () ),
15
+ 'linkDataAction ' => $ block ->escapeHtml ( $ block -> getLinkAction () ),
16
+ 'paypalButton ' => $ block -> escapeHtml ( Button::PAYPAL_BUTTON_ID ) ,
17
+ 'addToCartSelector ' => $ block ->escapeHtml ( $ block -> getAddToCartSelector () )
18
18
]
19
19
];
20
20
21
21
?>
22
22
<div data-mage-init='<?php /* @noEscape */ echo json_encode ($ config ); ?> '
23
- class="paypal checkout paypal-logo <?php /* @noEscape */ echo $ block ->getContainerId (); ?> -container">
24
- <a class ="<?php /* @noEscape */ echo $ block ->getButtonClassName ( ); ?> " href="#">
23
+ class="paypal checkout paypal-logo <?php echo $ block ->escapeHtml ( $ block -> getContainerId () ); ?> -container">
24
+ <a data-action ="<?php echo $ block ->escapeHtml ( $ block -> getLinkAction () ); ?> " href="#">
25
25
<img class="paypal-button-hidden"
26
- src="<?php /* @noEscape */ echo $ block ->getImageUrl () ?> "
26
+ src="<?php echo $ block ->escapeHtml ( $ block -> getImageUrl ()); ?> "
27
27
alt="Check out with PayPal" />
28
28
</a>
29
29
</div>
Original file line number Diff line number Diff line change 5
5
define (
6
6
[
7
7
'uiComponent' ,
8
- 'Magento_Checkout/js/model/quote' ,
9
8
'jquery' ,
10
9
'domReady!'
11
10
] ,
12
11
function (
13
12
Component ,
14
- quote ,
15
13
$
16
14
) {
17
15
return Component . extend ( {
@@ -31,25 +29,12 @@ define(
31
29
* @returns {Object }
32
30
*/
33
31
initEvents : function ( ) {
34
-
35
- $ ( '.' + this . paypalButtonClass ) . off ( 'click.' + this . id )
32
+ $ ( 'a[data-action="' + this . linkDataAction + '"]' ) . off ( 'click.' + this . id )
36
33
. on ( 'click.' + this . id , this . click . bind ( this ) ) ;
37
34
38
- quote . totals . subscribe ( function ( newValue ) {
39
- // TODO: check for value
40
- this . showLink ( ) ;
41
- } , this ) ;
42
-
43
35
return this ;
44
36
} ,
45
37
46
- /**
47
- * Display PayPal in-context checkout link
48
- */
49
- showLink : function ( ) {
50
- $ ( '.' + this . paypalButtonClass ) . show ( ) ;
51
- } ,
52
-
53
38
/**
54
39
* @param {Object } event
55
40
* @returns void
Original file line number Diff line number Diff line change 53
53
& :extend(.abs-action-button-as-link all );
54
54
}
55
55
}
56
-
57
- .paypal-express-in-context-checkout {
58
- display : none ;
59
- }
60
56
}
Original file line number Diff line number Diff line change 49
49
& :extend(.abs-action-button-as-link all );
50
50
}
51
51
}
52
-
53
- .paypal-express-in-context-checkout {
54
- display : none ;
55
- }
56
52
}
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ class View extends AbstractConfigureBlock
68
68
*
69
69
* @var string
70
70
*/
71
- protected $ inContextPaypalCheckout = '#paypal-express- in-context-mini-cart ' ;
71
+ protected $ inContextPaypalCheckout = 'ul.checkout-methods-items a[data-action="paypal- in-context-checkout"] ' ;
72
72
73
73
/**
74
74
* Product name element.
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ class Cart extends Block
62
62
*
63
63
* @var string
64
64
*/
65
- protected $ inContextPaypalCheckoutButton = 'ul.checkout-methods-items a. paypal-express-in-context-checkout ' ;
65
+ protected $ inContextPaypalCheckoutButton = 'ul.checkout-methods-items a[data-action=" paypal-express-in-context-checkout"] ' ;
66
66
67
67
/**
68
68
* Locator value for "Check out with Braintree PayPal" button.
You can’t perform that action at this time.
0 commit comments