This looks like an issue in HEAD as well - there was no implementation of hook_token_values() or hook_token_list() from the token module.

This patch is resolving the issue in our test environment; our shipping notification emails are properly replacing values (e.g. [txn-id] is becoming '17')

CommentFileSizeAuthor
shipping.diff_.patch5.49 KBdgorton

Comments

djflux’s picture

Do you receive tags around your replaced tokens? e.g. When I go to the shipping notify for a transaction the following is displayed for [txn-items]:

Items(s) Shipped:
<em>1 order</em> of <em>DJ Hat</em> at <em>$15.00</em> each

However, it's only on certain tokens (txn-items, txn-ship-to). Some tokens seem to work fine (txn-id, txn-order-date).

Thanks,
Flux.

skwashd’s picture

in 5.x-3-dev at line 753 of shipping.module the following is required

$items .= t('!order of !title at !price each', array('!order' => format_plural($p->qty, '1 order', '!count orders'), '!title' => $p->title, '!price' => payment_format($p->price))). "\n";

instead of what is contained in the patch.

skwashd’s picture

There is a couple more tokens which need to use ! not % the order items listing is one of them

cboshuizen’s picture

There is no need to add the token functions to the shipping module, especially since the code is identical. I traced the function calls and the ones you added are never called.

The problem seems to be the incorrect number of parameters in the function call
return ec_mail_send_mid($mid, $to, ECMAIL_TYPE_CUSTOMER_INVOICE, $t); in store.module. If you check ec_mail.module you can see
function ec_mail_send_mid($mid, $to, $object = NULL, $from = NULL, $preview = FALSE)
where $object is the third item, but in the call it is the fourth. If I changed the function to
function ec_mail_send_mid($mid, $to, $type=NULL, $object = NULL, $from = NULL, $preview = FALSE)
then everything works fine.

Because I changed the function, I had to go and find all instances of where it was called and check our object ($t) was in the right place in the function call. Alternatively, just delete ECMAIL_TYPE_CUSTOMER_INVOICE from the one function call above.

cboshuizen’s picture

There is no need to add the token functions to the shipping module, especially since the code is identical. I traced the function calls and the ones you added are never called.

The problem seems to be the incorrect number of parameters in the function call
return ec_mail_send_mid($mid, $to, ECMAIL_TYPE_CUSTOMER_INVOICE, $t); in store.module. If you check ec_mail.module you can see
function ec_mail_send_mid($mid, $to, $object = NULL, $from = NULL, $preview = FALSE)
where $object is the third item, but in the call it is the fourth. If I changed the function to
function ec_mail_send_mid($mid, $to, $type=NULL, $object = NULL, $from = NULL, $preview = FALSE)
then everything works fine.

Because I changed the function, I had to go and find all instances of where it was called and check our object ($t) was in the right place in the function call. Alternatively, just delete ECMAIL_TYPE_CUSTOMER_INVOICE from the one function call above.

cboshuizen’s picture

There is no need to add the token functions to the shipping module, especially since the code is identical. I traced the function calls and the ones you added are never called.

The problem seems to be the incorrect number of parameters in the function call
return ec_mail_send_mid($mid, $to, ECMAIL_TYPE_CUSTOMER_INVOICE, $t); in store.module. If you check ec_mail.module you can see
function ec_mail_send_mid($mid, $to, $object = NULL, $from = NULL, $preview = FALSE)
where $object is the third item, but in the call it is the fourth. If I changed the function to
function ec_mail_send_mid($mid, $to, $type=NULL, $object = NULL, $from = NULL, $preview = FALSE)
then everything works fine.

Because I changed the function, I had to go and find all instances of where it was called and check our object ($t) was in the right place in the function call. Alternatively, just delete ECMAIL_TYPE_CUSTOMER_INVOICE from the one function call above.

cboshuizen’s picture

There is no need to add the token functions to the shipping module, especially since the code is identical. I traced the function calls and the ones you added are never called.

The problem seems to be the incorrect number of parameters in the function call
return ec_mail_send_mid($mid, $to, ECMAIL_TYPE_CUSTOMER_INVOICE, $t); in store.module. If you check ec_mail.module you can see
function ec_mail_send_mid($mid, $to, $object = NULL, $from = NULL, $preview = FALSE)
where $object is the third item, but in the call it is the fourth. If I changed the function to
function ec_mail_send_mid($mid, $to, $type=NULL, $object = NULL, $from = NULL, $preview = FALSE)
then everything works fine.

Because I changed the function, I had to go and find all instances of where it was called and check our object ($t) was in the right place in the function call. Alternatively, just delete ECMAIL_TYPE_CUSTOMER_INVOICE from the one function call above.

cboshuizen’s picture

There is no need to add the token functions to the shipping module, especially since the code is identical. I traced the function calls and the ones you added are never called.

The problem seems to be the incorrect number of parameters in the function call
return ec_mail_send_mid($mid, $to, ECMAIL_TYPE_CUSTOMER_INVOICE, $t); in store.module. If you check ec_mail.module you can see
function ec_mail_send_mid($mid, $to, $object = NULL, $from = NULL, $preview = FALSE)
where $object is the third item, but in the call it is the fourth. If I changed the function to
function ec_mail_send_mid($mid, $to, $type=NULL, $object = NULL, $from = NULL, $preview = FALSE)
then everything works fine.

Because I changed the function, I had to go and find all instances of where it was called and check our object ($t) was in the right place in the function call. Alternatively, just delete ECMAIL_TYPE_CUSTOMER_INVOICE from the one function call above.

cboshuizen’s picture

Sorry for the multiple posts. Drupal was dumping tonnes of database errors when I posted this message and I had no idea it had gone through.

Can someone please delete the successive comments?

Thanks,
Chris

dgorton’s picture

Agreed - my patch is ugly; duplicate code is not a good thing. I mentioned that in other places, but not in this actual patch post - my bad.

In any case, however, I'm quite sure this code was being called as it resolved the issue in our environment and it helped us meet a deadline. We were using a 4.7 install, however, so it may be somewhat different than the HEAD / 5.x branch.

regardless of all of that, however, it's duplicate code and that sort of thing needs to be solved by sharing, generalization or otherwise squashed in some manner.

Drew

brmassa’s picture

Status: Needs review » Closed (fixed)

Guys,

its fixed on eC4.

regards,

massa