diff --git a/data/class/SC_Product.php b/data/class/SC_Product.php index 2be0ac0aa0..1c2e0f60e3 100644 --- a/data/class/SC_Product.php +++ b/data/class/SC_Product.php @@ -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; } diff --git a/tests/class/SC_Product/SC_Product_findProductIdsOrderTest.php b/tests/class/SC_Product/SC_Product_findProductIdsOrderTest.php index 05af1f994b..a21b6d48bf 100644 --- a/tests/class/SC_Product/SC_Product_findProductIdsOrderTest.php +++ b/tests/class/SC_Product/SC_Product_findProductIdsOrderTest.php @@ -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); @@ -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); @@ -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);