Hi
Are there any events or hooks available to detect the shop change form frontend (shop change dropdown in the header.)?
How we can check the customer changed the shop in frond-end? (I what to do some function after the shop change in my plugin).
Hi
Are there any events or hooks available to detect the shop change form frontend (shop change dropdown in the header.)?
How we can check the customer changed the shop in frond-end? (I what to do some function after the shop change in my plugin).
-------- My solution is ---------------
public static function getSubscribedEvents()
{
return [
//Shop change
‘Enlight_Controller_Front_RouteShutdown’ => ‘checkShopUpgrade’,
];
}
/**
* Event listener method
*/
public function checkShopUpgrade(\Enlight_Controller_EventArgs $args)
{
$request = $args->getRequest();
$response = $args->getResponse();
if (Shopware()->Container()->initialized(‘shop’)) {
if($request->getPost(’__shop’) !== null && $request->getPost(’__redirect’) !== null)
{
//Shop changed
$this->updateAbandonedCartItemsOnShopChange();
return true;
}
}
return false;
}