[ic] order same items several time

Chris Rapier interchange-users@interchange.redhat.com
Mon Sep 3 17:14:01 2001


Xiaowen Wu wrote:
> 
> Hi there, I have a simple question: when the user orders the same item
> several time, they are shown as difference order entries in the basket,
> are there anyway to combine them as one ?

I'd like to know this as well. I am guessing that there is a relatively
straight forward way to do this in perl...
If you can dump the contents of the cart into a hash keyed on some thing
like the SKU of the product (where the value is the qauntity of the
item) and *then* dump that hash back into the shopping cart it should
work.

I'm guessing a usertag would be the right way to do this.

> Also, I would like to put a quantity limit to some item, in case the user
> order more than the limit, it will reject the order, any easy way to
> implement this ?
Depends on what the critera is but you should be able to just compare
the quantity of Item X to some predetermined limit. If its above that
limit it sets a awarning flag (to tell the customer) and automatically
decreases the quantity to the maximum limit. You should also be able to
set a limit for each item with another column in your products table.

I'm out of practice with writing the IML foo but here is a semi pseudo
code rendition of the above

[list items] # go through each item in the shopping cart
 [if table=products key=sku column=limit] #only go through this if a
limit is set
   [if item quanity > limit] 
      [seti over_limit_warning] Over limit![/seti] # let the user know
      [data table=cart key=code column=quantity value=limit] # set to
the maximum limit
   [/if]
  [/if]
[/list]

Again, this is just really really not even close to the right syntax but
this is one way to go about doing that. 

If you are going to do this you need to decide where the right places to
do this are. Just at the item selection screen isn't enough as they can
just re-enter a different qauntity on the shopping cart page. So, I'd
put it on the shopping cart page and/or checkout.