sGetUserData 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);

        


    /** * Get all available payments * * @return array<array<string, mixed>> Payments data */
    public function sGetPaymentMeans()
    {
        $isMobile = $this->front->Request()->getDeviceType() === 'mobile';

        $user = $this->sGetUserData();
        if (!\is_array($user)) {
            throw new RuntimeException('Could not get customer data');
        }

        $sEsd = $this->moduleManager->Basket()->sCheckForESD();

        $countryID = (int) ($user['additional']['countryShipping']['id'] ?? 0);
        $subShopID = (int) $this->contextService->getShopContext()->getShop()->getId();
        if (empty($countryID)) {
            $countryID = $this->db->fetchOne(
                'SELECT id FROM s_core_countries ORDER BY position ASC LIMIT 1'
            );
 catch (Exception $e) {
            $this->db->rollBack();
            throw new Enlight_Exception(sprintf('Shopware Order Fatal-Error %s :%s', $_SERVER['HTTP_HOST']$e->getMessage()), 0, $e);
        }

        if (!$affectedRows || !$orderID) {
            throw new Enlight_Exception(sprintf('Shopware Order Fatal-Error %s : No rows affected or no order id created.', $_SERVER['HTTP_HOST']), 0);
        }

        try {
            $paymentData = Shopware()->Modules()->Admin()
                ->sGetPaymentMeanById($this->getPaymentId()Shopware()->Modules()->Admin()->sGetUserData());
            $paymentClass = Shopware()->Modules()->Admin()->sInitiatePaymentClass($paymentData);
            if ($paymentClass instanceof BasePaymentMethod) {
                $paymentClass->createPaymentInstance(
                    $orderID,
                    $this->sUserData['additional']['user']['id'],
                    $this->getPaymentId()
                );
            }
        } catch (Exception $e) {
            // Payment method code failure         }

        

    public function sRefreshBasket()
    {
        // Update basket data         $this->moduleManager->Admin()->sGetUserData();
        $this->sGetBasket();
        $this->moduleManager->Admin()->sGetPremiumShippingcosts();

        // Update basket data in session         $this->session->offsetSet('sBasketCurrency', Shopware()->Shop()->getCurrency()->getId());
        $this->session->offsetSet('sBasketQuantity', $this->sCountBasket());
        $amount = $this->sGetAmount();
        $this->session->offsetSet('sBasketAmount', empty($amount) ? 0 : array_shift($amount));
    }

    /** * Checks if the vouchers on the current basket have already been used. * Return true if the current cart doesn't have a voucher or if the voucher is valid * Returns false if the current voucher has already been used. * * @param string $sessionId * @param int $userId * * @return bool */
$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 */
    public function indexAction()
    {
        $addresses = $this->addressRepository->getListArray(
            $this->container->get('session')->get('sUserId')
        );

        
$this->customerService = Shopware()->Container()->get(CustomerServiceInterface::class);
    }

    public function preDispatch()
    {
        $this->View()->setScope(Smarty::SCOPE_PARENT);
        if ($this->shouldForwardToRegister()) {
            $this->forward('index', 'register', 'frontend', $this->getForwardParameters());

            return;
        }
        $customerData = $this->admin->sGetUserData();
        if (!\is_array($customerData)) {
            $this->forward('index', 'register', 'frontend', $this->getForwardParameters());

            return;
        }

        $this->response->headers->addCacheControlDirective('no-store');
        $this->response->headers->addCacheControlDirective('no-cache');

        $activeBillingAddressId = $customerData['additional']['user']['default_billing_address_id'] ?? null;
        $activeShippingAddressId = $customerData['additional']['user']['default_shipping_address_id'] ?? null;

        
$this->forward('shippingPayment');

            return;
        }

        // Save payment method details to db         if ($checkData['sPaymentObject'] instanceof BasePaymentMethod) {
            $checkData['sPaymentObject']->savePaymentData(Shopware()->Session()->get('sUserId')$this->Request());
        }

        // Save the payment info         $customerData = Shopware()->Modules()->Admin()->sGetUserData();
        if (!\is_array($customerData)) {
            throw new RuntimeException('Could not get customer data');
        }
        $previousPayment = $customerData['additional']['user']['paymentID'];

        $previousPayment = $this->admin->sGetPaymentMeanById($previousPayment);
        if ($previousPayment['paymentTable']) {
            Shopware()->Db()->delete(
                $previousPayment['paymentTable'],
                ['userID = ?' => Shopware()->Session()->get('sUserId')]
            );
        }
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'],
                ]);
            }
        }

        $number = $this->Request()->getParam('number');
        $selection = $this->Request()->getParam('group', []);

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