• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Shipping Perishable Goods and UPS Prefixes

New Here ,
Feb 11, 2014 Feb 11, 2014

Copy link to clipboard

Copied

I could really use the insight on figuring out this shipping issue. If someone could please point me in the right direction to tie all of this together it would be great. I’m working with a client who ships perishable goods and all items have to arrive within 3 business days of shipping using UPS. To do this I created a web app called Zip Code Ranges with a field called Zip Prefix, which is a list of UPS’s 3 digit zip code prefixes from their shipping department {module_webapps,24209,a}. I would like to slice the number prefix from the #shippingPostcode input field, compare them and if it matches a prefix from the ranges web app then remove UPS Ground from the #ShippingOptions drop down list.  I’ve tried to tinker with this to the point of confusing myself since I’m not great at jQuery anyway. Thanks in advance.

TOPICS
How to

Views

480

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2014 Feb 12, 2014

Copy link to clipboard

Copied

LATEST

Here is what I have put together so far, I had it working on occasion when you first enter information for the shipping, but doesn't work if you go back an enter a different zipcode. I then added $('#shippingCalc option[value=53334]').remove(); and it won't work at all. I'm not sure if it's me or a conflict with BC. Any Liams or Marios out there for some help, I'm really not good with this stuff, but love to learn.

http://thefatbeeman.ajsfullhouse.com/kits/queen-bee-kit

<script>

var prefixes = [161, 164, 165, 260, 261, 400, 401, 402, 406, 410, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 520, 521, 522, 523, 524, 526, 527, 528, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 541, 542, 543, 544, 545, 546, 547, 549, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 624, 625, 626, 627];

$(document).ready(function(){

          $("#shippingPostcode").focus(function() {

                    window.addEventListener('keyup', checkZip);

            });

});

function checkZip() {

          var zipCode = $("#shippingPostcode").val();

    if (zipCode.length == 5) {

                    prefix = $("#shippingPostcode").val().substring(0,3);

        zipInList = false;

                    for (var i = 0; i < prefixes.length; i++) {

                    if (prefix == prefixes) {

                      zipInList = true;

                      break;

                    }

        }

        if (zipInList) {

                    zipCodeOkay(zipCode);

        } else {

                    zipCodeNotOkay(zipCode);

        }

          }

}

function zipCodeOkay(zipCode) {

          $("#shippingPostcode").blur()

          removeEventListener('keyup', checkZip);

}

function zipCodeNotOkay(zipCode) {

          $("#shippingPostcode").blur()

          removeEventListener('keyup', checkZip);

          $('#ShippingOptions option[value=53334]').remove();

          $('#shippingCalc option[value=53334]').remove();

          alert('Zip code ' + zipCode + ' requires expedited (2 or 3 day) shipping.');

}

</script>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines