While reviewing an issue for Commerce USPS (http://drupal.org/node/1666102#comment-6241022), I've noticed that the rules and menu caches are not properly cleared when saving settings for both USPS and UPS modules. This causes rates to not be calculated until the rules cache was cleared. Also, the menu items on admin/commerce/config/shipping/services/ups are not displayed after saving the UPS settings form.

To resolve this I check the commerce_ups_services variable before it's updated and then compare it to the submitted form_state values. If there is any difference then the caches are cleared. If the values are the same, caches are left alone to prevent added load.

CommentFileSizeAuthor
#1 1688340_clear-caches-after-save.patch919 bytesandyg5000

Comments

andyg5000’s picture

Assigned: ultimike » Unassigned
StatusFileSize
new919 bytes

Patch attached

Update: If you apply this patch, be sure to disable and re-enable at least one shipping method (ie: UPS Ground). This will force the cache clearing that this patch was made for.

ultimike’s picture

Assigned: Unassigned » ultimike
Status: Active » Needs review

@andyg5000,

I just tested this patch and it appears to be sound. As soon as we get one or two more people to test it, then I'll go ahead and get it committed.

Thanks,
-mike

trimax’s picture

Assigned: Unassigned » ultimike

I was having the problem of the UPS option not showing on shipping page during checkout. Following andyg5000 suggestion I applied this patch and it has fixed the problem. This solution worked on this configuration:
- Commerce Kickstart (commerce_kickstart-7.x-2.0-rc2)
- Commerce Shipping 7.x-2.0-beta1+19-dev
- Commerce UPS 7.x-1.x-dev.

ultimike’s picture

Status: Needs review » Closed (fixed)

Committed and pushed. Thanks @andyg5000!

-mike