I found a lot of answers to the problem I have, but some are contradicting and many are not fully clear to me, so I hope a Magento expert can point me into the right direction.
For some Products in Magento, there is a complex customization process. There is a custom editor and every "design" is identified by a unique value. What I need is to store this ID with the product in the cart and the order. It shouldn't be shown directly, but accessible in the code (to show a different thumbnail in the cart or some information on the invoice, for example).
Additionally, because the product is customized, the same product should have a separate line in the cart and invoice if this id differs!
So for example, a customer opens the product page, does some customization and this customization gets an ID "1". The customer puts that into the cart. He opens the same product again, customizes it differently and it gets the id "2". The customer also puts this into the cart!
The cart should now be:
- ProductX [custom text generated by code using id 1] 1 piece x€
- ProductX [custom text generated by code using id 2] 1 piece x€
and NOT:
- ProductX 2 piece x€
But still the customer should be able to order more than one of the same product with same ID! so e.g.
- ProductX [custom text generated by code using id 1] 4 piece x€
- ProductX [custom text generated by code using id 2] 2 piece x€
The customization happens outside of magento. Magento just has a link with a popup and then gets some ID that can then be attached using PHP. It just stores the ID and it has to be possible to get the ID for every product in cart/invoice/...
Important is that the ID is stored and that products with same sku/customizable options are not merged in the cart if the ID is different! Also the ID has to be a text string and not selected from a list like with magento customizable options!
Methods I found that might do what I want:
http://www.atwix.com/magento/custom-product-attribute-quote-order-item/ This looks the best for me, there is a finished Module I could modify. But I am not sure if it is the correct approach. Will the products be separated in cart? Also the value of the ID is set as Product option here and visible in the backend?! There is no value before a customer customizes the product in my case!
https://magento.stackexchange.com/a/1382 I am not quite sure... How can I get the ID, that is available on the product detail page, inside the observer...
How can I add every product as a new item into cart Maybe I need to modify this in addition to 1. or 2.?
I would greatly appreciate it if a Magento Expert could shine some light on this for me!