Jump to content
sailing123

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

Recommended Posts

Hi,

Macro {$DATA.link} does not work if used in the email template of the CANCELLED order status. How can I fix it please ?

Thanks

S.

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×