Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of MAGETWO-69379 for Magento 2.1: use payment method name to… #13543

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ define(
agreementsModal.showModal();
},

/**
* build a unique id for the term checkbox
*
* @param {Object} context - the ko context
* @param {Number} agreementId
*/
getCheckboxId: function (context, agreementId) {
var paymentMethodName = '',
paymentMethodRenderer = context.$parents[1];

// corresponding payment method fetched from parent context
if (paymentMethodRenderer) {
// item looks like this: {title: "Check / Money order", method: "checkmo"}
paymentMethodName = paymentMethodRenderer.item ?
paymentMethodRenderer.item.method : '';
}

return 'agreement_' + paymentMethodName + '_' + agreementId;
},

/**
* Init modal window for rendered element
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<div class="checkout-agreement required">
<input type="checkbox" class="required-entry"
data-bind="attr: {
'id': 'agreement_' + agreementId,
'id': $parent.getCheckboxId($parentContext, agreementId),
'name': 'agreement[' + agreementId + ']',
'value': agreementId
}"/>
<label data-bind="attr: {'for': 'agreement_' + agreementId}">
<label data-bind="attr: {'for': $parent.getCheckboxId($parentContext, agreementId)}">
<button type="button"
class="action action-show"
data-bind="click: function(data, event) { return $parent.showContent(data, event) }"
Expand Down