andX example


        $sessionId = $this->session->get('sessionId');
        if (!\is_string($sessionId)) {
            return false;
        }

        $qb = $this->connection->createQueryBuilder();
        $qb
            ->select(['product.taxID'])
            ->from('s_order_basket', 'basket')
            ->join('basket', 's_articles', 'product', 'product.id = basket.articleID')
            ->where($qb->expr()->andX(
                $qb->expr()->eq('basket.sessionID', ':sessionId'),
                $qb->expr()->eq('basket.modus', CartPositionsMode::PRODUCT)
            ))
            ->orderBy('basket.tax_rate', 'DESC')
            ->setMaxResults(1)
            ->setParameter('sessionId', $sessionId)
        ;

        $this->eventManager->notify(
            'Shopware_Modules_Basket_GetMaxTax_QueryBuilder',
            [
                
protected static function exprIf($condition$expression1$expression2)
    {
        return " if (($condition),($expression1),($expression2)) ";
    }

    private function addSorting(ProductNameSorting $sorting, QueryBuilder $query, ShopContextInterface $context): void
    {
        $query->leftJoin(
            self::PRODUCT,
            's_articles_translations',
            self::TRANSLATION,
            $query->expr()->andX(
                $query->expr()->eq(self::TRANSLATION . '.articleID', self::PRODUCT . '.id'),
                $query->expr()->eq(self::TRANSLATION . '.languageID', $context->getShop()->getId()),
                $query->expr()->isNotNull(self::TRANSLATION_NAME),
                $query->expr()->neq(self::TRANSLATION_NAME, $query->expr()->literal(''))
            )
        );

        $query->addOrderBy(
            self::exprIf(
                $query->expr()->isNull(self::TRANSLATION_NAME),
                self::PRODUCT . '.name',
                
Home | Imprint | This part of the site doesn't use cookies.