The acts_as_shopping_cart gem requires two models - Shopping Cart
and Shopping Cart Item
.
The attributes it allows you to access like this for the item:
<td><%= shopping_cart_item.item.name %></td>
<td><%= shopping_cart_item.item.price %></td>
<td><%= shopping_cart_item.quantity %></td>
But I want to allow users to change the quantity - from say a drop-down menu (so a select tag from a collection).
But I am not quite sure how to approach that.
I would also like to add other attributes to my item - like a size of an item, color, etc.
I would like my store owner to be able to specify those things (i.e. size, color, etc.).
How do I do that within the confines of acts_as_shopping_cart
?
Thanks.
Edit 1:
Or if someone has a better suggestion for another shopping cart solution that will allow me to do basic checkout, I would appreciate that too.
Edit 2
views/shopping_cart/show.html.erb
<h1>Shopping Cart</h1>
<table class="table table-striped">
<thead>
<tr>
<td>Item</td>
<td>Price</td>
<td>Quantity</td>
</tr>
</thead>
<tbody>
<tr>
<%= render :partial => 'shopping_cart_item', :collection => @shopping_cart.shopping_cart_items %>
</tr>
</tbody>
</table>
<div>
<p>SubTotal: <%= number_to_currency @shopping_cart.subtotal %></p>
</div>
<div>
<p>Taxes: <%= number_to_currency @shopping_cart.taxes %></p>
</div>
<div>
<p>Total: <%= number_to_currency @shopping_cart.total %></p>
</div>
_shopping_cart_item.html.erb
partial looks like this:
<td><%= shopping_cart_item.item.name %></td>
<td><%= shopping_cart_item.item.price %></td>
<td><%= shopping_cart_item.quantity %></td>
Very very basic shopping cart - but not sure how to move from this to an actual shopping cart with quantity, size, etc.