-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuc_varprice.js
31 lines (28 loc) · 924 Bytes
/
uc_varprice.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @file
* Helper functions and behaviors for the UC Variable Price product feature.
*/
/**
* Add the override checkbox behavior to the product feature form.
*/
Backdrop.behaviors.ucVarPriceOverride = function(context) {
$('.override-checkbox:not(.ucVarPriceOverride-processed)', context).addClass('ucVarPriceOverride-processed').each(
function() {
// If the override box is not checked, hide the associated form field.
if (this.checked == false) {
$('#edit-' + this.id.substr(14) + '-wrapper').hide();
}
// Add an onchange function to show the associated field when required.
$(this).change(
function() {
if (this.checked == true) {
$('#edit-' + this.id.substr(14) + '-wrapper').show('fast');
}
else {
$('#edit-' + this.id.substr(14) + '-wrapper').hide('fast');
}
}
);
}
);
}