hasDifferentCustomerGroups example

$query->addState(self::STATE_INCLUDES_PSEUDO_PRICE_VARIANTS);
        }
    }

    public function setCriteria(Criteria $criteria)
    {
        $this->criteria = $criteria;
    }

    private function joinPrices(QueryBuilder $query, ShopContextInterface $context): void
    {
        $hasDifferentCustomerGroups = $this->hasDifferentCustomerGroups($context);

        $priceTable = $this->listingPriceHelper->getPriceTable($context);

        if ($hasDifferentCustomerGroups) {
            $priceTable->andWhere('IFNULL(customerPrice.`pseudoprice`, defaultPrice.`pseudoprice`) > 0');
        } else {
            $priceTable->andWhere('defaultPrice.pseudoprice > 0');
        }

        $query->innerJoin(
            'allVariants',
            
/** * @return \Doctrine\DBAL\Query\QueryBuilder */
    public function getPriceTable(ShopContextInterface $context)
    {
        $priceTable = $this->connection->createQueryBuilder();
        $priceTable->select($this->getDefaultPriceColumns());
        $priceTable->from('s_articles_prices', 'defaultPrice');
        $priceTable->where('defaultPrice.pricegroup = :fallbackCustomerGroup');

        if (!$this->hasDifferentCustomerGroups($context)) {
            return $priceTable;
        }

        $priceTable->select($this->getPriceSwitchColumns());
        $priceTable->leftJoin(
            'defaultPrice',
            's_articles_prices',
            'customerPrice',
            'customerPrice.articledetailsID = defaultPrice.articledetailsID AND customerPrice.articleID = defaultPrice.articleID AND customerPrice.pricegroup = :currentCustomerGroup'
        );
$query->addSelect('listing_price.*');
        $query->leftJoin('variant', '(' . $priceTable->getSQL() . ')', 'listing_price', implode(' AND ', $variantCondition));

        $query->andWhere('variant.laststock * variant.instock >= variant.laststock * variant.minpurchase');

        $query->andWhere('variant.active = 1');

        $query->setParameter(':fallbackCustomerGroup', $context->getFallbackCustomerGroup()->getKey());
        $query->setParameter(':priceGroupCustomerGroup', $context->getCurrentCustomerGroup()->getId());

        if ($this->hasDifferentCustomerGroups($context)) {
            $query->setParameter(':currentCustomerGroup', $context->getCurrentCustomerGroup()->getKey());
        }

        $query->addState(self::VARIANT_LISTING_PRICE_JOINED);
    }

    /** * @throws RuntimeException * @throws InvalidArgumentException */
    protected function joinSalePrices(QueryBuilder $query, ShopContextInterface $context, Criteria $criteria)
    {
if ($this->config->get('useLastGraduationForCheapestPrice')) {
            $query->andWhere("IF(priceGroup.id IS NOT NULL, prices.from = 1, prices.to = 'beliebig')");
        } else {
            $query->andWhere('prices.from = 1');
        }

        $query->groupBy('product.id');

        $query->setParameter(':fallbackCustomerGroup', $context->getFallbackCustomerGroup()->getKey());
        $query->setParameter(':priceGroupCustomerGroup', $context->getCurrentCustomerGroup()->getId());

        if ($this->hasDifferentCustomerGroups($context)) {
            $query->setParameter(':currentCustomerGroup', $context->getCurrentCustomerGroup()->getKey());
        }

        return $query;
    }

    /** * @return bool */
    private function hasDifferentCustomerGroups(ShopContextInterface $context)
    {
        
Home | Imprint | This part of the site doesn't use cookies.