/**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objDb = new SC_Helper_DB_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $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':
             $objProduct = new SC_Product_Ex();
             $this->arrForm = $objFormParam->getHashArray();
             $wheres = $this->createWhere($objFormParam, $objDb);
             $this->tpl_linemax = $this->getLineCount($wheres, $objProduct);
             //ぶった斬りポイント==================================================================
             // ページ送りの処理
             $page_max = SC_Utils_Ex::sfGetSearchPageMax($_POST['search_page_max']);
             // ページ送りの取得
             $objNavi = new SC_PageNavi_Ex($_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->sfGetCategoryList();
     $this->setTemplate($this->tpl_mainpage);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objDb = new SC_Helper_DB_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $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 (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $objProduct = new SC_Product_Ex();
                 $wheres = $this->createWhere($objFormParam, $objDb);
                 $this->tpl_linemax = $this->getLineCount($wheres, $objProduct);
                 $page_max = SC_Utils_Ex::sfGetSearchPageMax($arrPost['search_page_max']);
                 // ページ送りの取得
                 $objNavi = new SC_PageNavi_Ex($arrPost['search_pageno'], $this->tpl_linemax, $page_max, 'fnNaviSearchOnlyPage', 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->sfGetCategoryList();
     $this->rank = $rank;
     $this->setTemplate('contents/recommend_search.tpl');
 }
 /**
  * 会員一覧検索をする処理(ページング処理付き、管理画面用共通処理)
  *
  * @param  array  $arrParam  検索パラメーター連想配列
  * @param  string $limitMode ページングを利用するか判定用フラグ
  * @return array( integer 全体件数, mixed 会員データ一覧配列, mixed SC_PageNaviオブジェクト)
  */
 public function sfGetSearchData($arrParam, $limitMode = '')
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $objSelect = new SC_CustomerList_Ex($arrParam, 'customer');
     $page_max = SC_Utils_Ex::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);
     // 該当全体件数の取得
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $linemax = $objQuery->getOne($objSelect->getListCount(), $objSelect->arrVal);
     // ページ送りの取得
     $objNavi = new SC_PageNavi_Ex($arrParam['search_pageno'], $linemax, $page_max, 'eccube.moveSearchPage', NAVI_PMAX);
     return array($linemax, $arrData, $objNavi);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objDb = new SC_Helper_DB_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $objProduct = new SC_Product_Ex();
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     // パラメーター情報の初期化
     $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->sfCountCategory($objQuery);
             $objDb->sfCountMaker($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':
                         $objCSV = new SC_Helper_CSV_Ex();
                         // CSVを送信する。正常終了の場合、終了。
                         $objCSV->sfDownloadCsv(1, $where, $arrWhereVal, $order, true);
                         SC_Response_Ex::actionExit();
                         // 全件削除(ADMIN_MODE)
                     // 全件削除(ADMIN_MODE)
                     case 'delete_all':
                         $this->doDelete($where, $arrWhereVal);
                         break;
                         // 検索実行
                     // 検索実行
                     default:
                         // 行数の取得
                         $this->tpl_linemax = $this->getNumberOfLines($where, $arrWhereVal);
                         // ページ送りの処理
                         $page_max = SC_Utils_Ex::sfGetSearchPageMax($objFormParam->getValue('search_page_max'));
                         // ページ送りの取得
                         $objNavi = new SC_PageNavi_Ex($this->arrHidden['search_pageno'], $this->tpl_linemax, $page_max, 'fnNaviSearchPage', 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'] = $objDb->sfGetCategoryId($val['product_id'], 0, true);
                                 $objDb->g_category_on = false;
                             }
                         }
                 }
             }
             break;
     }
     // カテゴリの読込
     list($this->arrCatKey, $this->arrCatVal) = $objDb->sfGetLevelCatList(false);
     $this->arrCatList = $this->lfGetIDName($this->arrCatKey, $this->arrCatVal);
 }
 /**
  * @param SC_Helper_DB_Ex $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->sfGetCatWhere($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 =& SC_Query_Ex::getSingletonInstance();
     // 行数の取得
     $linemax = $objQuery->count('dtb_products', $where, $arrWhereVal);
     $this->tpl_linemax = $linemax;
     // 何件が該当しました。表示用
     // ページ送りの処理
     $page_max = SC_Utils_Ex::sfGetSearchPageMax($_POST['search_page_max']);
     // ページ送りの取得
     $objNavi = new SC_PageNavi_Ex($_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('*', SC_Product_Ex::alldtlSQL(), $where, $arrWhereVal);
     return $arrProducts;
 }
 /**
  * レビュー検索結果の取得
  *
  * @param array $arrForm フォームデータ
  * @param string $where WHERE文
  * @param array $arrval WHERE文の判定値
  * @return array レビュー一覧
  */
 function lfGetReview($arrForm, $where, $arrval)
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     // ページ送りの処理
     $page_max = SC_Utils_Ex::sfGetSearchPageMax($arrForm['search_page_max']);
     if (!isset($arrval)) {
         $arrval = array();
     }
     $from = "dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ";
     $linemax = $objQuery->count($from, $where, $arrval);
     $this->tpl_linemax = $linemax;
     $this->tpl_pageno = isset($arrForm['search_pageno']) ? $arrForm['search_pageno'] : "";
     // ページ送りの取得
     $objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $linemax, $page_max, 'fnNaviSearchPage', NAVI_PMAX);
     $this->arrPagenavi = $objNavi->arrPagenavi;
     $startno = $objNavi->start_row;
     // 取得範囲の指定(開始行番号、行数のセット)
     $objQuery->setLimitOffset($page_max, $startno);
     // 表示順序
     $order = "A.create_date DESC";
     $objQuery->setOrder($order);
     //検索結果の取得
     //レビュー情報のカラムの取得
     $col = "review_id, A.product_id, reviewer_name, sex, recommend_level, ";
     $col .= "reviewer_url, title, comment, A.status, A.create_date, A.update_date, name";
     $from = "dtb_review AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ";
     $arrReview = $objQuery->select($col, $from, $where, $arrval);
     return $arrReview;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objFormParam = new SC_FormParam_Ex();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_POST);
     $this->arrHidden = $objFormParam->getSearchArray();
     $this->arrForm = $objFormParam->getFormParamList();
     switch ($this->getMode()) {
         // 削除
         case 'delete':
             $this->doDelete('order_id = ?', array($objFormParam->getValue('order_id')));
             // 削除後に検索結果を表示するため 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);
                         SC_Response_Ex::actionExit();
                         break;
                         // 全件削除(ADMIN_MODE)
                     // 全件削除(ADMIN_MODE)
                     case 'delete_all':
                         $this->doDelete($where, $arrWhereVal);
                         break;
                         // 検索実行
                     // 検索実行
                     default:
                         // 行数の取得
                         $this->tpl_linemax = $this->getNumberOfLines($where, $arrWhereVal);
                         // ページ送りの処理
                         $page_max = SC_Utils_Ex::sfGetSearchPageMax($objFormParam->getValue('search_page_max'));
                         // ページ送りの取得
                         $objNavi = new SC_PageNavi_Ex($this->arrHidden['search_pageno'], $this->tpl_linemax, $page_max, 'fnNaviSearchPage', NAVI_PMAX);
                         $this->arrPagenavi = $objNavi->arrPagenavi;
                         // 検索結果の取得
                         $this->arrResults = $this->findOrders($where, $arrWhereVal, $page_max, $objNavi->start_row, $order);
                         break;
                 }
             }
             break;
         default:
             break;
     }
 }