0

I've been struggling for days finding for the right answers .

I want to achieve a function that when a user fill up the billing / delivery information , the " click to calculate " button will be auto click so that the shipping options will appear in checkout page . I am using Drupal 7 but I got this code somewhere .

Any thoughts on this ?

I make a mymodule.module file that goes like this :

<?php

function mymodule_form_alter(&$form, &$form_state, $form_id){
if ($form_id == 'uc_cart_checkout_form'){

drupal_add_js(drupal_get_path('module', 'mymodule') . '/mymodule.js');

}
}

With mymodule.info like this :

name = Re-calculate Shipping
description = Use JavaScript to automatically click the Calculate Shipping button at checkout.
core = 6.x
dependencies[] = uc_quote
package = "Example.com custom modules"

And mymodule.js like this

$(document).ready(function(){
$("#edit-panes-quotes-quote-button").click();
$("#edit-panes-delivery-copy-address").click();
});

$(document).ready(function(){
$("#edit-panes-billing-billing-zone").change(function() {
$("#edit-panes-quotes-quote-button").click();
});
});

$(document).ready(function(){
$("#edit-panes-delivery-delivery-zone").change(function() {
$("#edit-panes-quotes-quote-button").click();
});
});

Will this work on drupal 7 ?

Need help please . Thanks

Your Answer

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

Browse other questions tagged or ask your own question.