I'm struggling to find the best approach to achieve what I need. I have a store that sells contact lenses. For lenses shipped to United States I need the customer prescription to be validated by an approved doctor. So the customer enters his doctor's details and a call is made to the doctor: if the doctor confirms the order, the order is shipped, otherwise the order is refused. The first time the order is confirmed, all subsequent orders with same details are automatically valid for the next year, so on the second order the customer should not need to enter the same doctors details again, because his prescription is already validated. What I tried so far:
- saving the doctor's details on the account information or in the billing address: this works only if the magento user (buyer) is also the person who will use the lenses. This doesn't work if the magento user wants to buy a present for somebody else: the doctors details of this second person should be added because the second person is the user of the lenses but the doctors details are link to the account or the billing address, which have nothing to do with the end user contained in the shipping address).
- saving the doctor's details on the shipping address: this works if the buyer is also the end user of the lenses and it works if the buyer wants to buy for someone else, but it does not work if the buyer is also the end user and wants to ship to another location (eg: the buyer lives in alabama, he's going to spend a few days in alaska and wants his lenses to be shipped in alaska. The doctor's details should not be linked to the alaska address, they should be linked to the alabama address because that's where the doctor of the buyer/end-user is)
- saving the doctor's details on the order: this doesn't work because I have no parameters to keep the validation for a year, so the user would be forced to enter the doctor's details everytime he places an order.
I have also thought to create a custom table in the database and put the doctor's details there but I still don't know how to link the details to the customer so that the user has to enter them only once and they will be valid for the next year.
Another solution would be to create a custom form the magento user can use to add all the doctors he needs, then in the checkout a dropdown would list them as options. But if the user doesn't have the doctors already in the list he has to leave the checkout, go to the custom form to enter the doctor, then go back to the checkout. It's too long so I hope there is a better way.
So basically what I need to achieve is: - the magento user buys for himself and ships to himself = he adds his own doctor - the magento user buys for himself but he ships to a different location = he add his own doctor - the magento user buys for somebody else and ships to the second person = he adds the doctor of the second person - the buyer needs to enter the doctor only the first time: if the call validates his order, the validation needs to be valid for a year (so all the other orders with the same details are already validated)