$builder->
from('s_articles_details', 'details'
);
$builder->
innerJoin('details', 's_articles', 'product', 'details.articleID = product.id'
);
$builder->
innerJoin('product', 's_articles_supplier', 'supplier', 'supplier.id = product.supplierID'
);
$builder->
leftJoin('details', 's_articles_prices', 'default_prices',
'details.id = default_prices.articledetailsID
AND default_prices.pricegroup = :defaultCustomerGroup
AND (:quantity >= default_prices.from AND (default_prices.to = :placeholderUpTo OR :quantity <= default_prices.to))'
);
$builder->
leftJoin('details', 's_articles_prices', 'customer_group_prices',
'details.id = customer_group_prices.articledetailsID
AND customer_group_prices.pricegroup = :customerGroup
AND (:quantity >= customer_group_prices.from AND (customer_group_prices.to = :placeholderUpTo OR :quantity <= customer_group_prices.to))'
);
$builder->
setParameters([ 'defaultCustomerGroup' => self::DEFAULT_CUSTOMER_GROUP,
'customerGroup' =>
$customerGroupKey,
'quantity' => self::DEFAULT_PRODUCT_QUANTITY,
'placeholderUpTo' => self::PLACEHOLDER_UP_TO,
]);
foreach ($this->
Request()->
getParam('filter',
[]) as $filter) { if ($filter['property'
] === 'free'
) { $builder->
andWhere( $builder->
expr()->
or( 'details.ordernumber LIKE :free',