[15342] | 1 | <?php |
---|
| 2 | /* |
---|
[16582] | 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[22206] | 5 | * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. |
---|
[15342] | 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
[16582] | 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License |
---|
| 11 | * as published by the Free Software Foundation; either version 2 |
---|
| 12 | * of the License, or (at your option) any later version. |
---|
| 13 | * |
---|
| 14 | * This program is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this program; if not, write to the Free Software |
---|
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
[15342] | 22 | */ |
---|
| 23 | |
---|
| 24 | // {{{ requires |
---|
[20534] | 25 | require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php'; |
---|
[15342] | 26 | |
---|
| 27 | /** |
---|
| 28 | * 商品管理 のページクラス. |
---|
| 29 | * |
---|
| 30 | * @package Page |
---|
| 31 | * @author LOCKON CO.,LTD. |
---|
[20016] | 32 | * @version $Id$ |
---|
[15342] | 33 | */ |
---|
[22567] | 34 | class LC_Page_Admin_Products extends LC_Page_Admin_Ex |
---|
| 35 | { |
---|
[15342] | 36 | |
---|
| 37 | // }}} |
---|
| 38 | // {{{ functions |
---|
| 39 | |
---|
| 40 | /** |
---|
| 41 | * Page を初期化する. |
---|
| 42 | * |
---|
| 43 | * @return void |
---|
| 44 | */ |
---|
[22567] | 45 | function init() |
---|
| 46 | { |
---|
[15342] | 47 | parent::init(); |
---|
| 48 | $this->tpl_mainpage = 'products/index.tpl'; |
---|
| 49 | $this->tpl_mainno = 'products'; |
---|
| 50 | $this->tpl_subno = 'index'; |
---|
[20128] | 51 | $this->tpl_pager = 'pager.tpl'; |
---|
[20911] | 52 | $this->tpl_maintitle = '商品管理'; |
---|
[20970] | 53 | $this->tpl_subtitle = '商品マスター'; |
---|
[15342] | 54 | |
---|
| 55 | $masterData = new SC_DB_MasterData_Ex(); |
---|
[21481] | 56 | $this->arrPageMax = $masterData->getMasterData('mtb_page_max'); |
---|
| 57 | $this->arrDISP = $masterData->getMasterData('mtb_disp'); |
---|
| 58 | $this->arrSTATUS = $masterData->getMasterData('mtb_status'); |
---|
| 59 | $this->arrPRODUCTSTATUS_COLOR = $masterData->getMasterData('mtb_product_status_color'); |
---|
[20535] | 60 | |
---|
[22577] | 61 | $objDate = new SC_Date_Ex(); |
---|
[20535] | 62 | // 登録・更新検索開始年 |
---|
| 63 | $objDate->setStartYear(RELEASE_YEAR); |
---|
[21480] | 64 | $objDate->setEndYear(DATE('Y')); |
---|
[20535] | 65 | $this->arrStartYear = $objDate->getYear(); |
---|
| 66 | $this->arrStartMonth = $objDate->getMonth(); |
---|
| 67 | $this->arrStartDay = $objDate->getDay(); |
---|
| 68 | // 登録・更新検索終了年 |
---|
| 69 | $objDate->setStartYear(RELEASE_YEAR); |
---|
[21480] | 70 | $objDate->setEndYear(DATE('Y')); |
---|
[20535] | 71 | $this->arrEndYear = $objDate->getYear(); |
---|
| 72 | $this->arrEndMonth = $objDate->getMonth(); |
---|
| 73 | $this->arrEndDay = $objDate->getDay(); |
---|
| 74 | |
---|
[15342] | 75 | } |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | * Page のプロセス. |
---|
| 79 | * |
---|
| 80 | * @return void |
---|
| 81 | */ |
---|
[22567] | 82 | function process() |
---|
| 83 | { |
---|
[19661] | 84 | $this->action(); |
---|
| 85 | $this->sendResponse(); |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | /** |
---|
| 89 | * Page のアクション. |
---|
| 90 | * |
---|
| 91 | * @return void |
---|
| 92 | */ |
---|
[22567] | 93 | function action() |
---|
| 94 | { |
---|
[21591] | 95 | |
---|
[15350] | 96 | $objDb = new SC_Helper_DB_Ex(); |
---|
[21229] | 97 | $objFormParam = new SC_FormParam_Ex(); |
---|
| 98 | $objProduct = new SC_Product_Ex(); |
---|
| 99 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
[15342] | 100 | |
---|
[20970] | 101 | // パラメーター情報の初期化 |
---|
[20200] | 102 | $this->lfInitParam($objFormParam); |
---|
| 103 | $objFormParam->setParam($_POST); |
---|
| 104 | $this->arrHidden = $objFormParam->getSearchArray(); |
---|
| 105 | $this->arrForm = $objFormParam->getFormParamList(); |
---|
[15342] | 106 | |
---|
[20044] | 107 | switch ($this->getMode()) { |
---|
[21526] | 108 | case 'delete': |
---|
| 109 | // 商品、子テーブル(商品規格)、会員お気に入り商品の削除 |
---|
| 110 | $this->doDelete('product_id = ?', array($objFormParam->getValue('product_id'))); |
---|
| 111 | // 件数カウントバッチ実行 |
---|
| 112 | $objDb->sfCountCategory($objQuery); |
---|
| 113 | $objDb->sfCountMaker($objQuery); |
---|
| 114 | // 削除後に検索結果を表示するため breakしない |
---|
[20200] | 115 | |
---|
[21526] | 116 | // 検索パラメーター生成後に処理実行するため breakしない |
---|
| 117 | case 'csv': |
---|
| 118 | case 'delete_all': |
---|
[15342] | 119 | |
---|
[21526] | 120 | case 'search': |
---|
| 121 | $objFormParam->convParam(); |
---|
| 122 | $objFormParam->trimParam(); |
---|
| 123 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
| 124 | $arrParam = $objFormParam->getHashArray(); |
---|
[15342] | 125 | |
---|
[21526] | 126 | if (count($this->arrErr) == 0) { |
---|
| 127 | $where = 'del_flg = 0'; |
---|
[21563] | 128 | $arrWhereVal = array(); |
---|
[21526] | 129 | foreach ($arrParam as $key => $val) { |
---|
| 130 | if ($val == '') { |
---|
| 131 | continue; |
---|
| 132 | } |
---|
[21563] | 133 | $this->buildQuery($key, $where, $arrWhereVal, $objFormParam, $objDb); |
---|
[15342] | 134 | } |
---|
| 135 | |
---|
[21526] | 136 | $order = 'update_date DESC'; |
---|
[15551] | 137 | |
---|
[21526] | 138 | /* ----------------------------------------------- |
---|
| 139 | * 処理を実行 |
---|
| 140 | * ----------------------------------------------- */ |
---|
| 141 | switch ($this->getMode()) { |
---|
| 142 | // CSVを送信する。 |
---|
| 143 | case 'csv': |
---|
| 144 | $objCSV = new SC_Helper_CSV_Ex(); |
---|
| 145 | // CSVを送信する。正常終了の場合、終了。 |
---|
[21563] | 146 | $objCSV->sfDownloadCsv(1, $where, $arrWhereVal, $order, true); |
---|
[21743] | 147 | SC_Response_Ex::actionExit(); |
---|
[18327] | 148 | |
---|
[21526] | 149 | // 全件削除(ADMIN_MODE) |
---|
| 150 | case 'delete_all': |
---|
[21563] | 151 | $this->doDelete($where, $arrWhereVal); |
---|
[21526] | 152 | break; |
---|
[18327] | 153 | |
---|
[21526] | 154 | // 検索実行 |
---|
| 155 | default: |
---|
| 156 | // 行数の取得 |
---|
[21563] | 157 | $this->tpl_linemax = $this->getNumberOfLines($where, $arrWhereVal); |
---|
[21526] | 158 | // ページ送りの処理 |
---|
| 159 | $page_max = SC_Utils_Ex::sfGetSearchPageMax($objFormParam->getValue('search_page_max')); |
---|
| 160 | // ページ送りの取得 |
---|
| 161 | $objNavi = new SC_PageNavi_Ex($this->arrHidden['search_pageno'], |
---|
[21527] | 162 | $this->tpl_linemax, $page_max, |
---|
| 163 | 'fnNaviSearchPage', NAVI_PMAX); |
---|
[21526] | 164 | $this->arrPagenavi = $objNavi->arrPagenavi; |
---|
[20201] | 165 | |
---|
[21526] | 166 | // 検索結果の取得 |
---|
[21563] | 167 | $this->arrProducts = $this->findProducts($where, $arrWhereVal, $page_max, $objNavi->start_row, |
---|
[21527] | 168 | $order, $objProduct); |
---|
[20964] | 169 | |
---|
[21526] | 170 | // 各商品ごとのカテゴリIDを取得 |
---|
| 171 | if (count($this->arrProducts) > 0) { |
---|
| 172 | foreach ($this->arrProducts as $key => $val) { |
---|
| 173 | $this->arrProducts[$key]['categories'] = $objDb->sfGetCategoryId($val['product_id'], 0, true); |
---|
| 174 | $objDb->g_category_on = false; |
---|
| 175 | } |
---|
[20964] | 176 | } |
---|
[21526] | 177 | } |
---|
[15342] | 178 | } |
---|
[21526] | 179 | break; |
---|
[15342] | 180 | } |
---|
| 181 | |
---|
| 182 | // カテゴリの読込 |
---|
[17569] | 183 | list($this->arrCatKey, $this->arrCatVal) = $objDb->sfGetLevelCatList(false); |
---|
| 184 | $this->arrCatList = $this->lfGetIDName($this->arrCatKey, $this->arrCatVal); |
---|
[21591] | 185 | |
---|
[15342] | 186 | } |
---|
| 187 | |
---|
| 188 | /** |
---|
| 189 | * デストラクタ. |
---|
| 190 | * |
---|
| 191 | * @return void |
---|
| 192 | */ |
---|
[22567] | 193 | function destroy() |
---|
| 194 | { |
---|
[15342] | 195 | parent::destroy(); |
---|
| 196 | } |
---|
| 197 | |
---|
[20200] | 198 | /** |
---|
[20970] | 199 | * パラメーター情報の初期化を行う. |
---|
[20200] | 200 | * |
---|
| 201 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
| 202 | * @return void |
---|
| 203 | */ |
---|
[22567] | 204 | function lfInitParam(&$objFormParam) |
---|
| 205 | { |
---|
[20201] | 206 | |
---|
| 207 | // POSTされる値 |
---|
[21183] | 208 | $objFormParam->addParam('商品ID', 'product_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 209 | $objFormParam->addParam('カテゴリID', 'category_id', STEXT_LEN, 'n', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 210 | $objFormParam->addParam('ページ送り番号','search_pageno', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 211 | $objFormParam->addParam('表示件数', 'search_page_max', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
[20201] | 212 | |
---|
[20200] | 213 | // 検索条件 |
---|
[21183] | 214 | $objFormParam->addParam('商品ID', 'search_product_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 215 | $objFormParam->addParam('商品コード', 'search_product_code', STEXT_LEN, 'KVna', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 216 | $objFormParam->addParam('商品名', 'search_name', STEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 217 | $objFormParam->addParam('カテゴリ', 'search_category_id', STEXT_LEN, 'n', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 218 | $objFormParam->addParam('種別', 'search_status', INT_LEN, 'n', array('MAX_LENGTH_CHECK')); |
---|
[20200] | 219 | // 登録・更新日 |
---|
[21183] | 220 | $objFormParam->addParam('開始年', 'search_startyear', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 221 | $objFormParam->addParam('開始月', 'search_startmonth', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 222 | $objFormParam->addParam('開始日', 'search_startday', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 223 | $objFormParam->addParam('終了年', 'search_endyear', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 224 | $objFormParam->addParam('終了月', 'search_endmonth', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 225 | $objFormParam->addParam('終了日', 'search_endday', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
[15342] | 226 | |
---|
[21183] | 227 | $objFormParam->addParam('商品ステータス', 'search_product_statuses', INT_LEN, 'n', array('MAX_LENGTH_CHECK')); |
---|
[15342] | 228 | } |
---|
| 229 | |
---|
[20200] | 230 | /** |
---|
| 231 | * 入力内容のチェックを行う. |
---|
| 232 | * |
---|
| 233 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
| 234 | * @return void |
---|
| 235 | */ |
---|
[22567] | 236 | function lfCheckError(&$objFormParam) |
---|
| 237 | { |
---|
[20503] | 238 | $objErr = new SC_CheckError_Ex($objFormParam->getHashArray()); |
---|
[20200] | 239 | $objErr->arrErr = $objFormParam->checkError(); |
---|
| 240 | |
---|
[21514] | 241 | $objErr->doFunc(array('開始日', '終了日', 'search_startyear', 'search_startmonth', 'search_startday', 'search_endyear', 'search_endmonth', 'search_endday'), array('CHECK_SET_TERM')); |
---|
[20200] | 242 | |
---|
[15342] | 243 | return $objErr->arrErr; |
---|
| 244 | } |
---|
| 245 | |
---|
| 246 | // カテゴリIDをキー、カテゴリ名を値にする配列を返す。 |
---|
[22567] | 247 | function lfGetIDName($arrCatKey, $arrCatVal) |
---|
| 248 | { |
---|
[17569] | 249 | $max = count($arrCatKey); |
---|
[21442] | 250 | for ($cnt = 0; $cnt < $max; $cnt++) { |
---|
[21514] | 251 | $key = isset($arrCatKey[$cnt]) ? $arrCatKey[$cnt] : ''; |
---|
| 252 | $val = isset($arrCatVal[$cnt]) ? $arrCatVal[$cnt] : ''; |
---|
[15342] | 253 | $arrRet[$key] = $val; |
---|
| 254 | } |
---|
| 255 | return $arrRet; |
---|
| 256 | } |
---|
[20200] | 257 | |
---|
| 258 | /** |
---|
[20201] | 259 | * 商品、子テーブル(商品規格)、お気に入り商品の削除 |
---|
[20200] | 260 | * |
---|
| 261 | * @param string $where 削除対象の WHERE 句 |
---|
| 262 | * @param array $arrParam 削除対象の値 |
---|
| 263 | * @return void |
---|
| 264 | */ |
---|
[22567] | 265 | function doDelete($where, $arrParam = array()) |
---|
| 266 | { |
---|
[20507] | 267 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
[22582] | 268 | $arrRet = $objQuery->getCol('product_id', "dtb_products", $where, $arrParam); |
---|
| 269 | $product_ids = array(); |
---|
| 270 | foreach ($arrRet as $value) { |
---|
| 271 | $product_ids[] = $value['product_id']; |
---|
| 272 | } |
---|
[20907] | 273 | $sqlval['del_flg'] = 1; |
---|
[21185] | 274 | $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; |
---|
[20964] | 275 | $objQuery->begin(); |
---|
| 276 | $objQuery->update('dtb_products_class', $sqlval, "product_id IN (SELECT product_id FROM dtb_products WHERE $where)", $arrParam); |
---|
| 277 | $objQuery->delete('dtb_customer_favorite_products', "product_id IN (SELECT product_id FROM dtb_products WHERE $where)", $arrParam); |
---|
[22582] | 278 | |
---|
| 279 | $objRecomment = new SC_Helper_Recommend_Ex(); |
---|
| 280 | $objRecomment->deleteByProductIDs($product_ids); |
---|
| 281 | |
---|
[20964] | 282 | $objQuery->update('dtb_products', $sqlval, $where, $arrParam); |
---|
| 283 | $objQuery->commit(); |
---|
[20200] | 284 | } |
---|
| 285 | |
---|
| 286 | /** |
---|
| 287 | * クエリを構築する. |
---|
| 288 | * |
---|
[20970] | 289 | * 検索条件のキーに応じた WHERE 句と, クエリパラメーターを構築する. |
---|
| 290 | * クエリパラメーターは, SC_FormParam の入力値から取得する. |
---|
[20200] | 291 | * |
---|
[20202] | 292 | * 構築内容は, 引数の $where 及び $arrValues にそれぞれ追加される. |
---|
[20200] | 293 | * |
---|
| 294 | * @param string $key 検索条件のキー |
---|
| 295 | * @param string $where 構築する WHERE 句 |
---|
[20970] | 296 | * @param array $arrValues 構築するクエリパラメーター |
---|
[20200] | 297 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
| 298 | * @param SC_FormParam $objDb SC_Helper_DB_Ex インスタンス |
---|
| 299 | * @return void |
---|
| 300 | */ |
---|
[22567] | 301 | function buildQuery($key, &$where, &$arrValues, &$objFormParam, &$objDb) |
---|
| 302 | { |
---|
[20484] | 303 | $dbFactory = SC_DB_DBFactory_Ex::getInstance(); |
---|
[20200] | 304 | switch ($key) { |
---|
[21564] | 305 | // 商品ID |
---|
| 306 | case 'search_product_id': |
---|
| 307 | $where .= ' AND product_id = ?'; |
---|
| 308 | $arrValues[] = sprintf('%d', $objFormParam->getValue($key)); |
---|
| 309 | break; |
---|
| 310 | // 商品コード |
---|
| 311 | case 'search_product_code': |
---|
[21740] | 312 | $where .= ' AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ?)'; |
---|
[21564] | 313 | $arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key)); |
---|
| 314 | break; |
---|
| 315 | // 商品名 |
---|
| 316 | case 'search_name': |
---|
| 317 | $where .= ' AND name LIKE ?'; |
---|
| 318 | $arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key)); |
---|
| 319 | break; |
---|
| 320 | // カテゴリ |
---|
| 321 | case 'search_category_id': |
---|
| 322 | list($tmp_where, $tmp_Values) = $objDb->sfGetCatWhere($objFormParam->getValue($key)); |
---|
| 323 | if ($tmp_where != '') { |
---|
| 324 | $where.= ' AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE ' . $tmp_where . ')'; |
---|
| 325 | $arrValues = array_merge((array)$arrValues, (array)$tmp_Values); |
---|
| 326 | } |
---|
| 327 | break; |
---|
| 328 | // 種別 |
---|
| 329 | case 'search_status': |
---|
| 330 | $tmp_where = ''; |
---|
| 331 | foreach ($objFormParam->getValue($key) as $element) { |
---|
| 332 | if ($element != '') { |
---|
| 333 | if (SC_Utils_Ex::isBlank($tmp_where)) { |
---|
| 334 | $tmp_where .= ' AND (status = ?'; |
---|
| 335 | } else { |
---|
| 336 | $tmp_where .= ' OR status = ?'; |
---|
| 337 | } |
---|
| 338 | $arrValues[] = $element; |
---|
[20200] | 339 | } |
---|
| 340 | } |
---|
| 341 | |
---|
[21564] | 342 | if (!SC_Utils_Ex::isBlank($tmp_where)) { |
---|
| 343 | $tmp_where .= ')'; |
---|
| 344 | $where .= " $tmp_where "; |
---|
[20200] | 345 | } |
---|
[21564] | 346 | break; |
---|
| 347 | // 登録・更新日(開始) |
---|
| 348 | case 'search_startyear': |
---|
| 349 | $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_startyear'), |
---|
| 350 | $objFormParam->getValue('search_startmonth'), |
---|
| 351 | $objFormParam->getValue('search_startday')); |
---|
| 352 | $where.= ' AND update_date >= ?'; |
---|
| 353 | $arrValues[] = $date; |
---|
| 354 | break; |
---|
| 355 | // 登録・更新日(終了) |
---|
| 356 | case 'search_endyear': |
---|
| 357 | $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_endyear'), |
---|
| 358 | $objFormParam->getValue('search_endmonth'), |
---|
| 359 | $objFormParam->getValue('search_endday'), true); |
---|
| 360 | $where.= ' AND update_date <= ?'; |
---|
| 361 | $arrValues[] = $date; |
---|
| 362 | break; |
---|
| 363 | // 商品ステータス |
---|
| 364 | case 'search_product_statuses': |
---|
| 365 | $arrPartVal = $objFormParam->getValue($key); |
---|
| 366 | $count = count($arrPartVal); |
---|
| 367 | if ($count >= 1) { |
---|
| 368 | $where .= ' ' |
---|
| 369 | . 'AND product_id IN (' |
---|
| 370 | . ' SELECT product_id FROM dtb_product_status WHERE product_status_id IN (' . SC_Utils_Ex::repeatStrWithSeparator('?', $count) . ')' |
---|
| 371 | . ')'; |
---|
| 372 | $arrValues = array_merge($arrValues, $arrPartVal); |
---|
| 373 | } |
---|
| 374 | break; |
---|
| 375 | default: |
---|
| 376 | break; |
---|
[20200] | 377 | } |
---|
| 378 | } |
---|
| 379 | |
---|
| 380 | /** |
---|
| 381 | * 検索結果の行数を取得する. |
---|
| 382 | * |
---|
| 383 | * @param string $where 検索条件の WHERE 句 |
---|
[20970] | 384 | * @param array $arrValues 検索条件のパラメーター |
---|
[20200] | 385 | * @return integer 検索結果の行数 |
---|
| 386 | */ |
---|
[22567] | 387 | function getNumberOfLines($where, $arrValues) |
---|
| 388 | { |
---|
[20507] | 389 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
[20200] | 390 | return $objQuery->count('dtb_products', $where, $arrValues); |
---|
| 391 | } |
---|
| 392 | |
---|
| 393 | /** |
---|
| 394 | * 商品を検索する. |
---|
| 395 | * |
---|
| 396 | * @param string $where 検索条件の WHERE 句 |
---|
[20970] | 397 | * @param array $arrValues 検索条件のパラメーター |
---|
[20200] | 398 | * @param integer $limit 表示件数 |
---|
| 399 | * @param integer $offset 開始件数 |
---|
| 400 | * @param string $order 検索結果の並び順 |
---|
| 401 | * @param SC_Product $objProduct SC_Product インスタンス |
---|
| 402 | * @return array 商品の検索結果 |
---|
| 403 | */ |
---|
[22567] | 404 | function findProducts($where, $arrValues, $limit, $offset, $order, &$objProduct) |
---|
| 405 | { |
---|
[20507] | 406 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
[20200] | 407 | |
---|
| 408 | // 読み込む列とテーブルの指定 |
---|
[21514] | 409 | $col = 'product_id, name, main_list_image, status, product_code_min, product_code_max, price02_min, price02_max, stock_min, stock_max, stock_unlimited_min, stock_unlimited_max, update_date'; |
---|
[21328] | 410 | $from = $objProduct->alldtlSQL(); |
---|
[20200] | 411 | |
---|
| 412 | $objQuery->setLimitOffset($limit, $offset); |
---|
| 413 | $objQuery->setOrder($order); |
---|
| 414 | |
---|
| 415 | return $objQuery->select($col, $from, $where, $arrValues); |
---|
| 416 | } |
---|
[15342] | 417 | } |
---|