Expanding Shopping Cart Tutorial

I’m following the Agile Development with Rails shopping cart tutorial,
and while some of its sticking, I’m still far from proficient.
Basically, I’m trying to use their shopping cart example as the base
for my store, but I need products in the store to have line items
themselves- for example:

my site sells custom printed t-shirts wholesale. I’m imagining a
customer will add a t-shirt order to their cart, and then from there,
be able to add line items - 5 smalls, 5 mediums, etc. Anyone have any
general suggestions on how I should set the tables up and associate the
line items with the products? So that a customer could have multiple
shirt orders, each with it’s own set of line items?

Many thanks in advance, and I’m happy to trade printing for code.

You might be interested in my book about building ecommerce sites
using Rails:

http://www.agilewebdevelopment.com/rails-ecommerce

One idea…

Rather than deal with two tables - order line and shirt-order-line as
you’ve suggested in your op, add a size column to your order lines table
to indicate the size for the shirt on this order line. In your product
listing, add a small form for each product listed with a quantity box
for each size. The user inputs quantities of each size he/she wants,
then clicks “add”. “Add” is actually the submit button for the form.
Your “add” action in the controller adds one order line for each size of
the shirt the user wanted.

So, if user puts in 4 smalls, 5 mediums and 10 larges then clicks “add”,
the result is 3 order lines. You could easily adapt the AWDWR shopping
cart to do this.

I’ve been working on a shopping cart for a
screen-print-frames-and-supplies company that is not the usual “catalog
with a picture and add-to-cart button” that you might want to have a
look at. Drop me a line at “house -at- balara -dot- com” if you’d like
to discuss further.

c.

vgkids wrote:

I’m following the Agile Development with Rails shopping cart tutorial,
and while some of its sticking, I’m still far from proficient.
Basically, I’m trying to use their shopping cart example as the base
for my store, but I need products in the store to have line items
themselves- for example:

my site sells custom printed t-shirts wholesale. I’m imagining a
customer will add a t-shirt order to their cart, and then from there,
be able to add line items - 5 smalls, 5 mediums, etc. Anyone have any
general suggestions on how I should set the tables up and associate the
line items with the products? So that a customer could have multiple
shirt orders, each with it’s own set of line items?

Many thanks in advance, and I’m happy to trade printing for code.