I have been thinking about this to make the order validation easier. When an order is completed, an e-mail is sent to the user containing the invoice. If you are using the Product Keys module, the user will receive an other mail containing his product keys (conditionnal actions involved)
So I have made a patch on the uc_product_keys.module file which allow those two e-mail to be sent into one (see Invoice template)
Since Ubercart 2.3, the templates use variables insted of tokens and so to be able to use [product-keys], I have defined the hook hook_preprocess_uc_order to do so.
Now, inside the invoice template (sites/all/themes//uc_order-customer.tpl.php), you can easily use the variable $product_keys which represent [product-keys] and so integrate the content of the product keys mail inside the invoice.
The only thing to do to stop the product keys module sending its e-mail is to comment
//$status = ca_pull_trigger('uc_product_keys_assigned', $all_keys, $user, $order);
(line 740)
I am not sure this could be usefull but it is for me.
| Comment | File | Size | Author |
|---|---|---|---|
| uc_product_keys.module.patch | 554 bytes | nicolasb_cdip |
Comments
Comment #1
alexd73 commentedHello!
Can you help me to create external printable version of each key with CCK fields from product node?
As example, on Product keys tab of each row show Print button.
Thank you!
Comment #2
freixas commentedHi,
Interesting extension. Product keys are sent out only when payment is received, so there are two obvious questions:
What happens if an invoice is about to be sent out, but payment has not yet been received (e.g. payment by check)?
When payment is received, are we guaranteed that an updated invoice will always be sent out?
In other words, once we tie the keys to the invoice, we need to ensure that the invoice emails meet the requirements now met by the product key emails. For example, I think you can alter the invoice and suppress the invoice email. This might make it so that the customer never receives his/her keys. You would have to have code to check for this, since telling people to remember to email the invoice is not an acceptable solution (the admin might be inexperienced or substituting for someone else).
Comment #3
cmcintosh commentedthis is simple to fix why not just do a conditional statement in the template asking if the payment has been recieved?
Comment #4
luthien commentedwhat about showing the product keys inside the email that contains the link to download a file? how can I achieve that?