Advertisement
RiQ363

Untitled

Jul 23rd, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (1 || window.location.href.indexOf('key=showMeTheCheckoutMods') != -1) {
  2.  
  3. //predefined address, can be changed
  4.     processCheckoutShippingPage = function() {
  5.         fields = {
  6.             'address1':'address1',
  7.             'address2': 'address2',
  8.             'city': 'cityName',
  9.             'state': 'stateValue',
  10.             'country': 'countryCode',
  11.             'zip': '456910'
  12.         };
  13.     // fill in the fields above
  14.         for (var i in fields) {
  15.             jQuery('.ecwid-AddressForm-' + i)
  16.                 .closest('.ecwid-fieldWrapper').hide()
  17.                 .find('input,select').val(fields[i]);
  18.         }
  19.  
  20.     };
  21.  
  22. //change store ID to the corresponding one
  23.     jQuery(document).ready(function() {
  24.         jQuery('#ecwid-store-7093127').parent().addClass('ecwid-mod');
  25.         tickers = {};
  26.         Ecwid.OnPageLoaded.add(function(page) {
  27.             for (var i in tickers) {
  28.                 if (tickers[i]) {
  29.                     clearInterval(tickers[i]);
  30.                     tickers[i] = false;
  31.                 }
  32.             }
  33.         //case for each page type
  34.             switch(page.type) {
  35.                 case 'CHECKOUT_SHIPPING_ADDRESS':
  36.                     processCheckoutShippingPage();
  37.                     tickers[page.type] = setInterval(processCheckoutShippingPage, 500);
  38.                     break;
  39.                 case 'CHECKOUT_PAYMENT_DETAILS':
  40.                     processPaymentDetailsPage();
  41.                     tickers[page.type] = setInterval(processCheckoutShippingPage, 500);
  42.                     break;  
  43.             }
  44.         });
  45.            
  46.         processPaymentDetailsPage = function() {
  47.             jQuery('.ecwid-Checkout-EmailBlock input[name="email"]').val('test@example.com');
  48.                         //specify default email address
  49.         }
  50.  
  51.     });
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement