File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
app/code/Magento/CheckoutAgreements/view/frontend/web Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,26 @@ define(
45
45
agreementsModal . showModal ( ) ;
46
46
} ,
47
47
48
+ /**
49
+ * build a unique id for the term checkbox
50
+ *
51
+ * @param {Object } context - the ko context
52
+ * @param {Number } agreementId
53
+ */
54
+ getCheckboxId : function ( context , agreementId ) {
55
+ var paymentMethodName = '' ,
56
+ paymentMethodRenderer = context . $parents [ 1 ] ;
57
+
58
+ // corresponding payment method fetched from parent context
59
+ if ( paymentMethodRenderer ) {
60
+ // item looks like this: {title: "Check / Money order", method: "checkmo"}
61
+ paymentMethodName = paymentMethodRenderer . item ?
62
+ paymentMethodRenderer . item . method : '' ;
63
+ }
64
+
65
+ return 'agreement_' + paymentMethodName + '_' + agreementId ;
66
+ } ,
67
+
48
68
/**
49
69
* Init modal window for rendered element
50
70
*
Original file line number Diff line number Diff line change 11
11
< div class ="checkout-agreement required ">
12
12
< input type ="checkbox " class ="required-entry "
13
13
data-bind ="attr: {
14
- 'id': 'agreement_' + agreementId,
14
+ 'id': $parent.getCheckboxId($parentContext, agreementId) ,
15
15
'name': 'agreement[' + agreementId + ']',
16
16
'value': agreementId
17
17
} "/>
18
- < label data-bind ="attr: {'for': 'agreement_' + agreementId} ">
18
+ < label data-bind ="attr: {'for': $parent.getCheckboxId($parentContext, agreementId) } ">
19
19
< button type ="button "
20
20
class ="action action-show "
21
21
data-bind ="click: function(data, event) { return $parent.showContent(data, event) } "
You can’t perform that action at this time.
0 commit comments