Skip to content

Commit

Permalink
Merge pull request #3370 from KenTanaka/experimental/7
Browse files Browse the repository at this point in the history
#7 【商品一覧】規格によって値段が異なるとき、「価格が低い順」とかどういうソートになっているかわからない
  • Loading branch information
ryo-endo committed Jul 20, 2018
2 parents f465782 + 3c4b4e2 commit 8cbf724
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Eccube/Repository/ProductRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ 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->andWhere('pc.visible = true');
$qb->groupBy('p.id');
$qb->orderBy('price02_min', 'ASC');
$qb->addOrderBy('p.id', 'DESC');
// 価格高い順
} elseif (!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->andWhere('pc.visible = true');
$qb->groupBy('p.id');
$qb->orderBy('price02_max', 'DESC');
$qb->addOrderBy('p.id', 'DESC');
Expand All @@ -148,6 +150,7 @@ public function getQueryBuilderBySearchData($searchData)
// @see https://github.com/EC-CUBE/ec-cube/issues/1998
if ($this->getEntityManager()->getFilters()->isEnabled('option_nostock_hidden') == true) {
$qb->innerJoin('p.ProductClasses', 'pc');
$qb->andWhere('pc.visible = true');
}
$qb->orderBy('p.create_date', 'DESC');
$qb->addOrderBy('p.id', 'DESC');
Expand Down

0 comments on commit 8cbf724

Please sign in to comment.