It important to keep in mind that the episode is focused on PayPal
notifications, not describing a fully fleshed out e-commerce domain model.
Spree[1] provides a better example of a fully implemented domain model. In
Spree, the concept of a ''cart'' is implemented using a current
order. When
an item is added to the ''cart'', it''s actually added
to the current order in
progress. I guess it''s not that different from the RailsCast example,
where
cart == order. In the past, when developing custom commerce platforms I
have tried it both ways: creating a cart and then migrating it to an order
when purchased; and just working with an order throughout. Using one domain
model, order with lifecycle states, is a lot simpler.
[1] http://www.spreecommerce.com
On Sunday, May 19, 2013 2:18:54 PM UTC-4, John Merlino
wrote:>
> Most implementations of shopping carts I have seen is that a user
> stores line items in a cart, where the line items represent products
> or subscriptions. So a cart has many products through line items and a
> product can have many carts through line items. Then a customer makes
> an order and so you introduce a new model order. The order has
> information such as customer''s name, the payment type, and if you
are
> working with a payment gateway, such as paypal, it will contain paypal
> tokens and recurring tokens. So the order and the cart are two
> different models, two different purposes. Cart is a thing that enables
> a customer to store things in, and a order is the thing that handles
> payments. So I was watching this railscasts and he updates a
> purchased_at attribute on the cart itself:
>
> http://railscasts.com/episodes/142-paypal-notifications?view=comments
>
> But is a cart really purchased, or is it the order that is purchased?
> If the order contains all payment information, shouldn''t the order
> contain the purchased_at attribute and not the cart?
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/70a81e86-b082-49eb-a507-64c96a1120d5%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.