View Single Post
  #1  
Old 01-22-2020, 10:40 AM
  vasilis's Avatar 
vasilis vasilis is offline
 

X-Adept
  
Join Date: Feb 2009
Posts: 761
 

Default 'Creating custom email notifications' dev doc

In the 'Creating custom email notifications' dev. article, the Mailer::register function does not exist in the 5.4.x version, so, when trying to send email, I get a
Quote:
Call to undefined method XLite\Core\Mailer::register()
error message, so this article doesn't fit in 5.4.x version.

The related code, displayed in the article, concerns the Mailer extending and decorating class:
PHP Code:
<?php

namespace XLite\Module\XCExample\EmailDemo\Core;

/**
 * Mailer core class
 */
abstract class Mailer extends \XLite\Core\Mailer implements \XLite\Base\IDecorator
{
    public static function 
sendEmailDemoMessage($to$body '')
    {
        static::
register([
            
'subject' => 'Demo notification',        
            
'body' => $body,
        ]);

        static::
compose(
            
'DemoMail',
            static::
getSiteAdministratorMail(),
            
$to,
            
'modules/XCExample/EmailDemo/message',
            array(),
            
true,
            \
XLite::CUSTOMER_INTERFACE
        
);

        return static::
getMailer()->getLastError();
    }
}


Would there be another method substituting register() method for 5.4.x, or the related code is different in other places as well, compared to the code presented in the article?
__________________
Vasilis Vrontisis
X-Cart Development, Maintenance & Customization
https://[URL="http://www.craftforweb.com"]craftforweb.com[/url]
vasilis@craftforweb.com
Reply With Quote