hasCustomerStreamEmotions example

/** @var ShopContextInterface $context */
        $context = Shopware()->Container()->get(\Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface::class)->getShopContext();
        $categoryId = $context->getShop()->getCategory()->getId();

        /** @var StoreFrontEmotionDeviceConfiguration $service */
        $service = $this->get(\Shopware\Bundle\EmotionBundle\Service\StoreFrontEmotionDeviceConfigurationInterface::class);
        $emotions = $service->getCategoryConfiguration($categoryId$context);

        $categoryContent = Shopware()->Modules()->Categories()->sGetCategoryContent($categoryId);

        $this->View()->assign([
            'hasCustomerStreamEmotion' => $this->container->get(\Shopware\Models\CustomerStream\CustomerStreamRepositoryInterface::class)->hasCustomerStreamEmotions($categoryId),
            'emotions' => $emotions,
            'hasEmotion' => !empty($emotions),
            'sCategoryContent' => $categoryContent,
            'sBanner' => Shopware()->Modules()->Marketing()->sBanner($categoryId),
        ]);
    }

    /** * Handle theme preview hash * * @return bool */
$categoryContent['streamId']
        );

        $location = $this->getRedirectLocation($categoryContent$emotionConfiguration['hasEmotion']$shopContext);
        if (\is_string($location)) {
            $this->redirect($location['code' => Response::HTTP_MOVED_PERMANENTLY]);

            return;
        }

        $hasCustomerStreamEmotions = $this->customerStreamRepository
            ->hasCustomerStreamEmotions($requestCategoryId);

        if ($hasCustomerStreamEmotions && !$request->getParam('sPage')) {
            $assign = $this->View()->getAssign();
            $this->View()->loadTemplate('frontend/listing/customer_stream.tpl');
            $this->View()->assign($assign);

            return;
        }

        $this->View()->assign($emotionConfiguration);

        
Home | Imprint | This part of the site doesn't use cookies.