Skip to content

Commit

Permalink
Merge pull request #261 from shutta-/#93
Browse files Browse the repository at this point in the history
Fix issue of #93 商品一覧の価格順並び替えが登録されていない商品規格に影響される
  • Loading branch information
Chihiro Adachi authored Apr 26, 2019
2 parents 0b0edd7 + 9be6bd5 commit b07915c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions data/class/SC_Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public function findProductIdsOrder(&$objQuery, $arrVal = array())
$o_table = $this->arrOrderData['table'];
$o_order = $this->arrOrderData['order'];
$objQuery->setOrder("T2.$o_col $o_order");
$sub_sql = $objQuery->getSql($o_col, "$o_table AS T2", 'T2.product_id = alldtl.product_id');
$sub_sql = $objQuery->getSql($o_col, "$o_table AS T2", 'T2.product_id = alldtl.product_id AND T2.del_flg = 0');
$sub_sql = $objQuery->dbFactory->addLimitOffset($sub_sql, 1);

$objQuery->setOrder("($sub_sql) $o_order, product_id");
}
$arrReturn = $objQuery->getCol('alldtl.product_id', $table, '', $arrVal);
$arrReturn = $objQuery->getCol('alldtl.product_id', $table, 'alldtl.del_flg = 0', $arrVal);

return $arrReturn;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/class/SC_Product/SC_Product_findProductIdsOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testFindProductIdsOrder_商品ID降順()
{
// 商品ID降順で商品IDを取得する
$this->objQuery->setOrder('product_id DESC');
$this->expected = array('2001','1002', '1001');
$this->expected = array('1002', '1001');

$this->actual = $this->objProducts->findProductIdsOrder($this->objQuery);

Expand All @@ -37,7 +37,7 @@ public function testFindProductIdsOrder_商品名昇順()
{
// 商品名昇順で商品IDを取得する
$this->objQuery->setOrder('product_id ASC');
$this->expected = array('1001', '1002','2001');
$this->expected = array('1001', '1002');

$this->actual = $this->objProducts->findProductIdsOrder($this->objQuery);

Expand All @@ -48,7 +48,7 @@ public function testFindProductIdsOrder_arrOrderDataの設定による並び順(
{
// setProductsOrderを行う
$this->objProducts->setProductsOrder('product_id');
$this->expected = array('1001', '1002','2001');
$this->expected = array('1001', '1002');

$this->actual = $this->objProducts->findProductIdsOrder($this->objQuery);

Expand Down

0 comments on commit b07915c

Please sign in to comment.