dispatch event when default currency change
This commit is contained in:
@@ -367,6 +367,8 @@ final class TheliaEvents
|
||||
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
|
||||
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
|
||||
|
||||
const CHANGE_DEFAULT_CURRENCY = 'action.changeDefaultCurrency';
|
||||
|
||||
// -- Attributes management ---------------------------------------------
|
||||
|
||||
const ATTRIBUTE_CREATE = "action.createAttribute";
|
||||
|
||||
@@ -32,6 +32,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Session;
|
||||
|
||||
use Thelia\Core\Event\CurrencyEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model;
|
||||
|
||||
/**
|
||||
@@ -146,6 +148,9 @@ class TheliaHttpKernel extends HttpKernel
|
||||
$currency = null;
|
||||
if ($request->query->has("currency")) {
|
||||
$currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency"));
|
||||
if($currency) {
|
||||
$this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyEvent($currency));
|
||||
}
|
||||
} else {
|
||||
$currency = $request->getSession()->getCurrency(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user