Jump to content

Macro $DATA.link does not work with"cancelled" order status email


Recommended Posts

The Admin Notify Status list of statuses in Store Settings, Features tab was an enhancement over the original two choices (Pending or Processing) that if any plugin were to add any additional statuses, then they would show up in this list without any coding changes. Unfortunately, the enhancement made it so that all statuses, actually usable or not, ended up in this list.

But the code that sends emails to the admin of an order that changes status was not enhanced beyond the original two choices: Pending or Processing. There is, however, a hook one can use to add the capability of sending an email to any other status.

Regarding what is made available to the email templates for Order Declined, Order Failed, and Order Cancelled, the code does not make details about the order available. But that can be fixed.

I will have edits for you shortly.

 

Link to comment
Share on other sites

In the file /classes/order.class.php

Near line 483, find:

case self::ORDER_DECLINED:
	// Nothing to do, but leave the option here for hooks & such
break;

case self::ORDER_FAILED:
	// Email the customer to explain their order failed fraud review
	$content = $mailer->loadContent('cart.payment_fraud', $order_summary['lang'], $this->_order_summary);
break;

case self::ORDER_CANCELLED:
	// Cancelled
	$content = $mailer->loadContent('cart.order_cancelled', $order_summary['lang'], $this->_order_summary);
break;

Change to:

case self::ORDER_DECLINED:
	// Nothing to do, but leave the option here for hooks & such
break;

case self::ORDER_FAILED:
	// Email the customer to explain their order failed fraud review
	$this->assignOrderDetails();
	$content = $mailer->loadContent('cart.payment_fraud', $order_summary['lang'], $this->_order_summary);
break;

case self::ORDER_CANCELLED:
	// Cancelled
	$this->assignOrderDetails();
	$content = $mailer->loadContent('cart.order_cancelled', $order_summary['lang'], $this->_order_summary);
break;

The related email templates will need to have the macros added -- you can copy the contents from another template.

  • Like 1
Link to comment
Share on other sites

Codes amended and admin now receives a copy of cancelled status. Great, thanks.

Macro {$DATA.link} still does not work in that specific email template but reading your reply in previous thread, you did say that no DATA is assigned to the Order Declined, Failed, and Cancelled statuses so a request will be made  in the Github requesting that DATA is to be made available to be assigned in these statuses.

So I conclude that we have to wait for the next system upgrade.

Edited by sailing123
Link to comment
Share on other sites

" Macro {$DATA.link} still does not work in that specific email template "

I see what's going on. Try this version:

Change to:

case self::ORDER_DECLINED:
	// Nothing to do, but leave the option here for hooks & such
break;

case self::ORDER_FAILED:
	// Email the customer to explain their order failed fraud review
	$this->assignOrderDetails();
	$content = $mailer->loadContent('cart.payment_fraud', $order_summary['lang']); // removed $this->_order_summary) so that assigned details will not be overwritten
break;

case self::ORDER_CANCELLED:
	// Cancelled
	$this->assignOrderDetails();
	$content = $mailer->loadContent('cart.order_cancelled', $order_summary['lang']); // removed $this->_order_summary) so that assigned details will not be overwritten
break;

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...