getAssign example

$this->Front()->Plugins()->ViewRenderer()->setNoRender();

        $this->apiBaseUrl = $this->Request()->getScheme()
           . '://'
           . $this->Request()->getHttpHost()
           . $this->Request()->getBaseUrl()
           . '/api/';
    }

    public function postDispatch()
    {
        $data = $this->View()->getAssign();
        $pretty = $this->Request()->getParam('pretty', false);

        array_walk_recursive($datastatic function D&$value) {
            // Convert DateTime instances to ISO-8601 Strings             if ($value instanceof DateTime) {
                $value = $value->format(DateTime::ISO8601);
            }
        });

        $data = Zend_Json::encode($data);
        if ($pretty) {
            
$this->getToken($shopwareId$password);
        } catch (Exception $e) {
            $this->View()->assign([
                'success' => false,
                'message' => $e->getMessage(),
            ]);

            return;
        }

        $this->View()->assign('success', true);
        $message = $this->View()->getAssign('message');
        if (empty($message)) {
            $this->View()->assign('message', 'loginSuccessful');
        }
    }

    /** * Domain registration/retrieval action for first run wizard * Usually called after Shopware ID login/registration * * @throws Exception */
    
$errorTrace = $error->exception->getTraceAsString();
            $errorTrace = str_replace($path, '', $errorTrace);
            $this->View()->assign([
                'exception' => $exception,
                'error' => $exception->getMessage(),
                'error_message' => $exception->getMessage(),
                'error_file' => $errorFile,
                'error_trace' => $errorTrace,
            ]);
        }

        if ($this->View()->getAssign('success') !== null) {
            $this->Response()->setStatusCode(200);
            $this->View()->clearAssign('exception');
            $this->View()->assign('message', $error->exception->getMessage());
        }
    }

    /** * @return void */
    public function serviceAction()
    {
        


        if ($event) {
            return $this->get(Shopware_Components_Config::class)->get('defaultCustomerGroup', 'EK');
        }

        return $customerGroupKey;
    }

    private function getRegisterData(): array
    {
        $register = $this->View()->getAssign('register');
        if (!$register) {
            $register = [];
        }

        $session = $this->get('session');
        $register = array_replace_recursive([
            'personal' => [
                'sValidation' => $this->getCustomerGroupKey(),
            ],
            'billing' => [
                'country' => $session->offsetGet('sCountry'),
                
/** @var QueryAliasMapper $mapper */
        $mapper = $this->get(QueryAliasMapper::class);

        $controllerBlacklist = preg_replace('#\s#', '', $config['sSEOVIEWPORTBLACKLIST']);
        $controllerBlacklist = explode(',', $controllerBlacklist);

        $queryBlacklist = preg_replace('#\s#', '', $config['sSEOQUERYBLACKLIST']);
        $queryBlacklist = explode(',', $queryBlacklist);

        if (!empty($config['sSEOMETADESCRIPTION'])) {
            if (!empty($view->getAssign('sArticle')['metaDescription'])) {
                $metaDescription = $view->getAssign('sArticle')['metaDescription'];
            } elseif (!empty($view->getAssign('sArticle')['description'])) {
                $metaDescription = $view->getAssign('sArticle')['description'];
            } elseif (!empty($view->getAssign('sArticle')['description_long'])) {
                $metaDescription = $view->getAssign('sArticle')['description_long'];
            } elseif (!empty($view->getAssign('sCategoryContent')['metaDescription'])) {
                $metaDescription = $view->getAssign('sCategoryContent')['metaDescription'];
            } elseif (!empty($view->getAssign('sCategoryContent')['cmstext'])) {
                $metaDescription = $view->getAssign('sCategoryContent')['cmstext'];
            }
            if (!empty($metaDescription)) {
                


    /** * @return array */
    private function getBlogCacheIds(Request $request, View $view)
    {
        $cacheIds = [];

        $cacheIds[] = 'c' . (int) $request->getParam('sCategory');

        $blogPost = $view->getAssign('sArticle');
        foreach ($blogPost['assignedArticles'] as $article) {
            $cacheIds[] = 'a' . $article['id'];
        }

        return $cacheIds;
    }

    private function getAjaxListingCacheIds(Request $request, View $view)
    {
        $cacheIds = [];

        
return;
        }

        // If the attribute padding is a boolean true         if ($this->padding === true) {
            $this->padding = $request->getParam('callback');
            $this->padding = preg_replace('#[^0-9a-z_]+#i', '', (string) $this->padding);
        }

        // decide if we should render the data or the whole page         if ($this->renderer === true) {
            $content = $subject->View()->getAssign();
        } elseif (\is_string($this->padding) && $this->padding !== '') {
            $content = $response->getBody();
        } else {
            return;
        }

        // Convert content to json         $content = $this->convertToJson($content);

        if (\is_string($this->padding) && $this->padding !== '') {
            $response->setHeader('Content-type', 'text/javascript', true);
            
$session = $this->container->get('session');
        if ($session->get('sOneTimeAccount') && $this->Request()->has('sidebar')) {
            $this->admin->logout();
        }

        $this->addressRepository = $this->get(ModelManager::class)->getRepository(Address::class);
        $this->addressService = $this->get(AddressServiceInterface::class);

        $this->View()->assign('sUserLoggedIn', $this->admin->sCheckUser());

        if (!$this->View()->getAssign('sUserLoggedIn')) {
            $this->forward('index', 'register', 'frontend', $this->getForwardParameters());

            return;
        }

        $this->View()->assign('userInfo', $this->get('shopware_account.store_front_greeting_service')->fetch());
        $this->View()->assign('sUserData', $this->admin->sGetUserData());
        $this->View()->assign('sAction', $this->Request()->getActionName());
    }

    /** * Address listing */
$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);

        // Only show the listing if an emotion viewport is empty or the showListing option is active         if (!$this->loadListing($emotionConfiguration$request)) {
            return;
        }
|| $request->getModuleName() !== 'frontend'
            || !$view->hasTemplate()
        ) {
            return;
        }

        $view->assign('baseUrl', $request->getBaseUrl() . $request->getPathInfo());

        $shop = Shopware()->Shop();
        $view->assign('Controller', $args->getSubject()->Request()->getControllerName());

        $view->assign('sBasketQuantity', $view->getAssign('sBasketQuantity') ?: 0);
        $view->assign('sBasketAmount', $view->getAssign('sBasketAmount') ?: 0);
        $view->assign('sNotesQuantity', $view->getAssign('sNotesQuantity') ?: 0);
        $view->assign('sUserLoggedIn', $view->getAssign('sUserLoggedIn') ?: false);

        $view->assign('Shop', $shop);
        if (!$shop->getLocale() instanceof ShopLocale) {
            throw new RuntimeException('Shop does not have a locale set');
        }
        $view->assign('Locale', $shop->getLocale()->getLocale());

        $view->assign('sCategoryStart', $shop->getCategory()->getId());
        
$id = $this->Request()->getParam('sFid') ?: $this->Request()->getParam('id');
        $id = (int) $id;

        $view = $this->View();
        $view->assign('forceMail', (int) $this->Request()->getParam('forceMail'));
        $view->assign('id', $id);
        $view->assign('sSupport', $this->getContent($id));
        $view->assign('rand', Random::getAlphanumericString(32));

        $success = (bool) $this->Request()->getParam('success');
        if ($success) {
            $view->assign('sSupport', array_merge($view->getAssign('sSupport')['sElements' => []]));
        }

        $this->renderElementNote($view);

        $view->assign('success', $success);

        if ($this->Request()->isPost()) {
            $this->handleFormPost($id);
        }
    }

    
$response = $subject->Response();

        if (!$request->isDispatched() || $response->isException() || $request->getModuleName() !== 'frontend') {
            return;
        }

        $id = (int) $subject->Request()->getParam('sArticle');
        $view = $subject->View();
        /** @var SessionInterface $session */
        $session = $this->get('session');

        $sArticle = $view->getAssign('sArticle');

        $notificationVariants = [];

        $notificationProducts = $session->get('sNotificatedArticles', []);

        if (!empty($notificationProducts)) {
            $sql = 'SELECT `ordernumber` FROM `s_articles_details` WHERE `articleID`=?';
            $ordernumbers = $this->get(Connection::class)->fetchColumn($sql[$id]);

            if (!empty($ordernumbers)) {
                foreach ($ordernumbers as $ordernumber) {
                    

    }

    /** * Read and change payment mean and payment data * * @return void */
    public function paymentAction()
    {
        $this->View()->assign('sPaymentMeans', $this->admin->sGetPaymentMeans());
        $this->View()->assign('sFormData', ['payment' => $this->View()->getAssign('sUserData')['additional']['user']['paymentID']]);
        $this->View()->assign('sTarget', $this->Request()->getParam('sTarget', $this->Request()->getControllerName()));
        $this->View()->assign('sTargetAction', $this->Request()->getParam('sTargetAction', 'index'));

        $getPaymentDetails = $this->admin->sGetPaymentMeanById($this->View()->getAssign('sFormData')['payment']);

        $paymentClass = $this->admin->sInitiatePaymentClass($getPaymentDetails);
        if ($paymentClass instanceof BasePaymentMethod) {
            $data = $paymentClass->getCurrentPaymentDataAsArray(Shopware()->Session()->get('sUserId'));
            if (!empty($data)) {
                $this->View()->assign('sFormData', $this->View()->getAssign('sFormData') + $data);
            }
        }

    }

    /** * Read all data from objects / models that are required in cart view * (User-Data / Payment-Data / Basket-Data etc.) * * @return void */
    public function cartAction()
    {
        $accountMode = (int) ($this->View()->getAssign('sUserData')['additional']['user']['accountmode'] ?? Customer::ACCOUNT_MODE_CUSTOMER);
        $country = $this->getSelectedCountry();
        $this->View()->assign('sCountry', $country);
        $this->View()->assign('sPayment', $this->getSelectedPayment());
        $this->View()->assign('sDispatch', $this->getSelectedDispatch());
        $this->View()->assign('sCountryList', $this->getCountryList());
        $this->View()->assign('sPayments', $this->getPayments());
        $this->View()->assign('sDispatches', $this->getDispatches());
        $this->View()->assign('sDispatchNoOrder', $accountMode === Customer::ACCOUNT_MODE_CUSTOMER && $this->getDispatchNoOrder());
        $this->View()->assign('sState', $this->getSelectedState());

        $this->View()->assign('sUserData', $this->getUserData());
        

        $id = (int) $this->Request()->getParam('sArticle');
        $tpl = (string) $this->Request()->getParam('template');

        if ($id <= 0) {
            $this->forward('error');

            return;
        }

        $view = $this->View();
        $view->assign('sAction', $view->getAssign('sAction') ?: 'index', true);
        $view->assign('sErrorFlag', $view->getAssign('sErrorFlag') ?: [], true);
        $view->assign('sFormData', $view->getAssign('sFormData') ?: [], true);
        $view->assign('userLoggedIn', (bool) $this->container->get('session')->get('sUserId'));

        if (!empty($this->container->get('session')->get('sUserId')) && empty($this->Request()->get('sVoteName'))
            && $this->Request()->getParam('__cache') !== null) {
            $userData = $this->container->get('modules')->Admin()->sGetUserData();
            if (\is_array($userData)) {
                $view->assign('sFormData', [
                    'sVoteMail' => $userData['additional']['user']['email'],
                    'sVoteName' => $userData['billingaddress']['firstname'] . ' ' . $userData['billingaddress']['lastname'],
                ]);
Home | Imprint | This part of the site doesn't use cookies.