Modules example

return;
        }

        // Load the right template         if (!empty($blogArticleData['template'])) {
            $this->View()->loadTemplate('frontend/blog/' . $blogArticleData['template']);
        }

        $this->View()->assign('userLoggedIn', !empty(Shopware()->Session()->get('sUserId')));
        if (!empty(Shopware()->Session()->get('sUserId')) && empty($this->Request()->get('name'))
            && $this->Request()->getParam('__cache') === null) {
            $customerData = Shopware()->Modules()->Admin()->sGetUserData();
            if (\is_array($customerData)) {
                $this->View()->assign('sFormData', [
                    'eMail' => $customerData['additional']['user']['email'],
                    'name' => $customerData['billingaddress']['firstname'] . ' ' . $customerData['billingaddress']['lastname'],
                ]);
            }
        }

        $mediaIds = array_column($blogArticleData['media'], 'mediaId');
        $context = $this->get(ContextServiceInterface::class)->getShopContext();
        $mediaStructs = $this->get(MediaServiceInterface::class)->getList($mediaIds$context);

        

    public function indexAction()
    {
        if ($this->Request()->getParam('isXHR')) {
            $this->View()->loadTemplate('frontend/custom/ajax.tpl');
        }

        $shopId = $this->container->get(ContextServiceInterface::class)->getShopContext()->getShop()->getId();

        $staticPage = Shopware()->Modules()->Cms()->sGetStaticPage($this->Request()->get('sCustom')$shopId);

        if (!\is_array($staticPage)) {
            throw new ResourceNotFoundException('Custom page not found', $this->Request());
        }

        if (!empty($staticPage['link'])) {
            $link = Shopware()->Modules()->Core()->sRewriteLink($staticPage['link']$staticPage['description']);

            $this->redirect($link['code' => Response::HTTP_MOVED_PERMANENTLY]);

            return;
        }


    /** * @return void */
    public function layoutAction(Request $request)
    {
        $this->View()->loadTemplate('frontend/listing/customer_stream/layout.tpl');

        $categoryId = (int) $request->getParam('sCategory');

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

        $config = $this->getEmotionConfiguration($categoryId, true, $categoryContent['streamId'] ?? null);

        $config = array_merge($config[
            'sBanner' => Shopware()->Modules()->Marketing()->sBanner($categoryId),
            'sCategoryContent' => $categoryContent,
            'Controller' => 'listing',
            'params' => $this->Request()->getParams(),
        ]);

        $this->View()->assign($config);
    }
Shopware_Components_Modules $moduleManager = null,
        ?sSystem $systemModule = null,
        ?ContextServiceInterface $contextService = null,
        ?AdditionalTextServiceInterface $additionalTextService = null
    ) {
        $this->db = $db ?: Shopware()->Db();
        $this->eventManager = $eventManager ?: Shopware()->Events();
        $this->snippetManager = $snippetManager ?: Shopware()->Snippets();
        $this->config = $config ?: Shopware()->Config();
        $this->session = $session ?: Shopware()->Session();
        $this->front = $front ?: Shopware()->Front();
        $this->moduleManager = $moduleManager ?: Shopware()->Modules();
        $this->sSYSTEM = $systemModule ?: Shopware()->System();

        $this->contextService = $contextService;
        $this->additionalTextService = $additionalTextService;
        $this->connection = Shopware()->Container()->get(Connection::class);

        if ($this->contextService === null) {
            $this->contextService = Shopware()->Container()->get(ContextServiceInterface::class);
        }

        if ($this->additionalTextService === null) {
            
public function __construct(
        ?Category $category = null,
        $translationId = null,
        $customerGroupId = null
    ) {
        $container = Shopware()->Container();

        $this->category = $category ?: Shopware()->Shop()->getCategory();
        $this->categoryId = $this->category->getId();
        $this->translationId = $translationId ?: (!Shopware()->Shop()->getDefault() ? Shopware()->Shop()->getId() : null);
        $this->customerGroupId = $customerGroupId ?: ((int) Shopware()->Modules()->System()->sUSERGROUPDATA['id']);

        $this->config = $container->get(Shopware_Components_Config::class);
        $this->db = $container->get('db');
        $this->connection = $container->get(Connection::class);
        $this->eventManager = $container->get('events');
        $this->contextService = $container->get(ContextServiceInterface::class);
        $this->listProductService = $container->get(ListProductServiceInterface::class);
        $this->productService = $container->get(ProductServiceInterface::class);
        $this->productNumberSearch = $container->get(ProductNumberSearchInterface::class);
        $this->configuratorService = $container->get(ConfiguratorServiceInterface::class);
        $this->propertyService = $container->get(PropertyServiceInterface::class);
        

    protected $session;

    /** * Pre dispatch method */
    public function preDispatch()
    {
        $this->module = Shopware()->Modules()->Basket();
        $this->session = Shopware()->Session();
        $this->Response()->setHeader('x-robots-tag', 'noindex');
    }

    public function infoAction()
    {
        $view = $this->View();

        $view->assign('userInfo', $this->get('shopware_account.store_front_greeting_service')->fetch());
        $view->assign('sBasketQuantity', isset($this->session->sBasketQuantity) ? $this->session->sBasketQuantity : 0);
        $view->assign('sBasketAmount', isset($this->session->sBasketAmount) ? $this->session->sBasketAmount : 0);
        
/** * @deprecated in 5.6, will be private in the future * * Helper function to get the sRewriteTable class with auto completion. * * @return sRewriteTable */
    public function RewriteTable()
    {
        trigger_error(sprintf('%s:%s is deprecated since Shopware 5.6 and will be private with 5.7.', __CLASS__, __METHOD__), E_USER_DEPRECATED);

        return Shopware()->Modules()->RewriteTable();
    }

    /** * Clean up seo links. remove links of non-existing categories, articles... */
    public function initSeoAction()
    {
        $shopId = (int) $this->Request()->getParam('shopId', 1);

        @set_time_limit(1200);

        
/** * Pre dispatch method */
    public function preDispatch()
    {
        $this->View()->setScope(Enlight_Template_Manager::SCOPE_PARENT);
        $this->View()->assign('userInfo', $this->get('shopware_account.store_front_greeting_service')->fetch());
    }

    public function postDispatch()
    {
        Shopware()->Session()->set('sNotesQuantity', Shopware()->Modules()->Basket()->sCountNotes());
    }

    /** * @return void */
    public function indexAction()
    {
        $view = $this->View();
        $view->assign('sNotes', Shopware()->Modules()->Basket()->sGetNotes());
        $view->assign('sUserLoggedIn', Shopware()->Modules()->Admin()->sCheckUser());
        $view->assign('sOneTimeAccount', Shopware()->Session()->offsetGet('sOneTimeAccount'));
    }
$paymentUniqueId,
                Shopware()->Session()->get('sUserId'),
            ]);

        if (empty($orderNumber)) {
            $user = $this->getUser();
            $basket = $this->getBasket();
            if (!\is_array($basket)) {
                throw new RuntimeException('Cart must not be empty at this point');
            }

            $order = Shopware()->Modules()->Order();
            $order->sUserData = $user;
            $order->sComment = Shopware()->Session()->get('sComment');
            $order->sBasketData = $basket;
            $order->sAmount = $basket[CheckoutKey::AMOUNT];
            $order->sAmountWithTax = !empty($basket[CartKey::AMOUNT_WITH_TAX_NUMERIC]) ? $basket[CartKey::AMOUNT_WITH_TAX_NUMERIC] : $basket[CartKey::AMOUNT_NUMERIC];
            $order->sAmountNet = $basket[CartKey::AMOUNT_NET_NUMERIC];
            $order->sShippingcosts = $basket[CheckoutKey::SHIPPING_COSTS];
            $order->sShippingcostsNumeric = $basket[CheckoutKey::SHIPPING_COSTS_WITH_TAX];
            $order->sShippingcostsNumericNet = $basket[CheckoutKey::SHIPPING_COSTS_NET];
            $order->bookingId = $transactionId;
            $order->dispatchId = Shopware()->Session()->get('sDispatch');
            
/** * Will be called when no action is supplied */
    public function indexAction()
    {
        $sTarget = $this->Request()->getParam('sTarget', 'account');
        $sTargetAction = $this->Request()->getParam('sTargetAction', 'index');

        $this->View()->assign([
            'sTarget' => $sTarget,
            'sTargetAction' => $sTargetAction,
            'sEsd' => Shopware()->Modules()->Basket()->sCheckForESD(),
            'showNoAccount' => $this->Request()->getParam('showNoAccount', false),
            'accountMode' => $this->Request()->getParam('skipLogin'),
        ]);

        if ($this->shouldRedirectToAccount()) {
            $this->forward('index', 'account');

            return;
        }

        if ($this->shouldRedirectToCheckout()) {
            
Shopware_Components_Modules $moduleManager = null,
        ?SlugInterface $slug = null,
        ?ContextServiceInterface $contextService = null,
        ?ShopPageServiceInterface $shopPageService = null,
        ?Shopware_Components_Translation $translationComponent = null
    ) {
        $this->db = $db ?: Shopware()->Db();
        $this->config = $config ?: Shopware()->Config();
        $this->modelManager = $modelManager ?: Shopware()->Models();
        $this->sSYSTEM = $systemModule ?: Shopware()->System();
        $this->template = $template ?: Shopware()->Template();
        $this->moduleManager = $moduleManager ?: Shopware()->Modules();
        $this->slug = $slug ?: Shopware()->Container()->get('shopware.slug');
        $this->contextService = $contextService ?: Shopware()->Container()->get(ContextServiceInterface::class);
        $this->shopPageService = $shopPageService ?: Shopware()->Container()
            ->get('shopware_storefront.shop_page_service');
        $this->translationComponent = $translationComponent ?: Shopware()->Container()->get(Shopware_Components_Translation::class);
    }

    /** * Getter function for retrieving last ID from sCreateRewriteTableArticles() * * @return string|null */
class Shopware_Controllers_Frontend_Compare extends Enlight_Controller_Action
{
    /** * @var sArticles */
    protected $articles;

    public function preDispatch()
    {
        $this->View()->setScope(Enlight_Template_Manager::SCOPE_PARENT);
        $this->articles = Shopware()->Modules()->Articles();
    }

    public function indexAction()
    {
        $this->View()->assign('sComparisons', $this->articles->sGetComparisons());
    }

    public function addArticleAction()
    {
        if (($productId = $this->Request()->getParam('articleID')) !== null) {
            $this->View()->assign('sCompareAddResult', $this->articles->sAddComparison($productId));
        }
protected TaxAggregatorInterface $taxAggregator;

    /** * Init method that get called automatically * * Set class properties * * @return void */
    public function init()
    {
        $this->admin = Shopware()->Modules()->Admin();
        $this->basket = Shopware()->Modules()->Basket();
        $this->session = Shopware()->Session();
        $this->taxAggregator = Shopware()->Container()->get(TaxAggregatorInterface::class);
    }

    public function getCSRFProtectedActions()
    {
        return [
            'ajaxAddArticle',
            'addArticle',
            'ajaxAddArticleCart',
            
 $viewport->getEndCol();
        }

        $identifier .= $el->getStartCol() . $el->getStartRow() . $el->getEndCol() . $el->getEndRow();

        return $identifier;
    }

    private function generateEmotionSeoUrls(Emotion $emotion): void
    {
        $seoIndexer = Shopware()->Container()->get('seoindex');
        $module = Shopware()->Modules()->RewriteTable();
        $shops = $emotion->getShops();
        $emotionData = [
            'id' => $emotion->getId(),
            'name' => $emotion->getName(),
        ];

        $translator = $this->getTranslation();
        $routerCampaignTemplate = Shopware()->Config()->get('routerCampaignTemplate');

        foreach ($shops as $shop) {
            $seoIndexer->registerShop($shop->getId());
            

        /** @var string $cacheDir */
        $cacheDir = Shopware()->Container()->getParameter('shopware.product_export.cache_dir');
        if (!is_dir($cacheDir)) {
            if (@mkdir($cacheDir, 0777, true) === false) {
                throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", 'Productexport', $cacheDir));
            }
        } elseif (!is_writable($cacheDir)) {
            throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", 'Productexport', $cacheDir));
        }

        $export = Shopware()->Modules()->Export();
        $export->sSYSTEM = Shopware()->System();
        $sSmarty = Shopware()->Template();

        $productFeedRepository = Shopware()->Models()->getRepository(ProductFeed::class);
        $activeFeeds = $productFeedRepository->getActiveListQuery()->getResult();
        foreach ($activeFeeds as $feedModel) {
            $fileName = $feedModel->getHash() . '_' . $feedModel->getFileName();
            $filePath = $cacheDir . $fileName;

            if ($feedModel->getInterval() === 0) {
                continue;
            }
Home | Imprint | This part of the site doesn't use cookies.