diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 54f05c0c0..7215cadbf 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -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"; diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php index cf1d35195..fa1593fe5 100755 --- a/core/lib/Thelia/Core/TheliaHttpKernel.php +++ b/core/lib/Thelia/Core/TheliaHttpKernel.php @@ -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); }