Ajax submit Update Cart button in Cart Block
I'm trying to add ajax to the dc_cart_block, but am having some issues with the line items not refreshing and the form submitting twice.
The site is here: http://piesd.txcsites.com/order-pies/cowboy
The module code is here: http://pastebin.com/Zwn6Cean
If you add something to the cart and then try to update the quantity of a line item you'll see the issues.
The total updates but the line item total does not update and in the $form_state array the new default quantity doesn't refresh. If the page is refreshed then the cart load properly, but the view is loading the line items from a cache or something instead of rebuilding line items after the form submit has gone through.
Second minor issue: the form is submitting twice (Cart update message appears twice for every ajax call)
Thanks
Comments
Thanks for replying, EclipseGc! Could you expand on that suggestion a bit. I'm not sure where to take it.
I'm not trying to update the individual line items. The module re-loads the entire cart_block view and displays it, but there seems to be some sort of line item cache that is keeping the old line items when the view is built. I've tried resetting the view with:
$view = views_get_view($view_name, TRUE);
but it still doesn't work.