Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Custom e-mail variables

 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 10-09-2020, 04:40 PM
  The Knotty Celt's Avatar 
The Knotty Celt The Knotty Celt is offline
 

Member
  
Join Date: Jan 2020
Posts: 16
 

Default Custom e-mail variables

PREMISE
I have created a custom module which adds an order reference field to the Order class. The module displays this rather than the default order number. This was done to allow for customized format and annual counter reset. While I am able to correctly display this reference number to the customer and admin, emails are still referencing the default order number.


WHAT I'VE TRIED
I believe the email variables are defined in the XLite\Core\Mail\Order\AOrder class, specifically the __construct fucnction.


Code:
<?php // vim: set ts=4 sw=4 sts=4 et: namespace XLite\Module\LBS\OrderReference\Core\Mail\Order use XLite\Core\Cache\ExecuteCachedTrait; use XLite\Core\Config; use XLite\Module\LBS\OrderReference\Model\Order; use XLite\View\AView; abstract class AOrder extends \XLite\Core\Mail\Order\AOrder implements \XLite\Base\IDecorator { public function __construct(Order $order) { parent::__construct(); $this->appendData([ 'order' => $order; 'recipient_name' => $order->getProfile()->getName(), ]); $this->populateVariables([ 'order_number' => $order->getReference(), 'order_total' => AView::formatPrice($order->getTotal()), 'recipient_name' => $order->getProfile()->getName(), 'first_name' => $order->getProfile()->getName(true, true), 'shipping_method_name' => $order->getPaymentMethodName(), ]); $this->getAttachPdfInvoice(Config::getInstance()->NotificationAttachments->attach_pdf_invoice); if ($order->getPaymentStatus()) { $order->getPaymentStatus()->explicitlyLoadTranslations(); } if ($order->getShippingStatus() { $order->getShippingStatus()->explicitlyLoadTranslations(); } } }


I replaced the getOrderNumber() function call wtih a call to the getReference() function of my decorated Order class.


RESULTING BEHAVIOUR
Even after rebuilding cache, and attempting to send an order update e-mail, the subject line still uses the build-in order number rather than the customized reference number.


What am I missing? Did I not decorate the correct class? Did I not decorate it properly? How can I achieve my desired result?


Thank you in advance for any assistance you are able to provide.
__________________
X-Cart version 5.4.1.15
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:32 PM.

   

 
X-Cart forums © 2001-2020