Skip to content

Commit

Permalink
Merge pull request #2944 from chihiro-adachi/fix-product-repo
Browse files Browse the repository at this point in the history
商品一覧画面のクエリ改善
  • Loading branch information
okazy authored Apr 18, 2018
2 parents 94f74e5 + 48e0b15 commit 5dc6f73
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Eccube/Repository/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,14 @@ public function getQueryBuilderBySearchData($searchData)
//@see http://doctrine-orm.readthedocs.org/en/latest/reference/dql-doctrine-query-language.html
$qb->addSelect('MIN(pc.price02) as HIDDEN price02_min');
$qb->innerJoin('p.ProductClasses', 'pc');
$qb->groupBy('p');
// postgres9.0以下は, groupBy('p.id')が利用できない
// mysqlおよびpostgresql9.1以上であればgroupBy('p.id')にすることで性能向上が期待できる.
// @see https://github.com/EC-CUBE/ec-cube/issues/1904
// $qb->groupBy('p.id');
$qb->groupBy('p.id');
$qb->orderBy('price02_min', 'ASC');
$qb->addOrderBy('p.id', 'DESC');
// 価格高い順
} else if (!empty($searchData['orderby']) && $searchData['orderby']->getId() == $config['eccube_product_order_price_higher']) {
$qb->addSelect('MAX(pc.price02) as HIDDEN price02_max');
$qb->innerJoin('p.ProductClasses', 'pc');
$qb->groupBy('p');
$qb->groupBy('p.id');
$qb->orderBy('price02_max', 'DESC');
$qb->addOrderBy('p.id', 'DESC');
// 新着順
Expand Down

0 comments on commit 5dc6f73

Please sign in to comment.