@@ -67,6 +67,7 @@ require(["prototype"], function(){
67
67
upsXml.prototype = {
68
68
initialize: function()
69
69
{
70
+ this.carriersUpsActiveId = 'carriers_ups_active';
70
71
this.carriersUpsTypeId = 'carriers_ups_type';
71
72
if (!$(this.carriersUpsTypeId)) {
72
73
return;
@@ -94,6 +95,7 @@ require(["prototype"], function(){
94
95
95
96
this.setFormValues();
96
97
Event.observe($(this.carriersUpsTypeId), 'change', this.setFormValues.bind(this));
98
+ Event.observe($(this.carriersUpsActiveId), 'change', this.setFormValues.bind(this));
97
99
},
98
100
updateAllowedMethods: function(originShipmentTitle)
99
101
{
@@ -121,7 +123,7 @@ require(["prototype"], function(){
121
123
freeMethod.insert(option);
122
124
123
125
option = new Element('option', {value:code}).update(originShipment[code]);
124
- if (this.storedUpsType == 'UPS_XML ') {
126
+ if (this.storedUpsType == 'UPS ') {
125
127
if (originShipmentTitle != 'default' || inArray(this.storedAllowedMethods, code)) {
126
128
option.selected = true;
127
129
}
@@ -143,7 +145,7 @@ require(["prototype"], function(){
143
145
setFormValues: function()
144
146
{
145
147
var a;
146
- if ($F(this.carriersUpsTypeId) == 'UPS_XML ') {
148
+ if ($F(this.carriersUpsTypeId) == 'UPS ') {
147
149
for (a = 0; a < this.checkingUpsXmlId.length; a++) {
148
150
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');
149
151
}
@@ -156,7 +158,15 @@ require(["prototype"], function(){
156
158
this.changeOriginShipment(null, 'default');
157
159
} else {
158
160
for (a = 0; a < this.checkingUpsXmlId.length; a++) {
159
- $(this.checkingUpsXmlId[a]).addClassName('required-entry');
161
+ if ($F(this.carriersUpsActiveId) === '1') {
162
+ $(this.checkingUpsXmlId[a]).addClassName('required-entry').disabled = false;
163
+ } else {
164
+ $(this.checkingUpsXmlId[a]).removeClassName('required-entry').disabled = true;
165
+ if ($(this.checkingUpsXmlId[a]).next() !== undefined) {
166
+ $(this.checkingUpsXmlId[a]).removeClassName('mage-error').next().remove();
167
+ $(this.checkingUpsXmlId[a]).removeAttribute('style');
168
+ }
169
+ }
160
170
}
161
171
for (a = 0; a < this.checkingUpsId.length; a++) {
162
172
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');
0 commit comments