getCustomerGroup example



    /** * Returns customer groups * * @return array */
    protected function getCustomerGroups()
    {
        $customergroups = ['EK'];

        $defaultCustomerGroupKey = Shopware()->Shop()->getCustomerGroup()->getKey();
        if (!empty($defaultCustomerGroupKey)) {
            $customergroups[] = $defaultCustomerGroupKey;
        }
        if (!empty(Shopware()->System()->sUSERGROUPDATA['groupkey'])) {
            $customergroups[] = Shopware()->System()->sUSERGROUPDATA['groupkey'];
        }
        $customergroups = array_unique($customergroups);

        return $customergroups;
    }
}
if (!$customer->getPaymentId()) {
            $customer->setPaymentId($this->config->get('defaultPayment'));
        }

        $subShop = $this->modelManager->find(ShopModel::class$shop->getId());
        if (!$subShop instanceof ShopModel) {
            throw new ModelNotFoundException(ShopModel::class$shop->getId());
        }
        $customer->setLanguageSubShop($subShop);

        if ($customer->getGroup() === null) {
            $customerGroup = $this->modelManager->find(Group::class$subShop->getCustomerGroup()->getId());
            if (!$customerGroup instanceof Group) {
                throw new ModelNotFoundException(Group::class$subShop->getCustomerGroup()->getId());
            }
            $customer->setGroup($customerGroup);
        }

        if ($customer->getAffiliate()) {
            $customer->setAffiliate((int) $this->getPartnerId($customer));
        } else {
            $customer->setAffiliate(0);
        }

        

        return $this->customerGroup;
    }

    public function getCustomerId(): string
    {
        return $this->getCustomer()->getId();
    }

    public function getCustomerGroupId(): string
    {
        return $this->getCustomerGroup()->getId();
    }
}


        $this->session->clear();
        $this->regenerateSessionId(true);

        if ($this->config->get('migrateCartAfterLogin')) {
            Shopware()->Container()->get(CartPersistServiceInterface::class)->persist();
        }

        $shop = Shopware()->Shop();

        $this->sSYSTEM->sUSERGROUP = $shop->getCustomerGroup()->getKey();
        $this->sSYSTEM->sUSERGROUPDATA = $shop->getCustomerGroup()->toArray();
        $this->sSYSTEM->sCurrency = $shop->getCurrency()->toArray();

        $this->contextService->initializeContext();

        $this->csrfTokenValidator->clearExistingCookie();

        if (!$this->config->get('clearBasketAfterLogout')) {
            $this->moduleManager->Basket()->sRefreshBasket();

            $countries = $this->sGetCountryList();
            
case 'parentID':
                if (!$this->getCategory() instanceof Category) {
                    throw new RuntimeException('Shop does not have a parent category set');
                }

                return $this->getCategory()->getId();
            case 'esi':
                return $this->getTemplate() !== null ? $this->getTemplate()->getEsi() : false;
            case 'navigation':
                return $this->getPages();
            case 'defaultcustomergroup':
                return $this->getCustomerGroup()->getKey();
            case 'defaultcurrency':
                return $this->getCurrency()->getId();
            case 'fallback':
                return $this->getFallback() !== null ? $this->getFallback()->getId() : null;
        }

        return null;
    }

    /** * @deprecated Shop::registerResources is deprecated since 5.6 and will be removed with 5.8. Use service ShopRegistrationService instead */

        return $this->customerGroup;
    }

    public function getCustomerId(): string
    {
        return $this->getCustomer()->getId();
    }

    public function getCustomerGroupId(): string
    {
        return $this->getCustomerGroup()->getId();
    }
}
public function convertProductPriceStruct(Price $price)
    {
        $data = $this->convertPriceStruct($price);
        $data['pseudopricePercent'] = null;
        $data['price'] = $this->formatPrice($price->getCalculatedPrice());
        $data['pseudoprice'] = $this->formatPrice($price->getCalculatedPseudoPrice());
        $data['referenceprice'] = $this->formatPrice($price->getCalculatedReferencePrice());
        $data['has_pseudoprice'] = $price->getCalculatedPseudoPrice() > $price->getCalculatedPrice();
        $data['price_numeric'] = $price->getCalculatedPrice();
        $data['pseudoprice_numeric'] = $price->getCalculatedPseudoPrice();
        $data['price_attributes'] = $price->getAttributes();
        $data['pricegroup'] = $price->getCustomerGroup()->getKey();
        $data['regulationPrice'] = $price->getCalculatedRegulationPrice();

        if ($price->getCalculatedPseudoPrice()) {
            $discount = 0;
            if ($price->getCalculatedPseudoPrice() != 0) {
                $discount = round(($price->getCalculatedPrice() / $price->getCalculatedPseudoPrice() * 100) - 100, 2) * -1;
            }

            $data['pseudopricePercent'] = [
                'int' => round($discount),
                'float' => $discount,
            ];
'accountmode' => $customer->getAccountMode(),
            'firstlogin' => $this->formatDate($customer->getFirstLogin()),
            'newsletter' => $customer->isNewsletter(),
            'shop_id' => $customer->getShopId(),
            'default_billing_address_id' => $customer->getDefaultBillingAddressId(),
            'title' => $customer->getTitle(),
            'salutation' => $customer->getSalutation(),
            'firstname' => $customer->getFirstname(),
            'lastname' => $customer->getLastname(),
            'birthday' => $this->formatDate($customer->getBirthday()),
            'customernumber' => $customer->getNumber(),
            'customer_group_id' => $customer->getCustomerGroup() ? $customer->getCustomerGroup()->getId() : null,
            'customer_group_name' => $customer->getCustomerGroup() ? $customer->getCustomerGroup()->getName() : '',
            'payment_id' => $customer->getPaymentId(),
            'company' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getCompany() : '',
            'department' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getDepartment() : '',
            'street' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getStreet() : '',
            'zipcode' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getZipcode() : '',
            'city' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getCity() : '',
            'phone' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getPhone() : '',
            'additional_address_line1' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getAdditionalAddressLine1() : '',
            'additional_address_line2' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getAdditionalAddressLine2() : '',
            'country_id' => $customer->getBillingAddress() ? $customer->getBillingAddress()->getCountryId() : null,
            
$shop = $shopRepository->getActiveById($this->sSettings['languageID']);
        if (!$shop instanceof Shop) {
            throw new ModelNotFoundException(Shop::class$this->sSettings['languageID']);
        }

        $this->shopData = $this->getShopData($this->sSettings['languageID']);

        if (empty($this->sSettings['categoryID'])) {
            $this->sSettings['categoryID'] = $this->shopData['category_id'];
        }
        if (empty($this->sSettings['customergroupID'])) {
            $this->sSettings['customergroupID'] = (int) $shop->getCustomerGroup()->getId();
        } else {
            $this->sSettings['customergroupID'] = (int) $this->sSettings['customergroupID'];
        }
        if (empty($this->sSettings['currencyID'])) {
            $this->sSettings['currencyID'] = $this->shopData['currency_id'];
        }

        $this->sCurrency = $this->sGetCurrency($this->sSettings['currencyID']);
        $this->sCustomergroup = $this->sGetCustomergroup($this->sSettings['customergroupID']);

        $this->articleMediaAlbum = $this->getMediaRepository()
            

        return $this->getShop()->getCurrency()->getId();
    }

    private function getStoreFrontCurrentCustomerGroupKey(): string
    {
        $session = $this->container->get('session');
        if ($session->offsetExists('sUserGroup') && $session->offsetGet('sUserGroup')) {
            return $session->offsetGet('sUserGroup');
        }

        return $this->getShop()->getCustomerGroup()->getKey();
    }

    private function getStoreFrontAreaId(): ?int
    {
        $session = $this->container->get('session');
        if ($session->offsetGet('sArea')) {
            return $session->offsetGet('sArea');
        }

        return null;
    }

    
/** @var Shopware_Plugins_Frontend_Statistics_Bootstrap $plugin */
                $plugin = Shopware()->Plugins()->Frontend()->Statistics();
                Shopware()->Session()->set('Bot', $plugin->checkIsBot($request->getHeader('USER_AGENT') ?: ''));
            }
            $system->sBotSession = Shopware()->Session()->get('Bot');
        }

        if (Shopware()->Container()->initialized('shop')) {
            $shop = Shopware()->Shop();
            $system->sCurrency = $shop->getCurrency()->toArray();

            $system->sUSERGROUP = $shop->getCustomerGroup()->getKey();
            $system->sUSERGROUPDATA = $shop->getCustomerGroup()->toArray();
            $config->offsetSet('defaultCustomerGroup', $system->sUSERGROUP);

            $config['sCURRENCY'] = $system->sCurrency['currency'];
            $config['sCURRENCYHTML'] = $system->sCurrency['symbol'];
        }

        if (Shopware()->Container()->initialized('session')) {
            if (!empty(Shopware()->Session()->get('sUserGroup'))
                    && Shopware()->Session()->get('sUserGroup') !== $system->sUSERGROUP) {
                $system->sUSERGROUP = Shopware()->Session()->get('sUserGroup');
                
/** * {@inheritdoc} */
    public function generate(Shop $shop)
    {
        if (!$this->sitemapLock->doLock($shop$this->shopwareConfig->get('sitemapRefreshTime'))) {
            throw new AlreadyLockedException(sprintf('Cannot acquire lock for shop %d', $shop->getId()));
        }

        $routerContext = Context::createFromShop($shop$this->shopwareConfig);
        $shopContext = $this->contextService->createShopContext($shop->getId()$shop->getCurrency()->getId()$shop->getCustomerGroup()->getKey());

        foreach ($this->urlProvider as $urlProvider) {
            $urlProvider->reset();
            while ($urls = $urlProvider->getUrls($routerContext$shopContext)) {
                $urls = $this->urlFilter->filter($urls(int) $shop->getId());

                if (!$urls) {
                    continue;
                }

                $this->sitemapWriter->writeFile($shop$urls);
            }

    public function getUnit()
    {
        return $this->rule->getUnit();
    }

    /** * @return Group */
    public function getCustomerGroup()
    {
        return $this->rule->getCustomerGroup();
    }

    /** * @return int */
    public function getFrom()
    {
        return $this->rule->getFrom();
    }

    /** * @return int|null */
return substr($requestUri, \strlen($url));
            default:
                return $requestUri;
        }
    }

    /** * @throws RuntimeException */
    private function validateShop(Shop $shop): void
    {
        if (!$shop->getCustomerGroup() instanceof CustomerGroup) {
            throw new RuntimeException(sprintf("Shop '%s (id: %s)' has no customer group.", $shop->getName()$shop->getId()));
        }

        $shop->getCurrency();
        $shop->getLocale();

        $mainShop = $shop->getMain() ?? $shop;
        if (!$mainShop->getTemplate()) {
            throw new RuntimeException(sprintf("Shop '%s (id: %s)' has no template.", $shop->getName()$shop->getId()));
        }

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