source: branches/version-2_13_0/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts.php @ 23126

Revision 23126, 5.6 KB checked in by m_uehara, 11 years ago (diff)

#2348 r23116 - r23125 をマージ

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
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.
22 */
23
24require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';
25
26/**
27 * 検索ブロック のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id:LC_Page_FrontParts_Bloc_SearchProducts.php 15532 2007-08-31 14:39:46Z nanasess $
32 */
33class LC_Page_FrontParts_Bloc_SearchProducts extends LC_Page_FrontParts_Bloc_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    public function init()
41    {
42        parent::init();
43    }
44
45    /**
46     * Page のプロセス.
47     *
48     * @return void
49     */
50    public function process()
51    {
52        $this->action();
53        $this->sendResponse();
54    }
55
56    /**
57     * Page のアクション.
58     *
59     * @return void
60     */
61    public function action()
62    {
63        // 商品ID取得
64        $product_id = $this -> lfGetProductId();
65        // カテゴリID取得
66        $category_id = $this -> lfGetCategoryId();
67        // メーカーID取得
68        $maker_id = $this -> lfGetMakerId();
69        // 選択中のカテゴリIDを判定する
70        $this->category_id = $this->lfGetSelectedCategoryId($product_id, $category_id);
71        // カテゴリ検索用選択リスト
72        $this->arrCatList = $this->lfGetCategoryList();
73        // 選択中のメーカーIDを判定する
74        $this->maker_id = $this->lfGetSelectedMakerId($product_id, $maker_id);
75        // メーカー検索用選択リスト
76        $this->arrMakerList = $this->lfGetMakerList();
77    }
78
79    /**
80     * 商品IDを取得する.
81     *
82     * @return string $product_id 商品ID
83     */
84    public function lfGetProductId()
85    {
86        $product_id = '';
87        if (isset($_GET['product_id']) && $_GET['product_id'] != '' && is_numeric($_GET['product_id'])) {
88            $product_id = $_GET['product_id'];
89        }
90
91        return $product_id;
92    }
93
94    /**
95     * カテゴリIDを取得する.
96     *
97     * @return string $category_id カテゴリID
98     */
99    public function lfGetCategoryId()
100    {
101        $category_id = '';
102        if (isset($_GET['category_id']) && $_GET['category_id'] != '' && is_numeric($_GET['category_id'])) {
103            $category_id = $_GET['category_id'];
104        }
105
106        return $category_id;
107    }
108
109    /**
110     * メーカーIDを取得する.
111     *
112     * @return string $maker_id メーカーID
113     */
114    public function lfGetMakerId()
115    {
116        $maker_id = '';
117        if (isset($_GET['maker_id']) && $_GET['maker_id'] != '' && is_numeric($_GET['maker_id'])) {
118            $maker_id = $_GET['maker_id'];
119        }
120
121        return $maker_id;
122    }
123
124    /**
125     * 選択中のカテゴリIDを取得する
126     *
127     * @return array $arrCategoryId 選択中のカテゴリID
128     */
129    public function lfGetSelectedCategoryId($product_id, $category_id)
130    {
131        // 選択中のカテゴリIDを判定する
132        $objDb = new SC_Helper_DB_Ex();
133        $arrCategoryId = $objDb->sfGetCategoryId($product_id, $category_id);
134
135        return $arrCategoryId;
136    }
137
138    /**
139     * 選択中のメーカーIDを取得する
140     *
141     * @return array $arrMakerId 選択中のメーカーID
142     */
143    public function lfGetSelectedMakerId($product_id, $maker_id)
144    {
145        // 選択中のメーカーIDを判定する
146        $objDb = new SC_Helper_DB_Ex();
147        $arrMakerId = $objDb->sfGetMakerId($product_id, $maker_id);
148
149        return $arrMakerId;
150    }
151
152    /**
153     * カテゴリ検索用選択リストを取得する
154     *
155     * @return array $arrCategoryList カテゴリ検索用選択リスト
156     */
157    public function lfGetCategoryList()
158    {
159        $objDb = new SC_Helper_DB_Ex();
160        // カテゴリ検索用選択リスト
161        $arrCategoryList = $objDb->sfGetCategoryList('', true, ' ');
162        if (is_array($arrCategoryList)) {
163            // 文字サイズを制限する
164            foreach ($arrCategoryList as $key => $val) {
165                $truncate_str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
166                $arrCategoryList[$key] = preg_replace('/ /u', '&nbsp;&nbsp;', $truncate_str);
167            }
168        }
169
170        return $arrCategoryList;
171    }
172
173    /**
174     * メーカー検索用選択リストを取得する
175     *
176     * @return array $arrMakerList メーカー検索用選択リスト
177     */
178    public function lfGetMakerList()
179    {
180        $objDb = new SC_Helper_DB_Ex();
181        // メーカー検索用選択リスト
182        $arrMakerList = $objDb->sfGetMakerList('', true);
183        if (is_array($arrMakerList)) {
184            // 文字サイズを制限する
185            foreach ($arrMakerList as $key => $val) {
186                $arrMakerList[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false);
187            }
188        }
189
190        return $arrMakerList;
191    }
192}
Note: See TracBrowser for help on using the repository browser.