fszone Posted November 17, 2005 Posted November 17, 2005 Hi, I plan to use my shop mostly to distribute downloadable goods. I'm wondering if there is something that can email key codes on a per product basis. For example, If customer buys X product, after its state is set to "Delivered" keycode X is emailed to the customer If customer buys Y product, after its state is set to "Delivered" keycode Y is emailed to the customer Etc... Quote DOGECOIN GAMBLING SITES :P LITECOIN GAMBLING SITES
jefs.42 Posted November 17, 2005 Posted November 17, 2005 (edited) not sure if this is exactly what you're looking for, but...look in catalog/checkout_process.php and you'll see the section where the customer is emailed. starts with something like: // let's start the customer email or similar. then just before that do check for X or Y (you'll need their respective product id's). so say X is product 215 and Y is 324, do something like: $keycode = ''; // set keycode to blank if ($cart->in_cart(215)){ // check if X is in cart... $keycode = 'Keycode for X: fj40fj934fj043f4j0\n'; //keycode for X } if ($cart->in_cart(324){ // check if Y is in cart... $keycode .= "Keycode for Y: fjj4903-t3\n"; //keycode for Y } you'll want the .= in the second one (and Z, A, B, etc) in case they order more than one product w/ a keycode, and you might need to adjust/play with the \n's and/or <br> to get the email text to your liking. then just add $keycode to the email wherever you'd like, $email_text .= "Keys:\n$keycodes"; could do a if ($keycode != ''){ $email_text .= "Keys:\n$keycode"; } if ya want to check before you add it... hope this helps. Edited November 17, 2005 by jefs.42 Quote
fszone Posted November 17, 2005 Author Posted November 17, 2005 Looks good, but when will this be emailed to them? For example, if they pay with a check I don't want the codes to be emailed to them because I've never recieved payment. Only when I set the order statud to "Delivered". Quote DOGECOIN GAMBLING SITES :P LITECOIN GAMBLING SITES
jefs.42 Posted November 17, 2005 Posted November 17, 2005 check near the top of admin/orders.php, this is where the emails get sent on status update. then it's pretty much the same code, except the if parts, you'll have to look in the orders.php file for the correct term since there's no longer the $cart variable to check. maybe something as simple as $poductID. and you'll probably want to add a check like: if ($status == 3){ or whatever the value for 'Delivered' is in your setup. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.