Subversion Repositories SmartDukaan

Rev

Rev 10773 | Rev 10835 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10773 Rev 10786
Line 163... Line 163...
163
          document.getElementById(addressId).style.display = 'none';
163
          document.getElementById(addressId).style.display = 'none';
164
        }
164
        }
165
  });
165
  });
166
  e.stopPropagation();
166
  e.stopPropagation();
167
}
167
}
168
 
-
 
169
function changeAddress(addressId,type){
168
function changeAddress(addressId,type){
170
  debugger;
169
  debugger;
171
  if(defaultAddress != addressId){
170
  if(defaultAddress != addressId){
172
    var url = base_url+'checkout/changeAddress/'+addressId+'/'+type;
171
    var url = base_url+'checkout/changeAddress/'+addressId+'/'+type;
173
    microAjax(url, function (res) {
172
    microAjax(url, function (res) {
174
        debugger;
173
        debugger;
175
        if(res == ''){
174
        if(res != ''){
-
 
175
          var data = JSON.parse(res);
-
 
176
          if(data.locationServiceable == false){
-
 
177
            document.getElementById('error').style.display = "block";
-
 
178
            document.getElementById('error').innerHTML = data.locationServiceableMessage;
-
 
179
            locationServiceable = data.locationServiceable;
-
 
180
            document.getElementById(defaultAddress).className = 'deliver-address';
-
 
181
            document.getElementById(addressId).className += ' selected-add';
-
 
182
            defaultAddress = addressId;
-
 
183
          }else{
-
 
184
            if(document.getElementById('error').style.display == "block"){
-
 
185
              document.getElementById('error').style.display = "none";
-
 
186
            }
176
          document.getElementById(defaultAddress).className = 'deliver-address';
187
            document.getElementById(defaultAddress).className = 'deliver-address';
177
          document.getElementById(addressId).className += ' selected-add';
188
            document.getElementById(addressId).className += ' selected-add';
178
          defaultAddress = addressId;
189
            defaultAddress = addressId;
-
 
190
            locationServiceable = true;
-
 
191
          }
179
        }
192
        }
180
        else{
193
        else{
181
          return false;
194
          return false;
182
        }
195
        }
183
    });
196
    });
Line 490... Line 503...
490
    }
503
    }
491
  }else{
504
  }else{
492
      ga('send','event','Delivery Type','Deliver to address');
505
      ga('send','event','Delivery Type','Deliver to address');
493
    }
506
    }
494
    ga('send','event','Order','Proceed To Pay');
507
    ga('send','event','Order','Proceed To Pay');
-
 
508
    if(locationServiceable == false){
-
 
509
      document.getElementById('error').style.display = "block";
-
 
510
      document.getElementById('error').innerHTML ='Location not serviceable. Please specify a different address';
-
 
511
      return false;
-
 
512
    }
495
    window.location.href = base_url+'payment';
513
    window.location.href = base_url+'payment';
496
  }
514
  }
497
}else{
515
}else{
498
  if(pickupStore == true){
516
  if(pickupStore == true){
499
    if(inStoreDelivery == true){
517
    if(inStoreDelivery == true){
Line 505... Line 523...
505
    }
523
    }
506
  }else{
524
  }else{
507
      ga('send','event','Delivery Type','Deliver to address');
525
      ga('send','event','Delivery Type','Deliver to address');
508
    }
526
    }
509
    ga('send','event','Order','Proceed To Pay');
527
    ga('send','event','Order','Proceed To Pay');
-
 
528
    if(locationServiceable == false){
-
 
529
      document.getElementById('error').style.display = "block";
-
 
530
      document.getElementById('error').innerHTML ='Location not serviceable. Please specify a different address';
-
 
531
      return false;
-
 
532
    }
510
    window.location.href = base_url+'payment';
533
    window.location.href = base_url+'payment';
511
}
534
}
512
}
535
}
513
function paymentValidation(e){
536
function paymentValidation(e){
514
  debugger;
537
  debugger;