Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

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...

Posted (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 by jefs.42
Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...