質問 > フロント機能 > 検索ボックスのリストから指定IDの非表示 |
フロント機能
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
Zombie |
投稿日時: 2015/10/5 17:05
対応状況: −−−
|
新米 登録日: 2011/2/25 居住地: 投稿: 9 |
検索ボックスのリストから指定IDの非表示 EC-CUBEバージョン 2.12.6
PHPバージョン PHP 5.3.3 DBバージョン MySQL 5.5.40 使用プラグイン 商品検索条件 追加プラグイン プラグインを使用し、検索ボックスの検索条件に商品ステータスを追加しました。 検索ボックスのドロップダウンリストに ステータスIDが1〜19;表示 ステータスIDが20〜28;非表示 というふうにしたいのですが、どうしたらよいでしょうか? おそらく下記のどこかをいじればいいと思うのですが、phpは少し読める程度で書くことは出来ません。 よろしくお願いいたします。 //-------------------------------------------------------------------------- // SearchBox 条件追加用 /** * 検索条件用商品ステータスリストを追加する * * @param $objPage * @return void */ function lfSetPlgProductStatusList($objPage) { // プラグイン用識別子 $plg_head = NakwebSearchProductStatus::$nakweb_plgin_individual; // 商品ステータスID取得 $product_status_id = $this->lfGetProductStatusId(); // 選択中の商品ステータスIDを判定する $select_product_statusc_id = $this->lfGetSelectedProductStatusId($product_status_id); $this->setDispParam($objPage, $plg_head . '_ploduct_status_id', $select_product_status_id); // 商品ステータス検索用選択リスト $arrProductStatusList = $this->lfGetProductStatusList(); $this->setDispParam($objPage, $plg_head . '_arrProductStatusList', $arrProductStatusList); } /** * 商品ステータスIDを取得する. * * @return string $ 商品ステータスID */ function lfGetProductStatusId() { // プラグイン用識別子 $plg_head = NakwebSearchProductStatus::$nakweb_plgin_individual; $ps_name = $plg_head . 'product_status_id'; // 商品ステータスの変数取得 $product_status_id = ''; if (isset($_GET[$ps_name]) && $_GET[$ps_name] != '' && is_numeric($_GET[$ps_name])) { $product_status_id = $_GET[$ps_name]; } return $product_status_id; } /** * 選択中の商品ステータスIDを取得する * * @return array $ 選択中の商品ステータスID */ function lfGetSelectedProductStatusId($product_status_id) { // 選択中の商品ステータスIDを判定する $masterData = new SC_DB_MasterData_Ex(); $arrStatusId = $masterData->getMasterData('mtb_status'); // 指定した商品ステータスの取得 $status_id = $arrStatusId[$product_status_id]; return $status_id; } /** * 商品ステータス検索用選択リストを取得する * * @return array $ 商品ステータス検索用選択リスト */ function lfGetProductStatusList() { // 条件の使用状態取得 $plugin_code = basename(dirname(__FILE__)); $plugin_data = SC_Plugin_Util_Ex::getPluginByPluginCode($plugin_code); $arrPluginData = unserialize($plugin_data['free_field1']); // 商品ステータスのWHERE文字列取得 $arrList = array(); if ($arrPluginData['product_status_id'] == 1) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $objQuery->setOption('ORDER BY rank ASC'); $col = 'T1.id, name'; $from = 'mtb_status AS T1 LEFT JOIN ('; $from .= ' SELECT product_status_id, count(*) AS product_count FROM dtb_product_status'; $from .= ' WHERE del_flg = 0 GROUP BY product_status_id) AS T2 ON T1.id = T2.product_status_id'; $where = ' product_count > 0'; $arrRet = $objQuery->select($col, $from, $where); $max = count($arrRet); for ($cnt = 0; $cnt < $max; $cnt++) { $id = $arrRet[$cnt]['id']; $name = $arrRet[$cnt]['name']; $arrProductStatusList[$id] = $name; } if (is_array($arrProductStatusList)) { // 文字サイズを制限する foreach ($arrProductStatusList as $key => $val) { $arrProductStatusList[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false); } } } return $arrProductStatusList; } /** * テンプレートに値を渡す * * @param string $obj オブジェクト * @param string $key キー名 * @param string $val 値 * @param string $add true の場合は追記する * @return void */ function setDispParam(&$obj, $key, $val, $add = false) { if ($add == true) { // 追記処理 $obj->$key .= $val; } else { // 上書処理 $obj->$key = $val; } } } |
tsuji |
投稿日時: 2015/10/7 10:23
対応状況: −−−
|
仙人 登録日: 2013/11/19 居住地: 投稿: 958 |
Re: 検索ボックスのリストから指定IDの非表示 Zombie 様
> ステータスIDが20〜28;非表示 なので、$arrProductStatusListから上記のIDをのぞいたら良いと思います。
|
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | トップ |