Hier nun die (nicht updatesicheren) Änderungen in folgenden Dateien:
\engine\Shopware\Bundle\SearchBundleDBAL\ConditionHandler\PriceConditionHandler.php
public function generateCondition(...) {
...
/*$query->innerJoin('product', '(' . $table->getSQL() . ')', 'listing_price', 'listing_price.articleID = product.id');*/
$query->innerJoin('product', 's_articles_prices', 'listing_price', 'listing_price.articleID = product.id');
/** @var PriceCondition $condition */
if ($condition->getMaxPrice() > 0 && $condition->getMinPrice() > 0) {
/*$query->andWhere('listing_price.cheapest_price BETWEEN ' . $minKey . ' AND ' . $maxKey);*/
$query->andWhere('listing_price.price BETWEEN ' . $minKey . ' AND ' . $maxKey);
...}
if ($condition->getMaxPrice() > 0) {
/*$query->andWhere('listing_price.cheapest_price <= ' . $maxKey);*/
$query->andWhere('listing_price.price <= ' . $maxKey);
$query->setParameter($maxKey, $condition->getMaxPrice());
...}
if ($condition->getMinPrice() > 0) {
/*$query->andWhere('listing_price.cheapest_price >= ' . $minKey);*/
$query->andWhere('listing_price.price >= ' . $minKey);
$query->setParameter($minKey, $condition->getMinPrice());
...}
}
\engine\Shopware\Bundle\SearchBundleDBAL\ConditionHandler\HasPseudoPriceConditionHandler.php
public function generateCondition(...) {
...
/*$query->innerJoin('product', '(' . $table->getSQL() . ')', 'listing_price',
listing_price.articleID = product.id');*/
$query->innerJoin('product', 's_articles_prices', 'listing_price', 'listing_price.articleID = product.id');
...
/*$query->andWhere('listing_price.pseudoprice > 0');*/
$query->andWhere('listing_price.price > 0');
}
\engine\Shopware\Bundle\SearchBundleDBAL\FacetHandler\PriceFacetHandler.php
public function generatePartialFacet(...) {
...
/* $query->innerJoin('product', '(' . $table->getSQL() . ')', 'listing_price', 'listing_price.articleID = product.id'); */
$query->innerJoin('product', 's_articles_prices', 'listing_price', 'listing_price.articleID = product.id');
...
/* $query->select('MIN(listing_price.cheapest_price)'); */
$query->select('MIN(listing_price.price)');
/** @var $statement \Doctrine\DBAL\Driver\ResultStatement */
$statement = $query->execute();
$min = $statement->fetch(\PDO::FETCH_COLUMN);
$query->groupBy('product.id')
/* ->orderBy('listing_price.cheapest_price', 'DESC') */
->orderBy('listing_price.price', 'DESC')
...}
\engine\Shopware\Bundle\SearchBundleDBAL\SortingHandler\PriceSortingHandler.php
public function generateSorting(...) {
if (!$query->hasState(PriceConditionHandler::LISTING_PRICE_JOINED)) {
$table = $this->listingPriceTable->get($context);
/*$query->innerJoin('product', '(' . $table->getSQL() . ')', 'listing_price', 'listing_price.articleID = product.id');*/
foreach ($table->getParameters() as $key => $value) {
$query->setParameter($key, $value);}
query->innerJoin('product', 's_articles_prices', 'listing_price', 'listing_price.articleID = product.id');
$query->addState(PriceConditionHandler::LISTING_PRICE_JOINED);}
...
}
Nächste Aufgabe ist nun, das Ganze updatesicher zu gestalten.