So I'm designing an ordering system that emails a distributor that you have on file for that particular item. Here is a screen shot. Basically you have an inventory of items, each item may have a different distributor, you add the items to your cart and now on this screen you can view your items you selected. If I hit Send order the following needs to happen. (Script Screen Shot Is below). I have all my variables set for the information of the bar and email settings, now the hard part, once we go back to this screen is to count how many different Distributor ids there are for this particular order and then set the email variable for each distributor. Once that is complete, it creates a form with the bar address, distributor information, and then copies all the items for that particular distributor and sends the email. The form would be a pdf attachment. What is the best way to accomplish this ?
Tables Working With : Orders and Ordered Items
Orders is just a listing of all order IDs, and Ordered Items is the actual items with each a unique record with the order ID attached to them.
The script right now is at the point where it shows all the items for this order, however I need to set the variable for the DID , get the email of or that distributor and send the email for those particular items, once that's done, goes back to the ordered item screen, goes to the next DID and does the same thing all over again.