/** * @param Product $objProduct */ public function lfGetProductsList($searchCondition, $disp_number, $startno, &$objProduct) { $objQuery = Application::alias('eccube.query'); $arrOrderVal = array(); // 表示順序 switch ($this->orderby) { // 販売価格が安い順 case 'price': $objProduct->setProductsOrder('price02', 'dtb_products_class', 'ASC'); break; // 新着順 // 新着順 case 'date': $objProduct->setProductsOrder('create_date', 'dtb_products', 'DESC'); break; default: if (strlen($searchCondition['where_category']) >= 1) { $dtb_product_categories = '(SELECT * FROM dtb_product_categories WHERE ' . $searchCondition['where_category'] . ')'; $arrOrderVal = $searchCondition['arrvalCategory']; } else { $dtb_product_categories = 'dtb_product_categories'; } $col = 'MAX(T3.rank * 2147483648 + T2.rank)'; $from = "{$dtb_product_categories} T2 JOIN dtb_category T3 ON T2.category_id = T3.category_id"; $where = 'T2.product_id = alldtl.product_id'; $sub_sql = $objQuery->getSql($col, $from, $where); $objQuery->setOrder("({$sub_sql}) DESC ,product_id DESC"); break; } // 取得範囲の指定(開始行番号、行数のセット) $objQuery->setLimitOffset($disp_number, $startno); $objQuery->setWhere($searchCondition['where']); // 表示すべきIDとそのIDの並び順を一気に取得 $arrProductId = $objProduct->findProductIdsOrder($objQuery, array_merge($searchCondition['arrval'], $arrOrderVal)); $objQuery = Application::alias('eccube.query'); $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId); // 規格を設定 $objProduct->setProductsClassByProductIds($arrProductId); $arrProducts['productStatus'] = $objProduct->getProductStatus($arrProductId); return $arrProducts; }