public function onAfterRegisterShop(Enlight_Event_EventArgs
$args) { /** @var Container $container */
$container =
$args->
getSubject();
/** @var RouterInterface $router */
$router =
$container->
get(\Shopware\Components\Routing\RouterInterface::
class);
/** @var \Shopware\Models\Shop\Shop $shop */
$shop =
$container->
get('shop'
);
/** @var Shopware_Components_Config $config */
$config =
$container->
get(Shopware_Components_Config::
class);
// Register the shop (we're too soon)
$config->
setShop($shop);
$context =
$router->
getContext();
$newContext = Context::
createFromShop($shop,
$config);
// Reuse the host
if ($newContext->
getHost() === null
) { $newContext->
setHost($context->
getHost());
$newContext->
setBaseUrl($context->
getBaseUrl());
$newContext->
setSecure($context->
isSecure());
} // Reuse the global params like controller and action
$globalParams =
$context->
getGlobalParams();