Johno Posted April 24, 2003 Share Posted April 24, 2003 Morning All, Does anyone know of an easy way to do this? At the moment I have a thousand or so keycodes in a spreadsheet, and whenever anyone purchases one, I have a little routine in Access which gets the next keycode from the spreadsheet and emails it to the customer. I haven't seen a contribution which would do this & I don't yet know enough about PHP to do it myself. Any help would be greatly appreciated. Cheers, Link to comment Share on other sites More sharing options...
Carl Torney Posted April 24, 2003 Share Posted April 24, 2003 Forget It johno, it's impossible.............. I tried for weeks :( :( Link to comment Share on other sites More sharing options...
Johno Posted April 25, 2003 Author Share Posted April 25, 2003 I've added a couple of tables into ORDERS_PRODUCTS & used the following code at the bottom of CHECKOUT_SUCCESS. UPDATE orders_products SET KeyCounter = KeyCounter + 1 WHERE ((products_model Like "SSPCREG" Or products_model Like "SSMACREG") AND (KCAllocated)=0); UPDATE orders_products SET KCAllocated = 1 WHERE (((KCAllocated)=0) AND ((products_model) Like "SSPCREG" Or (products_model) Like "SSMACREG")); SSPCREG & SSMACREG are the products which need a keycode allocating. KeyCounter will keep a running total & KCAllocated if a flag that will be set to one when a code is issued to this particular sale. The above code works when pasted into PHPMYADMIN but not in CHECKOUT_SUCCESS. Any Ideas? Link to comment Share on other sites More sharing options...
Ajeh Posted April 25, 2003 Share Posted April 25, 2003 You could make a table: keycodes Fields products_id orders_id keycodes Update the quantity needed with the orders_id where orders_id is blank This locks the keycodes from being used more than once. Select the keycodes where the orders_id = current orders_id This gets your keycodes for this order. Now include those in the order sent to the customer and if you have fields to fill in on the order for the product to show the keycodes do that too. Link to comment Share on other sites More sharing options...
Johno Posted April 29, 2003 Author Share Posted April 29, 2003 Hi Linda, Thanks for that, it sounds like just what I need. However............. Being but a novice to this whole PHP thing, I'm not sure how to go about doing it. I'm fairly sure I could add the allocated keycode to an email or an invoice, but, I can't work out how to allocate the keycodes. Any help you could offer would earn you a virtual Beer. Cheers, Johno Link to comment Share on other sites More sharing options...
Guest Posted April 29, 2003 Share Posted April 29, 2003 give her 30 minutes and she will write it :lol: :lol: at least she will put it on her every growing overpopulated list of things to do - she can't resist a challenge 8) and she's the best on the forum :wink: Link to comment Share on other sites More sharing options...
Ajeh Posted April 29, 2003 Share Posted April 29, 2003 give her 30 minutes and she will write it :lol: :lol: at least she will put it on her every growing overpopulated list of things to do - she can't resist a challenge 8) and she's the best on the forum :wink: Have to go on the To Do List ... I need to get the current SEC project out and am working on it like crazy to finish ... but those silly clients keep calling for my attention ... go figure?! :roll: But then I guess as they help feed my cat, makes it tough to say no when they call. :D But it is getting there ... there is a light flickering out there in the dark. Link to comment Share on other sites More sharing options...
Johno Posted June 25, 2003 Author Share Posted June 25, 2003 Greetings All, I think I've just about done this, however, I need a little help. I have a table " KEYCODES " And I need to update " $to_issue2 " number of records ( i.e. set the " order_id " field ) with the order id ($acjoid) . What I am using is below, this keeps giving me a Parse error. I'd be grateful if someone could help me with the syntax here. tep_db_query("update" . TABLE_KEYCODES . " set order_id = " $acjoid " where order_id = NULL LIMIT " $to_issue2); Cheers, Johno Link to comment Share on other sites More sharing options...
Johno Posted August 6, 2003 Author Share Posted August 6, 2003 I've finally managed to get this working :- http://www.oscommerce.com/community/contributions,1430 Have a look and let me know what you think. Johno Link to comment Share on other sites More sharing options...
Johno Posted August 6, 2003 Author Share Posted August 6, 2003 I think that this is in the wrong forum now (as I've submitted it as a contribution) Perhaps someone would be kind enough to close this thread & we can continue this here :- http://www.oscommerce.com/forums/viewtopic.php?t=53785 Cheers, Johno Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.