[ic] Update cart contents, preventing re-order?

Ed LaFrance interchange-users@icdevgroup.org
Tue Oct 1 10:34:02 2002


At 12:04 PM 10/1/2002 +0100, you wrote:
>On Tuesday 01 October 2002 11:34, you wrote:
>
> > > I'd like to have my page update the existing shopping cart
> > > (replacing the old values with the new ones instead of
> > > incrementing them/creating new orderlines)?
>
> > I have done this before with a usertag which sets the form values from the
> > cart, and then clears the cart. Then, when the user submits again, cart is
> > loaded fresh.
>
>I'm already at the point where the order form (in my case flypage.html) is
>reloaded with the cart contents. So, clearing the cart just before ordering
>is definitely acceptable. Main problem is 'where?'
>
>I'd need to get some code between the point where the user clicks 'Update
>order' and displaying the shopping basket/checkout page (or whichever other
>page comes next), how did you manage this?
>
>Regards,
>
>Marc Brevoort

One way to do it is with an mv_click in your order form:

<FORM ACTION="[process]" METHOD=POST>
  <INPUT TYPE=hidden  NAME="mv_order_item"  VALUE="[item-code]">
  <input type=hidden name=mv_session_id value="[data session id]">
  <input type=hidden name=mv_todo value=refresh>
  <input type=hidden name=mv_click value="clear_cart">
[set clear_cart]
     [calc]$Carts->{main} = []; return;[/calc]
[/set]
... (mv_order_item and mv_order_quantity inputs here)

  <input type="image" src="__THEME_IMG_DIR__buynow.gif" border="0" 
value="Buy Now!">

This will clear the cart before loading it with the newly ordered items.

- Ed L.


===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================