Frontend example


        if (PHP_SAPI === 'cli') {
            return;
        }

        $container = Shopware()->Container();
        if (!$container->initialized('session')) {
            return;
        }

        /** @var Shopware_Plugins_Frontend_Statistics_Bootstrap $plugin */
        $plugin = Shopware()->Plugins()->Frontend()->Statistics();
        if ($plugin->checkIsBot($args->getRequest()->getHeader('USER_AGENT') ?: '')) {
            $this->get('session')->invalidate();
        }
    }

    /** * Event listener method * * @return \sSystem */
    public function onInitResourceSystem(Enlight_Event_EventArgs $args)
    {
$this->View()->assign(['sArticles' => $convertedProducts, 'articles' => $convertedProducts]);
    }

    /** * Tag cloud by category * * @return void */
    public function tagCloudAction()
    {
        $config = $this->container->get('plugins')->Frontend()->TagCloud()->Config();

        if (empty($config->get('show'))) {
            return;
        }

        $controller = $this->Request()->getParam('sController', $this->Request()->getControllerName());

        if (str_contains($config->get('controller')$controller)) {
            $this->View()->assign('sCloud', $this->container->get('modules')->Marketing()->sBuildTagCloud(
                $this->Request()->getParam('sCategory')
            ));
        }


    /** * Refresh shop statistic */
    public function refreshStatisticAction(): void
    {
        $request = $this->Request();
        $response = $this->Response();

        /** @var Shopware_Plugins_Frontend_Statistics_Bootstrap $plugin */
        $plugin = Shopware()->Plugins()->Frontend()->Statistics();
        $plugin->updateLog($request$response);
    }

    /** * Get cms menu */
    public function menuAction(): void
    {
        $this->View()->assign('sGroup', $this->Request()->getParam('group'));
        $plugin = Shopware()->Plugins()->Core()->ControllerBase();
        $this->View()->assign('sMenu', $plugin->getMenu());
    }
Home | Imprint | This part of the site doesn't use cookies.