0

please visit here

click on "Buy Now" button, than you will see "Check" button in cart page.

once you enter the zip code " 560043" and enter "check" button, than you can see its calculating shipping charges

some Jquery code is the reason for this, but i want to know what jquery is there behind this feature

enter image description here

2

The following jquery applying on clicking on check

//<![CDATA[
    var coShippingMethodForm = new VarienForm('shipping-zip-form');
    var countriesWithOptionalZip = ["IN"];

    function getshippingcost()
    {
        //alert(document.getElementById('postcode1').value);
        document.getElementById('postcode').value=document.getElementById('postcode1').value;
        var country = $F('country');
        var optionalZip = false;

        for (i=0; i < countriesWithOptionalZip.length; i++) {
            if (countriesWithOptionalZip[i] == country) {
                optionalZip = true;
            }
        }
        if (optionalZip) {
            $('postcode').removeClassName('required-entry');
        }
        else {
            $('postcode').addClassName('required-entry');
        }
        return VarienForm.prototype.submit.bind(coShippingMethodForm)();
    }   

//]]>   

Hope this helps

3
  • how you found that ? where is the option through inspect element to find this ? – Baby in Magento Mar 15 '16 at 6:36
  • There is function onClick on getshippingcost(). So i just found this function in page source. That's it – Rohit Kundale Mar 15 '16 at 6:38
  • okay in "view page source" , thats great , thanks. – Baby in Magento Mar 15 '16 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.