This is an interim solution pending work on ubercart core at #1373236: Allow multiple modules to react on checkout Ajax events.
Attached patch requires the most recent patch on that thread, and the DEV branch of both ubercart and uc_coupons.
THIS PATCH WILL NOT BE COMMITTED. When the generalized solution outlined there is implemented, uc_coupon will use that as well.

CommentFileSizeAuthor
#1 1473062-update-shipping.patch1.74 KBwodenx

Comments

wodenx’s picture

StatusFileSize
new1.74 KB
velpan’s picture

Very useful patch wodenx. Can you, please, give us a similar patch for the 6.x.-1.x-dev?

wodenx’s picture

Ajax in D6 is a completely different animal. I'll backport if I have time or if someone wants to sponsor, but it's a nontrivial task.

Rafal Lukawiecki’s picture

I just tried applying this patch to current DEV branch of uc_coupon, but the patch does not seem to apply. The error I get is:

Checking patch uc_coupon.module...
error: while searching for:
if ($op == 'presave') {
// Apply any session coupons to the current cart order.
global $user;
if (isset($_SESSION['cart_order']) && $order->order_id == $_SESSION['cart_order']
&& uc_order_status_data($order->order_status, 'state') == 'in_checkout' && $user->uid == $order->uid) {
_uc_coupon_apply_to_order($order, uc_coupon_session_validate());
}
// Make sure any fake cart items don't get saved with the order if the checkout page is skipped

error: patch failed: uc_coupon.module:1276
error: uc_coupon.module: patch does not apply

Rafal Lukawiecki’s picture

Should I have used Alpha7 for this patch, by any chance? I am still very willing to test it. :)

wodenx’s picture

Status: Needs work » Needs review

Actually, I believe that in alphpa7, both the shipping pane and the payment pane are automatically updated whenever a coupon is applied -- no patch necessary. Please give it a try and report back if not the case.

Rafal Lukawiecki’s picture

Good news. I just tested without this patch, but with Alpha7 of uc_coupon and the two AJAX patches #1373236: Allow multiple modules to react on checkout Ajax events and #1518522: Update order_total when order saved on top of ubercart. I am happy to say, that at last, the payment methods, which in my case have a condition on the order balance, do react via AJAX as the coupons are applied. I will do a bit more testing and will put it into production.

Still, hoping the payment preview pane could update tax based on shipping country changes, via AJAX, but that is a matter for #34 in #1373236: Allow multiple modules to react on checkout Ajax events.

DanZ’s picture

#1373236: Allow multiple modules to react on checkout Ajax events has been committed and is in Ubercart 7.x-3.3. Is this still an issue?

kirkofalltrades’s picture

Issue summary: View changes

I am using this method wodenx suggested to create a free shipping coupon:
https://drupal.org/comment/4931346#comment-4931346

So, it is imperative that the Shipping Options refresh automatically after a coupon is applied to the order. As it stands, this is not happening for me. In order to see the new shipping option made available by the conditions on the 'Free Shipping' shipping method, I have to refresh the cart page. The other panes are updating correctly (such as the Payment Method pane) when other coupons are being applied that have nothing to do with shipping methods.

I am using the following versions of modules:

Ubercart 7.x-3.6
Discount Coupons 7.x-2.1-alpha7
Ajax Driven Cart 7.x-2.x-dev
Flat Rate 7.x-3.6

Would appreciate any help.

Thanks!
Kirk