getShop example



        if ($request !== null) {
            return $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();
        }

        return 'http://' . $config->get('basePath');
    }

    private function getStoreFrontShopId(): int
    {
        return $this->getShop()->getId();
    }

    private function getStoreFrontCurrencyId(): int
    {
        return $this->getShop()->getCurrency()->getId();
    }

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

    /** * @return Criteria */
    private function getSearchCriteria(Request $request, ShopContextInterface $context)
    {
        $criteria = $this->createCriteriaFromRequest($request$context);

        $systemId = $context->getShop()->getCategory()->getId();

        if (!$criteria->hasBaseCondition('category')) {
            $criteria->addBaseCondition(new CategoryCondition([$systemId]));

            return $criteria;
        }

        /** @var CategoryCondition $condition */
        $condition = $criteria->getBaseCondition('category');

        if (!\in_array($systemId$condition->getCategoryIds())) {
            
$this->storeFrontCriteriaFactory = $storeFrontCriteriaFactory;
        $this->connection = $connection;
        $this->batchSize = $batchSize;
    }

    /** * {@inheritdoc} */
    public function getUrls(Context $routingContext, ShopContextInterface $shopContext)
    {
        $criteria = $this->storeFrontCriteriaFactory
            ->createBaseCriteria([$shopContext->getShop()->getCategory()->getId()]$shopContext);
        $criteria->setFetchCount(false);
        $criteria->limit($this->batchSize);

        if ($this->lastId) {
            $criteria->addBaseCondition(new LastProductIdCondition($this->lastId));
        }

        $productNumberSearchResult = $this->productNumberSearch->search($criteria$shopContext);

        if (\count($productNumberSearchResult->getProducts()) === 0) {
            return [];
        }
return 0;
        }

        $result = null;

        /** @var LicenceStruct $licence */
        foreach ($licences as $licence) {
            $result[] = [
                'technicalName' => $licence->getTechnicalName(),
                'label' => $licence->getLabel(),
                'domain' => $licence->getShop(),
                'createDate' => $licence->getCreationDate()->format('Y-m-d'),
                'type' => $licence->getPriceModel()->getType(),
            ];
        }

        $table = new Table($output);
        $table->setHeaders(['Technical name', 'Description', 'domain', 'Creation date', 'Type'])
              ->setRows($result);

        $table->render();

        
ProductQueryFactoryInterface $queryFactory,
        VariantHelperInterface $variantHelper
    ) {
        $this->client = $client;
        $this->provider = $provider;
        $this->queryFactory = $queryFactory;
        $this->variantHelper = $variantHelper;
    }

    public function populate(ShopIndex $index, ProgressHelperInterface $progress)
    {
        $categoryId = $index->getShop()->getCategory()->getId();
        $idQuery = $this->queryFactory->createCategoryQuery($categoryId, 100);
        $progress->start($idQuery->fetchCount(), 'Indexing products');

        while ($ids = $idQuery->fetch()) {
            if (!$this->variantHelper->getVariantFacet()) {
                $query = $this->queryFactory->createProductIdQuery($ids);
                $numbers = $query->fetch();
            } else {
                $numbers = $ids;
            }

            
public function __construct(HrefLangServiceInterface $hrefLangService, Cache $cache)
    {
        $this->hrefLangService = $hrefLangService;
        $this->cache = $cache;
    }

    /** * {@inheritdoc} */
    public function getUrls(array $parameters, ShopContextInterface $contextService)
    {
        $shop = $contextService->getShop();
        $cacheKey = md5(json_encode($parameters) . ($shop->getParentId() ?: $shop->getId()));

        if ($urls = $this->cache->load($cacheKey)) {
            return $urls;
        }

        $urls = $this->hrefLangService->getUrls($parameters$contextService);

        $this->cache->save($urls$cacheKey[CacheManager::ITEM_TAG_CONFIG], 86400);

        return $urls;
    }
return;
        }

        /** @var FormInterface<Customer> $form */
        $form = $this->context->getRoot();

        $customer = $form->getData();

        $accountMode = $this->getAccountMode($form);

        $emailConstraint = new CustomerEmail([
            'shop' => $constraint->getShop(),
            'customerId' => $customer->getId(),
            'accountMode' => $accountMode,
        ]);

        $this->customerEmailValidator->initialize($this->context);
        $this->customerEmailValidator->validate($email$emailConstraint);

        if ($form->has('emailConfirmation') && $form->get('emailConfirmation')->getData() !== $email) {
            $error = new FormError($this->getSnippet());
            $error->setOrigin($form->get('emailConfirmation'));
            $form->addError($error);
        }

    private function filterSubShopVoucher($voucherDetails)
    {
        $sErrorMessages = [];

        if (!empty($voucherDetails['subshopID'])) {
            if ($this->contextService->getShopContext()->getShop()->getId() !== (int) $voucherDetails['subshopID']) {
                $sErrorMessages[] = $this->snippetManager->getNamespace('frontend/basket/internalMessages')->get(
                    'VoucherFailureNotFound',
                    'Voucher could not be found or is not valid anymore'
                );
            }
        }

        return $sErrorMessages;
    }

    /** * Filter voucher by customer group * * @param int $userId The current user id * @param array $voucherDetails The voucher details * * @return array Messages for detected errors */
/** * @return Criteria */
    public function createCriteria(Request $request, ShopContextInterface $context)
    {
        $criteria = $this->criteriaFactory->createListingCriteria($request$context);

        $criteria->removeBaseCondition('category');
        $criteria->resetFacets();

        $category = $context->getShop()->getCategory()->getId();
        $criteria->addBaseCondition(new CategoryCondition([$category]));

        return $criteria;
    }
}


    /** * {@inheritdoc} */
    public function getUrls(Context $routingContext, ShopContextInterface $shopContext)
    {
        if ($this->allExported) {
            return [];
        }

        $shopId = $shopContext->getShop()->getId();
        $parentId = $shopContext->getShop()->getCategory()->getId();

        $query = $this->modelManager->getRepository(Category::class)->getBlogCategoriesByParentQuery($parentId);
        $blogCategories = $query->getArrayResult();

        $blogIds = [];

        foreach ($blogCategories as $blogCategory) {
            $blogIds[] = (int) $blogCategory['id'];
        }

        
return new BooleanFacetResult(
            $facet->getName(),
            $facet->getFormFieldName(),
            $criteria->hasCondition($facet->getName()),
            $facet->getLabel()
        );
    }

    private function addTranslations(QueryBuilder $query, ShopContextInterface $context): void
    {
        if ($context->getShop()->isDefault()) {
            return;
        }

        $query
            ->addSelect('attributeTranslations.objectdata as __attribute_translation')
            ->leftJoin(
                'product',
                's_core_translations',
                'attributeTranslations',
                'attributeTranslations.objectkey = product.id AND attributeTranslations.objecttype = "article" AND attributeTranslations.objectlanguage = :language'
            )
        ;
/** @var Address $billing */
        $billing = $billingForm->getData();

        $config = $this->container->get(Shopware_Components_Config::class);

        $accountMode = (int) $customer->getAccountMode();
        $doubleOptinWithAccount = ($accountMode === 0) && $config->get('optinregister');
        $doubleOptInAccountless = ($accountMode === 1) && $config->get('optinaccountless');

        $doubleOptinRegister = $doubleOptinWithAccount || $doubleOptInAccountless;
        $shop = $context->getShop();
        $shop->addAttribute('sendOptinMail', new Attribute([
            'sendOptinMail' => $doubleOptinRegister,
        ]));

        $customer->setReferer((string) $session->offsetGet('sReferer'));
        $customer->setValidation((string) ($data['register']['personal']['sValidation'] ?? ''));
        $customer->setAffiliate((int) $session->offsetGet('sPartner'));
        $customer->setPaymentId((int) $session->offsetGet('sPaymentID'));
        $customer->setDoubleOptinRegister($doubleOptinRegister);
        $customer->setDoubleOptinConfirmDate(null);

        

    protected function getContent($formId)
    {
        $fields = [];
        $labels = [];

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

        $modelManager = $this->getModelManager();
        $query = $modelManager->getRepository(Form::class)->getActiveFormQuery($formId$shopId);

        $form = $query->getOneOrNullResult(AbstractQuery::HYDRATE_OBJECT);

        if (!$form instanceof Form) {
            throw new Enlight_Controller_Exception(
                'Form not found',
                Enlight_Controller_Exception::Controller_Dispatcher_Controller_Not_Found
            );
        }
'name' => $modelName]
            );
            if (!$mailModel instanceof Mail) {
                throw new Enlight_Exception(sprintf('Mail-Template with name "%s" could not be found.', $modelName));
            }
        }

        $config = Shopware()->Config();
        $inheritance = Shopware()->Container()->get('theme_inheritance');
        $eventManager = Shopware()->Container()->get('events');

        if ($this->getShop() !== null) {
            $defaultContext = [
                'sConfig' => $config,
                'sShop' => $config->get('shopName'),
                'sShopURL' => ($this->getShop()->getSecure() ? 'https://' : 'http://') . $this->getShop()->getHost() . $this->getShop()->getBaseUrl(),
            ];

            // Add theme to the context if given shop (or its main shop) has a template.             $theme = null;
            if ($this->getShop()->getTemplate()) {
                $theme = $inheritance->buildConfig($this->getShop()->getTemplate()$this->getShop(), false);
            } elseif ($this->getShop()->getMain() && $this->getShop()->getMain()->getTemplate()) {
                
return false;
        }

        if ($this->config->get('hideNoInStock') && !$product->isAvailable() && !$product->hasAvailableVariant()) {
            return false;
        }

        $ids = array_map(function DCategory $category) {
            return $category->getId();
        }$product->getCategories());

        return \in_array($context->getShop()->getCategory()->getId()$ids);
    }

    private function allowBuyInListing(ListProduct $product): bool
    {
        return !$product->hasConfigurator()
            && $product->isAvailable()
            && $product->getUnit()
            && $product->getUnit()->getMinPurchase() <= 1
            && !$product->displayFromPrice();
    }

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