Page 1 of 1
How OrderItem is associated with SKU/Product
Posted: Thu Apr 19, 2012 3:44 am
by pokemon007
Can anyone explain how an OrderItem is associated with sku? I don't see such association in db schema or code. I thought this should be straight forward 1:1 relationship.
Another question is why a sku is associated with a list of products. Can anyone explain?
Thanks!
Re: How OrderItem is associated with SKU/Product
Posted: Thu Apr 19, 2012 10:17 am
by jefffischer
You're looking for DiscreteOrderItemImpl.
We maintain a ManyToMany relationship between product and sku to support a flexible catalog model. For example, you might want to have a hat product with skus for red hat, green hat, blue hat, etc... However, we also support a OneToOne association between product and sku for less complex catalogs (this is what's currently supported in the admin). Take a look at ProductSkuImpl for this approach.
Re: How OrderItem is associated with SKU/Product
Posted: Thu Apr 19, 2012 10:50 pm
by pokemon007
Thank you, Jeff, for the quick reply. DescreteOrderItem makes sense.
I understand one product may be associated with many sku. My question is why one sku is associated with many parent products. I thought categories may have multiple parent categories and parents' parent categories. Do products have similar hierarchical structure?
A use case may have me understand the rationale behind it.
Thank you very much!