From a default install the transactions are not being sent out correctly, or to the correct address

--8<--
Dear Customer,

Thanks for your recent purchase from Drupal. 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 and Shipping Information
********************************
Shipping to:

Shipping service:
none

Billing to:

********************************
Order Details
********************************
[items]
Questions about your order? Please contact us at
********************************
Shipping Instructions
********************************
We will notify you by email as soon as your order ships.

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

http://drupal5.heydon.com.au
--8<--

CommentFileSizeAuthor
#7 store_13.patch1.54 KBthekenshow
#2 store_token_bug.patch8.17 KBsym

Comments

neclimdul’s picture

Marked #113293 duplicate.

From the post:

All the token values for ec_mail were coming through as [xxxxxx] in the emails with the default email templates. I tried changing them to [[xxxxx]] and the values were then all included correctly. Somewhere there is an extra [], not sure where though, either the default templates are wrong or some coding, or possibly some set-up by me.

sym’s picture

Status: Active » Needs review
StatusFileSize
new8.17 KB

I've changed $values['[txn-bill-plus-ship]'] to $values['txn-bill-plus-ship'] on all of the tokens, and it seems to fix it.

sym’s picture

Component: ec_mail » store

this is a bug with the store module

bones’s picture

This does not fully work, some parts of some of the emails get sent correctly but not all.
With the default emails:

Cancel transaction works
Ask customer works
Shipping notify doesnt
Invoice Doesnt

The site variables always seem to work (such as site-name and email).

sym’s picture

Status: Needs review » Needs work

yep, after more testing this doesn't seem to work as I though it did.

thekenshow’s picture

I've found two transaction notification problems, for initial invoices and errors. I'm not up to creating a patch, but here's the relevant code with the errors commented out and followed by what works:

function store_send_invoice_email($txnid, $preview = null) {
  $t = store_transaction_load($txnid);

  if ($t->mail && valid_email_address($t->mail)) {
    $to = $t->mail;
  } elseif ($t->uid != 0) {
    $to = db_result(db_query("SELECT mail FROM {users} WHERE uid = '%d'", $t->uid));
  }

  $mid = variable_get(MAILVAR_CUSTOMER_INVOICE, 0);
  if ($preview) {
/*  return ec_mail_preview($mid, $to, ECMAIL_TYPE_CUSTOMER_INVOICE, $t);  */
    return ec_mail_preview($mid, $to, $t);
  }
  elseif ($to && valid_email_address($to)) {
/*    return ec_mail_send_mid($mid, $to, ECMAIL_TYPE_CUSTOMER_INVOICE, $t); */
    return ec_mail_send_mid($mid, $to, $t);
  }
  else {
    return false;
  }
}

function store_send_error_email($txnid, $preview = null) {
  $t = store_transaction_load($txnid);

  if ($t->mail && valid_email_address($t->mail)) {
    $to = $t->mail;
  } elseif ($t->uid != 0) {
    $to = db_result(db_query('SELECT mail FROM {users} WHERE uid = %d', $t->uid));
  }

  $mid = variable_get(MAILVAR_PROCESSING_ERROR, 0);

  if ($preview) {
/*     return ec_mail_preview($mid, $to, ECMAIL_TYPE_PROCESSING_ERROR, $t);  */
    return ec_mail_preview($mid, $to, $t);
  }
  elseif ($to && valid_email_address($to)) {
/*    return ec_mail_send_mid($mid, $to, ECMAIL_TYPE_PROCESSING_ERROR, $t);  */
    return ec_mail_send_mid($mid, $to, $t);
  }
  else {
    return false;
  }
}
thekenshow’s picture

StatusFileSize
new1.54 KB

This patch fixes the invoice, error and shipping email sending so they have the correct sender and content.

thekenshow’s picture

I just realized the version for this thread is HEAD, but the patch I submitted is for 4.7 v3b2.

bones’s picture

This patch works great. Thanks

gordon’s picture

Status: Needs work » Fixed

This has been fixed.

bones’s picture

When has this been fixed? it is still apparent in 4.7.3

Anonymous’s picture

Status: Fixed » Closed (fixed)