source: temp/trunk/html/admin/contents/recommend_search.php @ 3586

Revision 3586, 3.3 KB checked in by kakinaka, 20 years ago (diff)

blank

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2
3
4require_once("../require.php");
5
6class LC_Page {
7   
8    function LC_Page() {
9        $this->tpl_mainpage = 'contents/recomend_search.tpl';
10        $this->tpl_mainno = 'contents';
11        $this->tpl_subnavi = '';
12        $this->tpl_subno = "";
13    }
14}
15
16$conn = new SC_DBConn();
17$objPage = new LC_Page();
18$objView = new SC_AdminView();
19$objSess = new SC_Session();
20
21// ǧ¾Ú²ÄÈݤÎȽÄê
22sfIsSuccess($objSess);
23
24
25if ($_POST['mode'] == "search") {
26   
27    // POSTÃͤΰú¤­·Ñ¤®
28    $objPage->arrForm = $_POST;
29    // ÆþÎÏʸ»ú¤Î¶¯À©ÊÑ´¹
30    lfConvertParam();
31   
32   
33    $where = "delete = 0";
34   
35    /* ÆþÎÏ¥¨¥é¡¼¤Ê¤· */
36    foreach ($objPage->arrForm as $key => $val) {
37        if($val == "") {
38            continue;
39        }
40       
41        switch ($key) {
42            case 'search_name':
43               
44                $where .= " AND name ILIKE ?";
45                $arrval[] = "%$val%";
46                break;
47            case 'search_category_id':
48                // »Ò¥«¥Æ¥´¥êID¤Î¼èÆÀ
49                $arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val);
50                $tmp_where = "";
51                foreach ($arrRet as $val) {
52                    if($tmp_where == "") {
53                        $tmp_where.= " AND ( category_id = ?";
54                    } else {
55                        $tmp_where.= " OR category_id = ?";
56                    }
57                    $arrval[] = $val;
58                }
59                $where.= $tmp_where . " )";
60                break;
61            case 'search_product_code':
62                $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
63                $where .= " OR product_code ILIKE ?";
64                $arrval[] = "%$val%";
65                $arrval[] = "%$val%";
66                break;
67            default:
68                break;
69        }
70    }
71   
72    $order = "update_date DESC";
73   
74    // ÆÉ¤ß¹þ¤àÎó¤È¥Æ¡¼¥Ö¥ë¤Î»ØÄê
75    $col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
76    $from = "vw_products_nonclass";
77       
78    $objQuery = new SC_Query();
79    // ¹Ô¿ô¤Î¼èÆÀ
80    $linemax = $objQuery->count($from, $where, $arrval);
81    $objPage->tpl_linemax = $linemax;               // ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ
82   
83    // ¥Ú¡¼¥¸Á÷¤ê¤Î½èÍý
84    if(is_numeric($_POST['search_page_max'])) {
85        $page_max = $_POST['search_page_max'];
86    } else {
87        $page_max = SEARCH_PMAX;
88    }
89   
90    // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ
91    $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
92    $objPage->tpl_strnavi = $objNavi->strnavi;      // ɽ¼¨Ê¸»úÎó
93    $startno = $objNavi->start_row;
94   
95    // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È)
96    $objQuery->setlimitoffset($page_max, $startno);
97    // ɽ¼¨½ç½ø
98    $objQuery->setorder($order);
99    // ¸¡º÷·ë²Ì¤Î¼èÆÀ
100    $objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval);
101       
102}
103
104// ¥«¥Æ¥´¥ê¼èÆÀ
105$objPage->arrCatList = sfGetCategoryList();
106
107
108
109
110
111
112//----¡¡¥Ú¡¼¥¸É½¼¨
113$objView->assignobj($objPage);
114$objView->display($objPage->tpl_mainpage);
115
116
117
118
119
120
121//---------------------------------------------------------------------------------------------------------------------------------------------------------
122
123/* ¼èÆÀʸ»úÎó¤ÎÊÑ´¹ */
124function lfConvertParam() {
125    global $objPage;
126    /*
127     *  ʸ»úÎó¤ÎÊÑ´¹
128     *  K :  ¡ÖȾ³Ñ(ŽÊŽÝ޶ޏ)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
129     *  C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
130     *  V :  ÂùÅÀÉÕ¤­¤Îʸ»ú¤ò°ìʸ»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹ 
131     *  n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖȾ³Ñ(ŽÊŽÝ޶ޏ)¡×¤ËÊÑ´¹
132     */
133    $arrConvList['search_name'] = "KVa";
134    $arrConvList['search_product_code'] = "KVa";
135   
136    // ʸ»úÊÑ´¹
137    foreach ($arrConvList as $key => $val) {
138        // POST¤µ¤ì¤Æ¤­¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£
139        if(isset($objPage->arrForm[$key])) {
140            $objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val);
141        }
142    }
143}
144
145
146?>
Note: See TracBrowser for help on using the repository browser.