|
Posted by Paul Goodley on 10/23/05 03:51
Typically, shopping carts add a single item at a time, so it's easy to
prompt the user for information needed for the order, but what if the
shopping cart needs to process thirty items at once? I am working on a
shopping cart for a wholesale project and have run into trouble.
Retailers log into the site, click a link to take them to the category,
and get table with images and a checkbox. They click the checkbox of
each item they want to order. When you're ordering a bunch of items at
once, this is much easier. The user selects a lot of small parts from a
list, then I take them to a page where I show what they selected. On
each item, I need to get input from the users, like whether the part is
bronze or stainless, metric or standard, quantity, and so forth. I build
a table for each item and then put the form elements in so it looks
something something like this:
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td>$itemnumber</td>
<td><img name="itemimage" src="images/$itemnumber.jpg" width="32
height="32" alt=""></td>
<td><select name="composition" id="composition">
<option>brass</option>
<option>stainless</option>
<option>bronze</option>
</select></td>
<td><select name="class" id="class">
<option>SAE</option>
<option>metric</option>
</select></td>
<td><input name="quantity" type="text" id="quantity"></td>
</tr>
</table>
(There could be as many as forty of these in a single form)
I just can't seem to come up with a strategy for getting each item
and all its options stored into a mysql-backed shopping cart after I
post the form that has all their selections and options. When processing
a single item at a time, it's no problem. When I have thirty items to
loop through, it's over my head. I have never seen this done before, but
I imagine it has been done lots of times.
Is there anyone that can give me some pointers? Since I'm dealing
with twenty or thirty different items at a time, each with their own
sets of options, how can I treat each of the items as a single "line"--
in other words, enter one item into the DB, along with its two or three
parameters, like grade, size and metric or SAE? Is there a way to make
the form so each one of the items gets treated separately, or can I
somehow make each table get treated as a separate form when it gets posted?
Thanks tons for the assistance!
Navigation:
[Reply to this message]
|