Events in eCommerce

Permalink
I'm having trouble using the core_commerce_on_checkout_finish_order event in the core commerce add-on.
The event is fired in /packages/core_commerce/libraries/payment/controller.php:
Events::fire('core_commerce_on_checkout_finish_order',$order,$ui);


I'm defining my event file/class/method in /config/site_events.php as:

Events::extend('core_commerce_on_checkout_finish_order',     /* event */
                  'AutoRegisterUser',         /* class */ 
                  'autoRegisterUserOnPayment',       /* method */
                  'models/core_commerce/auto_register_user.php'
              );


and it's not getting called (the function itself just writes a log entry as a test).

Is there a special place to define event processing functions in packages?

 
hanalei replied on at Permalink Reply
hanalei
Logging is a bit screwy in concrete5 right now, so even though you might have the event firing, it just might not be logging.


$log = new Log('exceptions');
$log->addEntry('log entry')

To make sure your event is wired properly I will always personally extend on_page_view and create a big ugly print statement in the function call, then switch it to the specific event I am trying to extend.
magneto replied on at Permalink Reply
Thanks for your reply. I can confirm the logging is working fine. I have tried using the in-built on_user_add event with the same logging in it and it works fine:

Events::extend('on_user_add',             /* event */
                  'ApplicationUser',         /* class */ 
                  'setupUserAddedInfo',       /* method */
                  'models/application_user.php');


so I'm wondering if there's something special about events fired from within packages?
magneto replied on at Permalink Reply
I added my event extend hook into the eCommerce payment controller and it worked fine.
/packages/core_commere/controllers/checkout/controller.php

public function on_start() {
...
Events::extend('core_commerce_on_checkout_finish_order',     /* event */
'AutoRegisterUser',         /* class */ 
'autoRegisterUserOnPayment',       /* method */
'models/core_commerce/auto_register_user.php',
array($ui,$order) ); 
}

Exactly the same event extend hook does NOT work if placed in /config/site_events.php.

There is a thread about this on google, when searching for "core_commerce_on_checkout_finish_order" in which Andrew (C5) says that this is a bug that will be fixed sometime after 5.4.1. I'm using 5.4.1.1 and its not fixed.

http://webcache.googleusercontent.com/search?q=cache:ZWjLhz0GwsMJ:w...