Line item type should depend on product type, not content type
I apologize if this has already been suggested; the words involved are so generic that searching for them turns up too many results to go through.
I'm having a conceptual hurdle with the way line item types are selected. I need to collect different kinds of information when different types of product are added to a cart. Specifically, if someone orders a DVD, I don't need to know anything, but if they make a donation, I need to know in whose name the donation is being made, and if they're registering for an event, I need to know their meal preference, etc. I created line item types for each of these types of form and added the necessary fields to them, but in order to display the proper form, I have to set the line item type in the product reference field of the *content type*. This creates two problems for me: each time I want a new type of form to collect some kind of information, I have to also create another content type; and when creating a node to display products I have to be careful to select only products that are appropriate to the kind of line item that node will create.
What I'd like to propose instead is that the individual product -- or failing that, the product type -- should determine the line item type to be used with that product. That way you could display multiple different types of product in a single node (for example, register for an event *and* order the event T-shirt *and* contribute to the scholarship fund) and the Add to Cart form would change along with the product information. But more importantly, this would ensure that the proper information is always being collected for a given product regardless of where it is displayed.
Thank you for your consideration!
Comments
It's actually the add-to-cart form
I don't disagree with you.
But the issue here is that it's the *add-to-cart form* where the decision is being made, which happens to be configured in the display settings of a view or of a product display node.
The real issue is: We decide at a certain time what kind of line item to create when adding a product to the cart. How do we make the decision.
Good alternatives are certainly welcome. I don't think this whole thing is fully hashed out yet.
sense to the programmer vs. sense to the user
You said, "The real issue is: We decide at a certain time what kind of line item to create when adding a product to the cart. How do we make the decision."
How do we make the decision? Based on what the product is. If someone is buying a DVD, we never want to make them fill out an event form, and vice versa. I can't think of a scenario where it would make sense to use one line item type with a product in one context and another line item type with the same product in a different context. Can you suggest a scenario where that would make sense?
If not, then the question is not how we decide which line item type to use, but how we get Drupal to consistently use that line item type with a specified product. The current setup makes sense from a programming perspective but not from a user experience perspective. That needs to be reversed.
I'm not sure exactly how to
I'm not sure exactly how to do it, but I'd love to see a rule be able to decide what line item type was chosen. That would probably give everybody the flexibility they need.
"When choosing what kind of line item to use..."