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

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