We want to add a fixed shipping cost to each order.
To accomplish this we made a small module we named uc_simpleflatrate. One of the hooks we are using is hook_line_item(), which we use to add a line to the cart/checkout - Order Total Preview.
Code to add the line:
drupal_add_js("\$(document).ready( function() { set_line_item('".t('Shipping')."', '". t('Shipping') ."', ". _uc_simpleflatrate_get_amount($qty) .", -8); } );", 'inline');However, at about 50% of the times when you visit cart/checkout, the line "Shipping xx" is missing, or is only visible for a very short time before disappearing...
I guess this has something to do with the javascript? Any tips appreciated.


). Basically, the page is running a few asynchronous HTTP requests at the same time using $.post() in that set_line_item() function. Well, they don't always get returned in the same order you call them, so it results in overwrites. I need to either devise a new way of doing that or add some sort of custom mutex that will ensure things get fired off in order. Any ideas?


Joined: 08/08/2007