Changeset 13580 for branches/dev/html
- Timestamp:
- 2007/05/29 09:47:37 (19 years ago)
- File:
-
- 1 edited
-
branches/dev/html/products/list.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/dev/html/products/list.php
r11975 r13580 10 10 11 11 class LC_Page { 12 function LC_Page() {13 global $arrSTATUS;14 $this->arrSTATUS = $arrSTATUS;15 global $arrSTATUS_IMAGE;16 $this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE;17 global $arrDELIVERYDATE;18 $this->arrDELIVERYDATE = $arrDELIVERYDATE;19 global $arrPRODUCTLISTMAX;20 $this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX; 21 /*22 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç23 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤Î͸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£24 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£25 */26 session_cache_limiter('private-no-expire');27 }12 function LC_Page() { 13 global $arrSTATUS; 14 $this->arrSTATUS = $arrSTATUS; 15 global $arrSTATUS_IMAGE; 16 $this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE; 17 global $arrDELIVERYDATE; 18 $this->arrDELIVERYDATE = $arrDELIVERYDATE; 19 global $arrPRODUCTLISTMAX; 20 $this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX; 21 /* 22 session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç 23 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤Î͸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£ 24 private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£ 25 */ 26 session_cache_limiter('private-no-expire'); 27 } 28 28 } 29 29 … … 33 33 //ɽ¼¨·ï¿ô¤ÎÁªÂò 34 34 if(sfIsInt($_POST['disp_number'])) { 35 $objPage->disp_number = $_POST['disp_number'];35 $objPage->disp_number = $_POST['disp_number']; 36 36 } else { 37 //ºÇ¾®É½¼¨·ï¿ô¤òÁªÂò38 $objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX));37 //ºÇ¾®É½¼¨·ï¿ô¤òÁªÂò 38 $objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX)); 39 39 } 40 40 … … 48 48 $tpl_subtitle = ""; 49 49 if($_GET['mode'] == 'search'){ 50 $tpl_subtitle = "¸¡º÷·ë²Ì";50 $tpl_subtitle = "¸¡º÷·ë²Ì"; 51 51 }elseif ($category_id == "" ) { 52 $tpl_subtitle = "Á´¾¦ÉÊ";52 $tpl_subtitle = "Á´¾¦ÉÊ"; 53 53 }else{ 54 $arrFirstCat = sfGetFirstCat($category_id);55 $tpl_subtitle = $arrFirstCat['name'];54 $arrFirstCat = sfGetFirstCat($category_id); 55 $tpl_subtitle = $arrFirstCat['name']; 56 56 } 57 57 … … 64 64 // ¡¦¸¡º÷¥â¡¼¥É¤Ç¤Ê¤¤¡£ 65 65 if(($count >= BEST_MIN) && lfIsRootCategory($category_id) && ($_GET['mode'] != 'search') ) { 66 // ¾¦ÉÊTOP¤Îɽ¼¨½èÍý67 /** ɬ¤º»ØÄꤹ¤ë **/68 $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È 69 70 $objPage->arrBestItems = sfGetBestProducts($conn, $category_id);71 $objPage->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2);66 // ¾¦ÉÊTOP¤Îɽ¼¨½èÍý 67 /** ɬ¤º»ØÄꤹ¤ë **/ 68 $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È 69 70 $objPage->arrBestItems = sfGetBestProducts($conn, $category_id); 71 $objPage->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2); 72 72 } else { 73 if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){74 // ¸¡º÷»þ¤Ëcategory_id¤¬GET¤Ë¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢²¾¤ËËä¤á¤¿ID¤ò¶õÇò¤ËÌ᤹75 $category_id = ''; 76 }77 78 // ¾¦ÉʰìÍ÷¤Îɽ¼¨½èÍý79 $objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_POST['orderby']);80 81 // ¸¡º÷¾ò·ï¤ò²èÌ̤Ëɽ¼¨82 // ¥«¥Æ¥´¥ê¡¼¸¡º÷¾ò·ï83 if (strlen($_GET['category_id']) == 0) {84 $arrSearch['category'] = "»ØÄê¤Ê¤·";85 }else{86 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id));87 $arrSearch['category'] = $arrCat;88 }89 90 // ¾¦ÉÊ̾¸¡º÷¾ò·ï91 if ($_GET['name'] === "") {92 $arrSearch['name'] = "»ØÄê¤Ê¤·";93 }else{94 $arrSearch['name'] = $_GET['name'];95 }73 if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 74 // ¸¡º÷»þ¤Ëcategory_id¤¬GET¤Ë¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢²¾¤ËËä¤á¤¿ID¤ò¶õÇò¤ËÌ᤹ 75 $category_id = ''; 76 } 77 78 // ¾¦ÉʰìÍ÷¤Îɽ¼¨½èÍý 79 $objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_POST['orderby']); 80 81 // ¸¡º÷¾ò·ï¤ò²èÌ̤Ëɽ¼¨ 82 // ¥«¥Æ¥´¥ê¡¼¸¡º÷¾ò·ï 83 if (strlen($_GET['category_id']) == 0) { 84 $arrSearch['category'] = "»ØÄê¤Ê¤·"; 85 }else{ 86 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id)); 87 $arrSearch['category'] = $arrCat; 88 } 89 90 // ¾¦ÉÊ̾¸¡º÷¾ò·ï 91 if ($_GET['name'] === "") { 92 $arrSearch['name'] = "»ØÄê¤Ê¤·"; 93 }else{ 94 $arrSearch['name'] = $_GET['name']; 95 } 96 96 } 97 97 … … 100 100 101 101 if($_POST['mode'] == "cart" && $_POST['product_id'] != "") { 102 // ÃͤÎÀµÅöÀ¥Á¥§¥Ã¥¯103 if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) {104 sfDispSiteError(PRODUCT_NOT_FOUND);105 } else {106 // ÆþÎÏÃͤÎÊÑ´¹107 $objPage->arrErr = lfCheckError($_POST['product_id']);108 if(count($objPage->arrErr) == 0) {109 $objCartSess = new SC_CartSession();110 $classcategory_id = "classcategory_id". $_POST['product_id'];111 $classcategory_id1 = $_POST[$classcategory_id. '_1'];112 $classcategory_id2 = $_POST[$classcategory_id. '_2'];113 $quantity = "quantity". $_POST['product_id'];114 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç115 if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) {116 $classcategory_id1 = '0';117 }118 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç119 if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) {120 $classcategory_id2 = '0';121 }122 $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);123 $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);124 header("Location: " . URL_CART_TOP);125 exit;126 }127 }102 // ÃͤÎÀµÅöÀ¥Á¥§¥Ã¥¯ 103 if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) { 104 sfDispSiteError(PRODUCT_NOT_FOUND); 105 } else { 106 // ÆþÎÏÃͤÎÊÑ´¹ 107 $objPage->arrErr = lfCheckError($_POST['product_id']); 108 if(count($objPage->arrErr) == 0) { 109 $objCartSess = new SC_CartSession(); 110 $classcategory_id = "classcategory_id". $_POST['product_id']; 111 $classcategory_id1 = $_POST[$classcategory_id. '_1']; 112 $classcategory_id2 = $_POST[$classcategory_id. '_2']; 113 $quantity = "quantity". $_POST['product_id']; 114 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç 115 if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) { 116 $classcategory_id1 = '0'; 117 } 118 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç 119 if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) { 120 $classcategory_id2 = '0'; 121 } 122 $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 123 $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]); 124 header("Location: " . URL_CART_TOP); 125 exit; 126 } 127 } 128 128 } 129 129 … … 136 136 $objPage->arrForm = $_POST; 137 137 138 lfConvertParam(); 139 138 140 $objPage->category_id = $category_id; 139 141 $objPage->arrSearch = $arrSearch; … … 144 146 /* ¥«¥Æ¥´¥êID¤¬¥ë¡¼¥È¤«¤É¤¦¤«¤ÎȽÄê */ 145 147 function lfIsRootCategory($category_id) { 146 $objQuery = new SC_Query();147 $level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id));148 if($level == 1) {149 return true;150 }151 return false;148 $objQuery = new SC_Query(); 149 $level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id)); 150 if($level == 1) { 151 return true; 152 } 153 return false; 152 154 } 153 155 154 156 /* ¾¦ÉʰìÍ÷¤Îɽ¼¨ */ 155 157 function lfDispProductsList($category_id, $name, $disp_num, $orderby) { 156 global $objPage;157 $objQuery = new SC_Query(); 158 $objPage->tpl_pageno = $_POST['pageno'];159 160 //ɽ¼¨·ï¿ô¤Ç¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂØ¤¨¤ë161 $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È 162 163 //ɽ¼¨½ç½ø164 switch($orderby) {165 //²Á³Ê½ç166 case 'price':167 $order = "price02_min ASC";168 break;169 //¿·Ãå½ç170 case 'date':171 $order = "create_date DESC";172 break;173 default:174 $order = "category_rank DESC, rank DESC";175 break;176 }177 178 // ¾¦Éʸ¡º÷¾ò·ï¤ÎºîÀ®¡Ê̤ºï½ü¡¢É½¼¨¡Ë179 $where = "del_flg = 0 AND status = 1 ";180 // ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREʸ»úÎó¼èÆÀ181 if ( $category_id ) {182 list($tmp_where, $arrval) = sfGetCatWhere($category_id);183 if($tmp_where != "") {184 $where.= " AND $tmp_where";185 }186 }187 188 // ¾¦ÉÊ̾¤òwhereʸ¤Ë189 $name = ereg_replace(",", "", $name);190 if ( strlen($name) > 0 ){191 $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) ";192 $ret = sfManualEscape($name); 193 $arrval[] = "%$ret%";194 $arrval[] = "%$ret%";195 }196 197 // ¹Ô¿ô¤Î¼èÆÀ198 $linemax = $objQuery->count("vw_products_allclass AS allcls", $where, $arrval);199 $objPage->tpl_linemax = $linemax;// ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ200 201 // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ202 $objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX);203 204 $strnavi = $objNavi->strnavi;205 $strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi);206 $objPage->tpl_strnavi = $strnavi;// ɽ¼¨Ê¸»úÎó207 $startno = $objNavi->start_row;// ³«»Ï¹Ô208 209 // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È)210 $objQuery->setlimitoffset($disp_num, $startno);211 // ɽ¼¨½ç½ø212 $objQuery->setorder($order);213 214 215 216 217 218 219 220 221 // ¸¡º÷·ë²Ì¤Î¼èÆÀ222 $objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval);223 224 // µ¬³Ê̾°ìÍ÷225 $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");226 // µ¬³ÊʬÎà̾°ìÍ÷227 $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");228 // ´ë²è¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÀßÄê229 if($disp_num == 15) {230 for($i = 0; $i < count($objPage->arrProducts); $i++) {231 $objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName);232 // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ233 $objPage = lfGetSaleLimit($objPage->arrProducts[$i]);234 }235 }236 237 return $objPage;158 global $objPage; 159 $objQuery = new SC_Query(); 160 $objPage->tpl_pageno = $_POST['pageno']; 161 162 //ɽ¼¨·ï¿ô¤Ç¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂØ¤¨¤ë 163 $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È 164 165 //ɽ¼¨½ç½ø 166 switch($orderby) { 167 //²Á³Ê½ç 168 case 'price': 169 $order = "price02_min ASC"; 170 break; 171 //¿·Ãå½ç 172 case 'date': 173 $order = "create_date DESC"; 174 break; 175 default: 176 $order = "category_rank DESC, rank DESC"; 177 break; 178 } 179 180 // ¾¦Éʸ¡º÷¾ò·ï¤ÎºîÀ®¡Ê̤ºï½ü¡¢É½¼¨¡Ë 181 $where = "del_flg = 0 AND status = 1 "; 182 // ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREʸ»úÎó¼èÆÀ 183 if ( $category_id ) { 184 list($tmp_where, $arrval) = sfGetCatWhere($category_id); 185 if($tmp_where != "") { 186 $where.= " AND $tmp_where"; 187 } 188 } 189 190 // ¾¦ÉÊ̾¤òwhereʸ¤Ë 191 $name = ereg_replace(",", "", $name); 192 if ( strlen($name) > 0 ){ 193 $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) "; 194 $ret = sfManualEscape($name); 195 $arrval[] = "%$ret%"; 196 $arrval[] = "%$ret%"; 197 } 198 199 // ¹Ô¿ô¤Î¼èÆÀ 200 $linemax = $objQuery->count("vw_products_allclass AS allcls", $where, $arrval); 201 $objPage->tpl_linemax = $linemax; // ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ 202 203 // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ 204 $objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX); 205 206 $strnavi = $objNavi->strnavi; 207 $strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi); 208 $objPage->tpl_strnavi = $strnavi; // ɽ¼¨Ê¸»úÎó 209 $startno = $objNavi->start_row; // ³«»Ï¹Ô 210 211 // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È) 212 $objQuery->setlimitoffset($disp_num, $startno); 213 // ɽ¼¨½ç½ø 214 $objQuery->setorder($order); 215 216 217 218 219 220 221 222 223 // ¸¡º÷·ë²Ì¤Î¼èÆÀ 224 $objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval); 225 226 // µ¬³Ê̾°ìÍ÷ 227 $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 228 // µ¬³ÊʬÎà̾°ìÍ÷ 229 $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 230 // ´ë²è¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÀßÄê 231 if($disp_num == 15) { 232 for($i = 0; $i < count($objPage->arrProducts); $i++) { 233 $objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 234 // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ 235 $objPage = lfGetSaleLimit($objPage->arrProducts[$i]); 236 } 237 } 238 239 return $objPage; 238 240 } 239 241 240 242 /* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */ 241 243 function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 242 global $objPage;243 244 $classcat_find1 = false;245 $classcat_find2 = false;246 // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎÍ̵247 $stock_find = false;248 249 // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ 250 $arrProductsClass = lfGetProductsClass($product_id);251 252 // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ253 $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']];254 // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ255 $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']];256 257 // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô 258 $count = count($arrProductsClass);259 260 $classcat_id1 = "";261 262 $arrSele = array();263 $arrList = array();264 265 $list_id = 0;266 $arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'";267 $arrVal[0] = "\tval". $product_id. "_0 = new Array(''";268 269 for ($i = 0; $i < $count; $i++) {270 // ºß¸Ë¤Î¥Á¥§¥Ã¥¯271 if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {272 continue;273 }274 275 $stock_find = true;276 277 // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ278 if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){279 $arrList[$list_id].=");\n";280 $arrVal[$list_id].=");\n";281 $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];282 $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];283 $list_id++;284 }285 286 // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ287 $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];288 289 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ290 if($arrList[$list_id] == "") {291 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'";292 } else {293 $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";294 }295 296 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ297 if($arrVal[$list_id] == "") {298 $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'";299 } else {300 $arrVal[$list_id].= ", '".$classcat_id2."'";301 }302 } 303 304 $arrList[$list_id].=");\n";305 $arrVal[$list_id].=");\n";306 307 // µ¬³Ê1308 $objPage->arrClassCat1[$product_id] = $arrSele;309 310 $lists = "\tlists".$product_id. " = new Array(";311 $no = 0;312 foreach($arrList as $val) {313 $objPage->tpl_javascript.= $val;314 if ($no != 0) {315 $lists.= ",list". $product_id. "_". $no;316 } else {317 $lists.= "list". $product_id. "_". $no;318 }319 $no++;320 }321 $objPage->tpl_javascript.= $lists.");\n";322 323 $vals = "\tvals".$product_id. " = new Array(";324 $no = 0;325 foreach($arrVal as $val) {326 $objPage->tpl_javascript.= $val;327 if ($no != 0) {328 $vals.= ",val". $product_id. "_". $no;329 } else {330 $vals.= "val". $product_id. "_". $no;331 }332 $no++;333 }334 $objPage->tpl_javascript.= $vals.");\n";335 336 // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID337 $classcategory_id = "classcategory_id". $product_id;338 $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); ";339 340 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë341 if($arrProductsClass[0]['classcategory_id1'] != '0') {342 $classcat_find1 = true;343 }344 345 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë346 if($arrProductsClass[0]['classcategory_id2'] != '0') {347 $classcat_find2 = true;348 }349 350 $objPage->tpl_classcat_find1[$product_id] = $classcat_find1;351 $objPage->tpl_classcat_find2[$product_id] = $classcat_find2;352 $objPage->tpl_stock_find[$product_id] = $stock_find;353 354 return $objPage;244 global $objPage; 245 246 $classcat_find1 = false; 247 $classcat_find2 = false; 248 // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎÍ̵ 249 $stock_find = false; 250 251 // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ 252 $arrProductsClass = lfGetProductsClass($product_id); 253 254 // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ 255 $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 256 // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ 257 $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 258 259 // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô 260 $count = count($arrProductsClass); 261 262 $classcat_id1 = ""; 263 264 $arrSele = array(); 265 $arrList = array(); 266 267 $list_id = 0; 268 $arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'"; 269 $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 270 271 for ($i = 0; $i < $count; $i++) { 272 // ºß¸Ë¤Î¥Á¥§¥Ã¥¯ 273 if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 274 continue; 275 } 276 277 $stock_find = true; 278 279 // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 280 if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 281 $arrList[$list_id].=");\n"; 282 $arrVal[$list_id].=");\n"; 283 $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 284 $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1]; 285 $list_id++; 286 } 287 288 // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 289 $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 290 291 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ 292 if($arrList[$list_id] == "") { 293 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'"; 294 } else { 295 $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 296 } 297 298 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ 299 if($arrVal[$list_id] == "") { 300 $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 301 } else { 302 $arrVal[$list_id].= ", '".$classcat_id2."'"; 303 } 304 } 305 306 $arrList[$list_id].=");\n"; 307 $arrVal[$list_id].=");\n"; 308 309 // µ¬³Ê1 310 $objPage->arrClassCat1[$product_id] = $arrSele; 311 312 $lists = "\tlists".$product_id. " = new Array("; 313 $no = 0; 314 foreach($arrList as $val) { 315 $objPage->tpl_javascript.= $val; 316 if ($no != 0) { 317 $lists.= ",list". $product_id. "_". $no; 318 } else { 319 $lists.= "list". $product_id. "_". $no; 320 } 321 $no++; 322 } 323 $objPage->tpl_javascript.= $lists.");\n"; 324 325 $vals = "\tvals".$product_id. " = new Array("; 326 $no = 0; 327 foreach($arrVal as $val) { 328 $objPage->tpl_javascript.= $val; 329 if ($no != 0) { 330 $vals.= ",val". $product_id. "_". $no; 331 } else { 332 $vals.= "val". $product_id. "_". $no; 333 } 334 $no++; 335 } 336 $objPage->tpl_javascript.= $vals.");\n"; 337 338 // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID 339 $classcategory_id = "classcategory_id". $product_id; 340 $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 341 342 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 343 if($arrProductsClass[0]['classcategory_id1'] != '0') { 344 $classcat_find1 = true; 345 } 346 347 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 348 if($arrProductsClass[0]['classcategory_id2'] != '0') { 349 $classcat_find2 = true; 350 } 351 352 $objPage->tpl_classcat_find1[$product_id] = $classcat_find1; 353 $objPage->tpl_classcat_find2[$product_id] = $classcat_find2; 354 $objPage->tpl_stock_find[$product_id] = $stock_find; 355 356 return $objPage; 355 357 } 356 358 /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ */ 357 359 function lfGetProductsClass($product_id) { 358 $arrRet = array();359 if(sfIsInt($product_id)) {360 // ¾¦Éʵ¬³Ê¼èÆÀ361 $objQuery = new SC_Query();362 $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";363 $table = "vw_product_class AS prdcls";364 $where = "product_id = ?";365 $objQuery->setorder("rank1 DESC, rank2 DESC");366 $arrRet = $objQuery->select($col, $table, $where, array($product_id));367 }368 return $arrRet;360 $arrRet = array(); 361 if(sfIsInt($product_id)) { 362 // ¾¦Éʵ¬³Ê¼èÆÀ 363 $objQuery = new SC_Query(); 364 $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 365 $table = "vw_product_class AS prdcls"; 366 $where = "product_id = ?"; 367 $objQuery->setorder("rank1 DESC, rank2 DESC"); 368 $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 369 } 370 return $arrRet; 369 371 } 370 372 371 373 /* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */ 372 374 function lfCheckError($id) { 373 global $objPage;374 375 // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£376 $objErr = new SC_CheckError();377 378 $classcategory_id1 = "classcategory_id". $id. "_1";379 $classcategory_id2 = "classcategory_id". $id. "_2";380 $quantity = "quantity". $id;381 // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯382 if ($objPage->tpl_classcat_find1[$id]) {383 $objErr->doFunc(array("µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));384 }385 if ($objPage->tpl_classcat_find2[$id]) {386 $objErr->doFunc(array("µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));387 }388 $objErr->doFunc(array("¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));389 390 return $objErr->arrErr;375 global $objPage; 376 377 // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£ 378 $objErr = new SC_CheckError(); 379 380 $classcategory_id1 = "classcategory_id". $id. "_1"; 381 $classcategory_id2 = "classcategory_id". $id. "_2"; 382 $quantity = "quantity". $id; 383 // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯ 384 if ($objPage->tpl_classcat_find1[$id]) { 385 $objErr->doFunc(array("µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 386 } 387 if ($objPage->tpl_classcat_find2[$id]) { 388 $objErr->doFunc(array("µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 389 } 390 $objErr->doFunc(array("¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 391 392 return $objErr->arrErr; 391 393 } 392 394 393 395 // ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê 394 396 function lfGetSaleLimit($product) { 395 global $objPage;396 //ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礤¤¾ì¹ç397 if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) {398 $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX;399 } else {400 $objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit'];401 }402 403 return $objPage;397 global $objPage; 398 //ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礤¤¾ì¹ç 399 if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 400 $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 401 } else { 402 $objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit']; 403 } 404 405 return $objPage; 404 406 } 405 407 406 408 //»ÙʧÊýË¡¤Î¼èÆÀ 407 //payment_id 1:Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα409 //payment_id 1:Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα 408 410 function lfGetPayment() { 409 $objQuery = new SC_Query; 410 $col = "payment_id, rule, payment_method"; 411 $from = "dtb_payment"; 412 $where = "del_flg = 0"; 413 $order = "payment_id"; 414 $objQuery->setorder($order); 415 $arrRet = $objQuery->select($col, $from, $where); 416 return $arrRet; 417 } 418 411 $objQuery = new SC_Query; 412 $col = "payment_id, rule, payment_method"; 413 $from = "dtb_payment"; 414 $where = "del_flg = 0"; 415 $order = "payment_id"; 416 $objQuery->setorder($order); 417 $arrRet = $objQuery->select($col, $from, $where); 418 return $arrRet; 419 } 420 421 function lfconvertParam () { 422 global $objPage; 423 424 foreach ($objPage->arrForm as $key => $value) { 425 if (preg_match('/^quantity[0-9]+/', $key)) { 426 $objPage->arrForm[$key] 427 = htmlspecialchars($objPage->arrForm[$key], ENT_QUOTES, CHAR_CODE); 428 } 429 } 430 } 419 431 ?>
Note: See TracChangeset
for help on using the changeset viewer.
