Not really me asking for this, but posting to help the user who posted it here...

http://www.drupalcommerce.org/questions/3789/how-email-product-key-using...

"I have successfully hooked Drupal Commerce, Commerce Product Key, and Commerce PayPal in my dev site and test purchases show that keys are being assigned to completed purchases.

The issue: I'm trying to create a workflow rule (Send mail) that will automatically email the product key to the purchaser, but, I can't find any tokens to use (none are listed in REPLACEMENT PATTERNS). I've tried looking through the huge list in the Pathauto module, but did not find one either. So how do I call on it so that a product key can be sent through email after completing the purchase?

Thanks,
Mike"

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Zem’s picture

I am trying to do the same thing. I have tried to do this step by step using components in rules but for now I haven't been able to do this. Looking forward to some kind of solution or idea how to achieve it. If I was capable I would pitch in and help but my knowledge is still not enough after mere 4 month developing with drupal.

samalone’s picture

Status: Active » Needs review
FileSize
4.66 KB

I needed this as well, so today I coded it up myself.

My patch is below. It adds several replacement tokens that can be used in checkout panels, system messages, and email:

[commerce-order:product-keys]
A shorthand for [commerce-order:product-keys:text]
[commerce-order:product-keys:text]
A comma-separated list of product keys.
[commerce-order:product-keys:text-bullets]
A bulleted text list of product keys, with newlines separating keys.
Useful for emails.
[commerce-order:product-keys:html-list]
An HTML unordered list of product keys.
Useful for system messages and checkout panels.
samalone’s picture

This revised patch fixes a typo that was preventing the 'commerce-product-keys' token type from being defined.

lathan’s picture

Status: Needs review » Needs work

Less some white space issues this patch looks good.

lathan’s picture

Patch is failing for me please rebuild it against master, and fix white space issue.

git apply -v commerce_product_key-tokens-1777032-3.patch
commerce_product_key-tokens-1777032-3.patch:25: trailing whitespace.

commerce_product_key-tokens-1777032-3.patch:29: trailing whitespace.

commerce_product_key-tokens-1777032-3.patch:34: trailing whitespace.

commerce_product_key-tokens-1777032-3.patch:63: trailing whitespace.

commerce_product_key-tokens-1777032-3.patch:69: trailing whitespace.

Checking patch .gitignore...
Checking patch README.txt...
error: while searching for:

And you are ready to go.

error: patch failed: README.txt:24
error: README.txt: patch does not apply
Checking patch commerce_product_key.tokens.inc...

samalone’s picture

Okay, I've re-applied my edit to README.txt and fixed the trailing whitespace in commerce_product_key.tokens.inc. New patch against current master is attached.

Ashish Madkaikar’s picture

1. I copied commerce_product_key.tokens.inc as sites/all/modules/commerce_product_key/commerce_product_key.tokens.inc,
2. Cleared the cache but still don't see the tokens in the "Send Email" action of "Assign product key to user and order" rule.
what is it that i am missing here?

UPDATE ----------
My mistake ..the server file was replaced for some reason i don't know. Thanks

cmseasy’s picture

Status: Needs work » Reviewed & tested by the community

#6 works perfect: thanks.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, commerce_product_key-tokens-1777032-6.patch, failed testing.

lathan’s picture

Status: Needs work » Fixed

committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.