getProductEdition example

public static function getSubscribedEvents()
    {
        return [
            'Enlight_Controller_Action_PostDispatchSecure_Backend_Index' => 'onPostDispatchBackendIndex',
        ];
    }

    public function onPostDispatchBackendIndex(Enlight_Event_EventArgs $args)
    {
        /** @var Enlight_Controller_Action $controller */
        $controller = $args->get('subject');
        $edition = $this->hasBackendLogin() ? $this->shopwareEditionService->getProductEdition() : ShopwareEdition::CE;
        $controller->View()->assign('product', $edition);
    }

    protected function hasBackendLogin(): bool
    {
        /** @var Shopware_Plugins_Backend_Auth_Bootstrap $authPlugin */
        $authPlugin = $this->plugins->get('Backend')->get('Auth');

        return $authPlugin->checkAuth() !== null;
    }
}
Home | Imprint | This part of the site doesn't use cookies.