Hello all,

I just spent a few hours trying to track down why [mail] is not replaced on emails that are sent by ecommerce v3.4.

I dumped the object before ec_mail in ec_mail_load_mail_for_send:

stdClass::__set_state(array(
   'txnid' => '140',
   'uid' => '2',
   'type' => 'cart',
   'mail' => 'davea@ingraftedsoftware.com',
   'shipping_cost' => '0.00',
   'payment_method' => 'cod',
   'payment_status' => '2',
   'payment_date' => '1216175763',
   'workflow' => '6',
   'gross' => '45.95',
   'created' => '1216175763',
   'changed' => '1216175763',
   'duedate' => '0',
   'token' => 'cPkrASrT9nbZuqUfShpAGpBToDfFq6af',
   'items' => 
  array (
    0 => 
    stdClass::__set_state(array(
       'txnid' => '140',
       'nid' => '2077',
       'vid' => '2078',
       'title' => 'Peanuts',
       'price' => '45.95',
       'qty' => '1',
       'data' => '',
       'rtxnid' => NULL,
       'rnid' => NULL,
       'ptype' => 'paypernode',
       'schedule' => 
      array (
        'sid' => '2',
        'name' => 'Monthly Schedule',
        'numunits' => '1',
        'unit' => 'M',
        'cycles' => '0',
        'expiry' => 1218787200,
        'reminders' => 
        array (
        ),
      ),
       'is_recurring' => true,
       'anon_policy' => '1',
    )),
  ),
   'misc' => 
  array (
    0 => 
    stdClass::__set_state(array(
       'txnid' => '140',
       'type' => 'shipping',
       'vid' => '0',
       'description' => 'Shipping',
       'invisible' => '0',
       'price' => '0.00',
       'qty' => '1',
       'weight' => '9',
    )),
  ),
   'address' => 
  array (
    'billing' => 
    stdClass::__set_state(array(
       'txnid' => '140',
       'type' => 'billing',
       'firstname' => 'John',
       'lastname' => 'Doe',
       'street1' => '101 Main Street',
       'street2' => '',
       'zip' => '10001',
       'city' => 'Anywhere',
       'state' => 'NY',
       'country' => 'us',
    )),
    'shipping' => 
    stdClass::__set_state(array(
       'txnid' => '140',
       'type' => 'shipping',
       'firstname' => 'John',
       'lastname' => 'Doe',
       'street1' => '101 Main Street',
       'street2' => '',
       'zip' => '10001',
       'city' => 'Anywhere',
       'state' => 'NY',
       'country' => 'us',
    )),
  ),
   'ship' => false,
))

And here is the result of the replacement:

'Dear John Doe,
email address is [mail]
Thanks for your recent purchase from Example.com.  This message includes important information about your order. Please take a moment to read it closely, and be sure to save a copy for future reference.

********************************
Billing Information
********************************

Billing to:
John Doe
101 Main Street
Anywhere, NY 10001
United States



********************************
Order Details
********************************
1 order of Peanuts at $45.95 each

Questions about your order? Please contact us at registrations@example.com

Thanks for shopping at example.com.  We hope to hear from you again real soon!

Here is the email template that token replace runs on:

Dear [txn-billing-firstname] [txn-billing-lastname],
email address is [mail]
Thanks for your recent purchase from [site-name].  This message includes important information about your order. Please take a moment to read it closely, and be sure to save a copy for future reference.

********************************
Billing Information
********************************
[txn-bill-to]
********************************
Order Details
********************************
[txn-items]
Questions about your order? Please contact us at [site-mail]

Thanks for shopping at [site-name].  We hope to hear from you again real soon!

[site-url]

So you can see that [mail] is NOT replaced. All the rest of the tokens are replaced properly. Does this problem relate to the structure of the original object?

Thanks!
DaveA

Comments

greggles’s picture

Project: Token » e-Commerce
Version: 5.x-1.9 » 5.x-4.x-dev
Component: Code » ec_mail

I'm not really sure. I just tested the [mail] token using Pathauto and it works fine so I'm re-assigning this to e-commerce module.