/** * Page のアクション. * * @return void */ public function action() { /* @var $objDb DbHelper */ $objDb = Application::alias('eccube.helper.db'); $objFormParam = Application::alias('eccube.form_param'); $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $this->tpl_no = $this->getNo(array($_GET, $_POST)); $this->shipping_id = $this->getShippingId(array($_GET, $_POST)); switch ($this->getMode()) { case 'search': /* @var $objProduct Product */ $objProduct = Application::alias('eccube.product'); $this->arrForm = $objFormParam->getHashArray(); $wheres = $this->createWhere($objFormParam, $objDb); $this->tpl_linemax = $this->getLineCount($wheres, $objProduct); //ぶった斬りポイント================================================================== // ページ送りの処理 $page_max = Utils::sfGetSearchPageMax($_POST['search_page_max']); // ページ送りの取得 /* @var $objNavi PageNavi */ $objNavi = Application::alias('eccube.page_navi', $_POST['search_pageno'], $this->tpl_linemax, $page_max, 'eccube.moveSearchPage', NAVI_PMAX); $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 $startno = $objNavi->start_row; $arrProduct_id = $this->getProducts($wheres, $objProduct, $page_max, $startno); $productList = $this->getProductList($arrProduct_id, $objProduct); //取得している並び順で並び替え $this->arrProducts = $this->sortProducts($arrProduct_id, $productList); $objProduct->setProductsClassByProductIds($arrProduct_id); $this->tpl_javascript .= $this->getTplJavascript($objProduct); $js_fnOnLoad = $this->getFnOnload($this->arrProducts); $this->tpl_javascript .= 'function fnOnLoad() {' . $js_fnOnLoad . '}'; $this->tpl_onload .= 'fnOnLoad();'; // 規格1クラス名 $this->tpl_class_name1 = $objProduct->className1; // 規格2クラス名 $this->tpl_class_name2 = $objProduct->className2; // 規格1 $this->arrClassCat1 = $objProduct->classCats1; // 規格1が設定されている $this->tpl_classcat_find1 = $objProduct->classCat1_find; // 規格2が設定されている $this->tpl_classcat_find2 = $objProduct->classCat2_find; $this->tpl_product_class_id = $objProduct->product_class_id; $this->tpl_stock_find = $objProduct->stock_find; break; default: break; } // カテゴリ取得 $this->arrCatList = $objDb->getCategoryList(); $this->setTemplate($this->tpl_mainpage); }
/** * Page のアクション. * * @return void */ public function action() { /* @var $objDb DbHelper */ $objDb = Application::alias('eccube.helper.db'); $objFormParam = Application::alias('eccube.form_param'); $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $rank = intval($_GET['rank']); switch ($this->getMode()) { case 'search': // POST値の引き継ぎ $this->arrErr = $this->lfCheckError($objFormParam); $arrPost = $objFormParam->getHashArray(); // 入力された値にエラーがない場合、検索処理を行う。 // 検索結果の数に応じてページャの処理も入れる。 if (Utils::isBlank($this->arrErr)) { /* @var $objProduct Product */ $objProduct = Application::alias('eccube.product'); $wheres = $this->createWhere($objFormParam, $objDb); $this->tpl_linemax = $this->getLineCount($wheres, $objProduct); $page_max = Utils::sfGetSearchPageMax($arrPost['search_page_max']); // ページ送りの取得 /* @var $objNavi PageNavi */ $objNavi = Application::alias('eccube.page_navi', $arrPost['search_pageno'], $this->tpl_linemax, $page_max, 'eccube.moveSearchPage', NAVI_PMAX); $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 $startno = $objNavi->start_row; $arrProduct_id = $this->getProducts($wheres, $objProduct, $page_max, $startno); $this->arrProducts = $this->getProductList($arrProduct_id, $objProduct); $this->arrForm = $arrPost; } break; default: break; } // カテゴリ取得 $this->arrCatList = $objDb->getCategoryList(); $this->rank = $rank; $this->setTemplate('contents/recommend_search.tpl'); }
/** * Page のアクション. * * @return void */ public function action() { /* @var $objDb DbHelper */ $objDb = Application::alias('eccube.helper.db'); $objFormParam = Application::alias('eccube.form_param'); /* @var $objProduct Product */ $objProduct = Application::alias('eccube.product'); $objQuery = Application::alias('eccube.query'); // パラメーター情報の初期化 $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrHidden = $objFormParam->getSearchArray(); $this->arrForm = $objFormParam->getFormParamList(); switch ($this->getMode()) { case 'delete': // 商品、子テーブル(商品規格)、会員お気に入り商品の削除 $this->doDelete('product_id = ?', array($objFormParam->getValue('product_id'))); // 件数カウントバッチ実行 $objDb->countCategory($objQuery); $objDb->countMaker($objQuery); // 削除後に検索結果を表示するため breakしない // 検索パラメーター生成後に処理実行するため breakしない // 削除後に検索結果を表示するため breakしない // 検索パラメーター生成後に処理実行するため breakしない case 'csv': case 'delete_all': case 'search': $objFormParam->convParam(); $objFormParam->trimParam(); $this->arrErr = $this->lfCheckError($objFormParam); $arrParam = $objFormParam->getHashArray(); if (count($this->arrErr) == 0) { $where = 'del_flg = 0'; $arrWhereVal = array(); foreach ($arrParam as $key => $val) { if ($val == '') { continue; } $this->buildQuery($key, $where, $arrWhereVal, $objFormParam, $objDb); } $order = 'update_date DESC'; /* ----------------------------------------------- * 処理を実行 * ----------------------------------------------- */ switch ($this->getMode()) { // CSVを送信する。 case 'csv': /* @var $objCSV CsvHelper */ $objCSV = Application::alias('eccube.helper.csv'); // CSVを送信する。正常終了の場合、終了。 $objCSV->sfDownloadCsv(1, $where, $arrWhereVal, $order, true); Application::alias('eccube.response')->actionExit(); // 全件削除(ADMIN_MODE) // 全件削除(ADMIN_MODE) case 'delete_all': $this->doDelete($where, $arrWhereVal); break; // 検索実行 // 検索実行 default: // 行数の取得 $this->tpl_linemax = $this->getNumberOfLines($where, $arrWhereVal); // ページ送りの処理 $page_max = Utils::sfGetSearchPageMax($objFormParam->getValue('search_page_max')); // ページ送りの取得 /* @var $objNavi PageNavi */ $objNavi = Application::alias('eccube.page_navi', $this->arrHidden['search_pageno'], $this->tpl_linemax, $page_max, 'eccube.moveNaviPage', NAVI_PMAX); $this->arrPagenavi = $objNavi->arrPagenavi; // 検索結果の取得 $this->arrProducts = $this->findProducts($where, $arrWhereVal, $page_max, $objNavi->start_row, $order, $objProduct); // 各商品ごとのカテゴリIDを取得 if (count($this->arrProducts) > 0) { foreach ($this->arrProducts as $key => $val) { $this->arrProducts[$key]['categories'] = $objProduct->getCategoryIds($val['product_id'], true); $objDb->g_category_on = false; } } } } break; } // カテゴリの読込 list($this->arrCatKey, $this->arrCatVal) = $objDb->getLevelCatList(false); $this->arrCatList = $this->lfGetIDName($this->arrCatKey, $this->arrCatVal); }
/** * @param DbHelper $objDb */ public function lfGetProducts(&$objDb) { $where = 'del_flg = 0'; $arrWhereVal = array(); /* 入力エラーなし */ foreach ($this->arrForm as $key => $val) { if ($val == '') { continue; } switch ($key) { case 'search_name': $where .= ' AND name ILIKE ?'; $arrWhereVal[] = "%{$val}%"; break; case 'search_category_id': list($tmp_where, $arrTmp) = $objDb->getCatWhere($val); if ($tmp_where != '') { $where .= ' AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE ' . $tmp_where . ')'; $arrWhereVal = array_merge((array) $arrWhereVal, (array) $arrTmp); } break; case 'search_product_code': $where .= ' AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ?)'; $arrWhereVal[] = "{$val}%"; break; default: break; } } $order = 'update_date DESC, product_id DESC '; $objQuery = Application::alias('eccube.query'); // 行数の取得 $linemax = $objQuery->count('dtb_products', $where, $arrWhereVal); $this->tpl_linemax = $linemax; // 何件が該当しました。表示用 // ページ送りの処理 $page_max = Utils::sfGetSearchPageMax($_POST['search_page_max']); // ページ送りの取得 /* @var $objNavi PageNavi */ $objNavi = Application::alias('eccube.page_navi', $_POST['search_pageno'], $linemax, $page_max, 'eccube.moveSearchPage', NAVI_PMAX); $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 $startno = $objNavi->start_row; // 取得範囲の指定(開始行番号、行数のセット) $objQuery->setLimitOffset($page_max, $startno); // 表示順序 $objQuery->setOrder($order); // 検索結果の取得 // FIXME 商品コードの表示 $arrProducts = $objQuery->select('*', Application::alias('eccube.product')->alldtlSQL(), $where, $arrWhereVal); return $arrProducts; }
/** * レビュー検索結果の取得 * * @param ReviewHelper $objReview * @return array レビュー一覧 */ public function lfGetReview(ReviewHelper $objReview) { $arrForm = $this->arrForm; $query = $this->makeQuery($arrForm); $linemax = $objReview->count($query); $this->tpl_linemax = $linemax; $this->tpl_pageno = isset($arrForm['search_pageno']) ? $arrForm['search_pageno'] : ''; // ページ送りの取得 $page_max = Utils::sfGetSearchPageMax($arrForm['search_page_max']); /* @var $objNavi PageNavi */ $objNavi = Application::alias('eccube.page_navi', $this->tpl_pageno, $linemax, $page_max, 'eccube.moveNaviPage', NAVI_PMAX); $this->arrPagenavi = $objNavi->arrPagenavi; $startno = $objNavi->start_row; // 取得範囲の指定(開始行番号、行数のセット) $params = array('query' => $query, 'limit' => $page_max, 'offset' => $startno); $arrReview = $objReview->find($params); return $arrReview; }
/** * 会員一覧検索をする処理(ページング処理付き、管理画面用共通処理) * * @param array $arrParam 検索パラメーター連想配列 * @param string $limitMode ページングを利用するか判定用フラグ * @return array( integer 全体件数, mixed 会員データ一覧配列, mixed PageNaviオブジェクト) */ public function sfGetSearchData($arrParam, $limitMode = '') { /* @var $objQuery Query*/ $objQuery = Application::alias('eccube.query'); /* @var $objSelect CustomerList */ $objSelect = Application::alias('eccube.customer_list', $arrParam, 'customer'); $page_max = Utils::sfGetSearchPageMax($arrParam['search_page_max']); $disp_pageno = $arrParam['search_pageno']; if ($disp_pageno == 0) { $disp_pageno = 1; } $offset = intval($page_max) * (intval($disp_pageno) - 1); if ($limitMode == '') { $objQuery->setLimitOffset($page_max, $offset); } $arrData = $objQuery->getAll($objSelect->getList(), $objSelect->arrVal); // 該当全体件数の取得 /* @var $objQuery Query*/ $objQuery = Application::alias('eccube.query'); $linemax = $objQuery->getOne($objSelect->getListCount(), $objSelect->arrVal); // ページ送りの取得 /* @var $objNavi PageNavi */ $objNavi = Application::alias('eccube.page_navi', $arrParam['search_pageno'], $linemax, $page_max, 'eccube.moveSearchPage', NAVI_PMAX); return array($linemax, $arrData, $objNavi); }
/** * Page のアクション. * * @return void */ public function action() { $objFormParam = Application::alias('eccube.form_param'); $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrHidden = $objFormParam->getSearchArray(); $this->arrForm = $objFormParam->getFormParamList(); /* @var $objPurchase PurchaseHelper */ $objPurchase = Application::alias('eccube.helper.purchase'); switch ($this->getMode()) { // 削除 case 'delete': $order_id = $objFormParam->getValue('order_id'); $objPurchase->cancelOrder($order_id, ORDER_CANCEL, true); // 削除後に検索結果を表示するため breakしない // 検索パラメーター生成後に処理実行するため breakしない // 削除後に検索結果を表示するため breakしない // 検索パラメーター生成後に処理実行するため breakしない case 'csv': case 'delete_all': // 検索パラメーターの生成 // 検索パラメーターの生成 case 'search': $objFormParam->convParam(); $objFormParam->trimParam(); $this->arrErr = $this->lfCheckError($objFormParam); $arrParam = $objFormParam->getHashArray(); if (count($this->arrErr) == 0) { $where = 'del_flg = 0'; $arrWhereVal = array(); foreach ($arrParam as $key => $val) { if ($val == '') { continue; } $this->buildQuery($key, $where, $arrWhereVal, $objFormParam); } $order = 'update_date DESC'; /* ----------------------------------------------- * 処理を実行 * ----------------------------------------------- */ switch ($this->getMode()) { // CSVを送信する。 case 'csv': $this->doOutputCSV($where, $arrWhereVal, $order); Application::alias('eccube.response')->actionExit(); break; // 全件削除(ADMIN_MODE) // 全件削除(ADMIN_MODE) case 'delete_all': $page_max = 0; $arrResults = $this->findOrders($where, $arrWhereVal, $page_max, 0, $order); foreach ($arrResults as $element) { $objPurchase->cancelOrder($element['order_id'], ORDER_CANCEL, true); } break; // 検索実行 // 検索実行 default: // 行数の取得 $this->tpl_linemax = $this->getNumberOfLines($where, $arrWhereVal); // ページ送りの処理 $page_max = Utils::sfGetSearchPageMax($objFormParam->getValue('search_page_max')); // ページ送りの取得 /* @var $objNavi PageNavi */ $objNavi = Application::alias('eccube.page_navi', $this->arrHidden['search_pageno'], $this->tpl_linemax, $page_max, 'eccube.moveNaviPage', NAVI_PMAX); $this->arrPagenavi = $objNavi->arrPagenavi; // 検索結果の取得 $this->arrResults = $this->findOrders($where, $arrWhereVal, $page_max, $objNavi->start_row, $order); break; } } break; default: break; } }