| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
|---|
| 4 | * |
|---|
| 5 | * http://www.lockon.co.jp/ |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | require_once("../require.php"); |
|---|
| 9 | require_once(DATA_PATH . "include/page_layout.inc"); |
|---|
| 10 | |
|---|
| 11 | class LC_Page { |
|---|
| 12 | function LC_Page() { |
|---|
| 13 | /** ɬ¤º»ØÄꤹ¤ë **/ |
|---|
| 14 | global $arrSTATUS; |
|---|
| 15 | $this->arrSTATUS = $arrSTATUS; |
|---|
| 16 | global $arrSTATUS_IMAGE; |
|---|
| 17 | $this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE; |
|---|
| 18 | global $arrDELIVERYDATE; |
|---|
| 19 | $this->arrDELIVERYDATE = $arrDELIVERYDATE; |
|---|
| 20 | global $arrRECOMMEND; |
|---|
| 21 | $this->arrRECOMMEND = $arrRECOMMEND; |
|---|
| 22 | |
|---|
| 23 | //$this->tpl_mainpage="products/detail.tpl"; |
|---|
| 24 | |
|---|
| 25 | /* |
|---|
| 26 | session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç |
|---|
| 27 | ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤Î͸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£ |
|---|
| 28 | private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£ |
|---|
| 29 | */ |
|---|
| 30 | session_cache_limiter('private-no-expire'); |
|---|
| 31 | } |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | $objPage = new LC_Page(); |
|---|
| 35 | $objView = new SC_SiteView(); |
|---|
| 36 | $objCustomer = new SC_Customer(); |
|---|
| 37 | $objQuery = new SC_Query(); |
|---|
| 38 | |
|---|
| 39 | // ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ |
|---|
| 40 | $objPage = sfGetPageLayout($objPage, false, "products/detail.php"); |
|---|
| 41 | |
|---|
| 42 | // ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹ |
|---|
| 43 | $objFormParam = new SC_FormParam(); |
|---|
| 44 | // ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ |
|---|
| 45 | lfInitParam(); |
|---|
| 46 | // POSTÃͤμèÆÀ |
|---|
| 47 | $objFormParam->setParam($_POST); |
|---|
| 48 | |
|---|
| 49 | // ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹ |
|---|
| 50 | $objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR); |
|---|
| 51 | // ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ |
|---|
| 52 | lfInitFile(); |
|---|
| 53 | |
|---|
| 54 | // ´ÉÍý¥Ú¡¼¥¸¤«¤é¤Î³Îǧ¤Î¾ì¹ç¤Ï¡¢Èó¸ø³«¤Î¾¦Éʤâɽ¼¨¤¹¤ë¡£ |
|---|
| 55 | if($_GET['admin'] == 'on') { |
|---|
| 56 | $where = "del_flg = 0"; |
|---|
| 57 | } else { |
|---|
| 58 | $where = "del_flg = 0 AND status = 1"; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | if($_POST['mode'] != "") { |
|---|
| 62 | $tmp_id = $_POST['product_id']; |
|---|
| 63 | } else { |
|---|
| 64 | $tmp_id = $_GET['product_id']; |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | // ÃͤÎÀµÅöÀ¥Á¥§¥Ã¥¯ |
|---|
| 68 | if(!sfIsInt($_GET['product_id']) || !sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) { |
|---|
| 69 | sfDispSiteError(PRODUCT_NOT_FOUND); |
|---|
| 70 | } |
|---|
| 71 | // ¥í¥°¥¤¥óȽÄê |
|---|
| 72 | if($objCustomer->isLoginSuccess()) { |
|---|
| 73 | //¤ªµ¤¤ËÆþ¤ê¥Ü¥¿¥óɽ¼¨ |
|---|
| 74 | $objPage->tpl_login = true; |
|---|
| 75 | |
|---|
| 76 | /* ±ÜÍ÷¥í¥°µ¡Ç½¤Ï¸½ºß̤»ÈÍÑ |
|---|
| 77 | |
|---|
| 78 | $table = "dtb_customer_reading"; |
|---|
| 79 | $where = "customer_id = ? "; |
|---|
| 80 | $arrval[] = $objCustomer->getValue('customer_id'); |
|---|
| 81 | //¸ÜµÒ¤Î±ÜÍ÷¾¦ÉÊ¿ô |
|---|
| 82 | $rpcnt = $objQuery->count($table, $where, $arrval); |
|---|
| 83 | |
|---|
| 84 | //±ÜÍ÷¿ô¤¬ÀßÄê¿ô°Ê²¼ |
|---|
| 85 | if ($rpcnt < CUSTOMER_READING_MAX){ |
|---|
| 86 | //±ÜÍ÷ÍúÎò¤Ë¿·µ¬Äɲà |
|---|
| 87 | lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id')); |
|---|
| 88 | } else { |
|---|
| 89 | //±ÜÍ÷ÍúÎò¤ÎÃæ¤Ç°ìÈָŤ¤¤â¤Î¤òºï½ü¤·¤Æ¿·µ¬Äɲà |
|---|
| 90 | $oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?"; |
|---|
| 91 | $old = $objQuery->getone($oldsql, array($objCustomer->getValue("customer_id"))); |
|---|
| 92 | $where = "customer_id = ? AND update_date = ? "; |
|---|
| 93 | $arrval = array($objCustomer->getValue("customer_id"), $old); |
|---|
| 94 | //ºï½ü |
|---|
| 95 | $objQuery->delete($table, $where, $arrval); |
|---|
| 96 | //Äɲà |
|---|
| 97 | lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id')); |
|---|
| 98 | } |
|---|
| 99 | */ |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | // µ¬³ÊÁªÂò¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® |
|---|
| 104 | $objPage = lfMakeSelect($objPage, $tmp_id); |
|---|
| 105 | |
|---|
| 106 | // ¾¦ÉÊID¤òFORMÆâ¤ËÊÝ»ý¤¹¤ë¡£ |
|---|
| 107 | $objPage->tpl_product_id = $tmp_id; |
|---|
| 108 | |
|---|
| 109 | switch($_POST['mode']) { |
|---|
| 110 | case 'cart': |
|---|
| 111 | // ÆþÎÏÃͤÎÊÑ´¹ |
|---|
| 112 | $objFormParam->convParam(); |
|---|
| 113 | $objPage->arrErr = lfCheckError(); |
|---|
| 114 | if(count($objPage->arrErr) == 0) { |
|---|
| 115 | $objCartSess = new SC_CartSession(); |
|---|
| 116 | $classcategory_id1 = $_POST['classcategory_id1']; |
|---|
| 117 | $classcategory_id2 = $_POST['classcategory_id2']; |
|---|
| 118 | |
|---|
| 119 | // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç |
|---|
| 120 | if(!$objPage->tpl_classcat_find1) { |
|---|
| 121 | $classcategory_id1 = '0'; |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç |
|---|
| 125 | if(!$objPage->tpl_classcat_find2) { |
|---|
| 126 | $classcategory_id2 = '0'; |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); |
|---|
| 130 | $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $objFormParam->getValue('quantity')); |
|---|
| 131 | header("Location: " . URL_CART_TOP); |
|---|
| 132 | |
|---|
| 133 | exit; |
|---|
| 134 | } |
|---|
| 135 | break; |
|---|
| 136 | |
|---|
| 137 | default: |
|---|
| 138 | break; |
|---|
| 139 | } |
|---|
| 140 | |
|---|
| 141 | $objQuery = new SC_Query(); |
|---|
| 142 | // DB¤«¤é¾¦ÉʾðÊó¤ò¼èÆÀ¤¹¤ë¡£ |
|---|
| 143 | $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id)); |
|---|
| 144 | $objPage->arrProduct = $arrRet[0]; |
|---|
| 145 | |
|---|
| 146 | // ¾¦ÉÊ¥³¡¼¥É¤Î¼èÆÀ |
|---|
| 147 | $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code"; |
|---|
| 148 | $arrProductCode = $objQuery->getall($code_sql, array($tmp_id)); |
|---|
| 149 | $arrProductCode = sfswaparray($arrProductCode); |
|---|
| 150 | $objPage->arrProductCode = $arrProductCode["product_code"]; |
|---|
| 151 | |
|---|
| 152 | // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ |
|---|
| 153 | if($objPage->arrProduct['sale_unlimited'] == 1 || $objPage->arrProduct['sale_limit'] > SALE_LIMIT_MAX) { |
|---|
| 154 | $objPage->tpl_sale_limit = SALE_LIMIT_MAX; |
|---|
| 155 | } else { |
|---|
| 156 | $objPage->tpl_sale_limit = $objPage->arrProduct['sale_limit']; |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | // ¥µ¥Ö¥¿¥¤¥È¥ë¤ò¼èÆÀ |
|---|
| 160 | $arrFirstCat = GetFirstCat($arrRet[0]['category_id']); |
|---|
| 161 | $tpl_subtitle = $arrFirstCat['name']; |
|---|
| 162 | $objPage->tpl_subtitle = $tpl_subtitle; |
|---|
| 163 | |
|---|
| 164 | // DB¤«¤é¤Î¥Ç¡¼¥¿¤ò°ú¤·Ñ¤° |
|---|
| 165 | $objUpFile->setDBFileList($objPage->arrProduct); |
|---|
| 166 | // ¥Õ¥¡¥¤¥ëɽ¼¨ÍÑÇÛÎó¤òÅϤ¹ |
|---|
| 167 | $objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true); |
|---|
| 168 | // »ÙʧÊýË¡¤Î¼èÆÀ |
|---|
| 169 | $objPage->arrPayment = lfGetPayment(); |
|---|
| 170 | // ÆþÎϾðÊó¤òÅϤ¹ |
|---|
| 171 | $objPage->arrForm = $objFormParam->getFormParamList(); |
|---|
| 172 | //¥ì¥Ó¥å¡¼¾ðÊó¤Î¼èÆÀ |
|---|
| 173 | $objPage->arrReview = lfGetReviewData($tmp_id); |
|---|
| 174 | // ¥¿¥¤¥È¥ë¤Ë¾¦ÉÊ̾¤òÆþ¤ì¤ë |
|---|
| 175 | $objPage->tpl_title = "¾¦Éʾܺ٠". $objPage->arrProduct["name"]; |
|---|
| 176 | //¥ª¥¹¥¹¥á¾¦ÉʾðÊóɽ¼¨ |
|---|
| 177 | $objPage->arrRecommend = lfPreGetRecommendProducts($tmp_id); |
|---|
| 178 | //¤³¤Î¾¦ÉʤòÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉʤâÇã¤Ã¤Æ¤¤¤Þ¤¹ |
|---|
| 179 | $objPage->arrRelateProducts = lfGetRelateProducts($tmp_id); |
|---|
| 180 | |
|---|
| 181 | // ³ÈÂç²èÁü¤Î¥¦¥£¥ó¥É¥¦¥µ¥¤¥º¤ò¥»¥Ã¥È |
|---|
| 182 | list($large_width, $large_height) = getimagesize(IMAGE_SAVE_DIR . basename($objPage->arrFile["main_large_image"]["filepath"])); |
|---|
| 183 | $objPage->tpl_large_width = $large_width + 60; |
|---|
| 184 | $objPage->tpl_large_height = $large_height + 80; |
|---|
| 185 | |
|---|
| 186 | $objView->assignobj($objPage); |
|---|
| 187 | $objView->display(SITE_FRAME); |
|---|
| 188 | //----------------------------------------------------------------------------------------------------------------------------------- |
|---|
| 189 | /* ¥Õ¥¡¥¤¥ë¾ðÊó¤Î½é´ü²½ */ |
|---|
| 190 | function lfInitFile() { |
|---|
| 191 | global $objUpFile; |
|---|
| 192 | $objUpFile->addFile("°ìÍ÷-¥á¥¤¥ó²èÁü", 'main_list_image', array('jpg','gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); |
|---|
| 193 | $objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó²èÁü", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT); |
|---|
| 194 | $objUpFile->addFile("¾ÜºÙ-¥á¥¤¥ó³ÈÂç²èÁü", 'main_large_image', array('jpg'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT); |
|---|
| 195 | for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { |
|---|
| 196 | $objUpFile->addFile("¾ÜºÙ-¥µ¥Ö²èÁü$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT); |
|---|
| 197 | $objUpFile->addFile("¾ÜºÙ-¥µ¥Ö³ÈÂç²èÁü$cnt", "sub_large_image$cnt", array('jpg'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT); |
|---|
| 198 | } |
|---|
| 199 | $objUpFile->addFile("¾¦ÉÊÈæ³Ó²èÁü", 'file1', array('jpg'), IMAGE_SIZE, false, NORMAL_IMAGE_HEIGHT, NORMAL_IMAGE_HEIGHT); |
|---|
| 200 | $objUpFile->addFile("¾¦Éʾܺ٥ե¡¥¤¥ë", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false); |
|---|
| 201 | } |
|---|
| 202 | |
|---|
| 203 | /* µ¬³ÊÁªÂò¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */ |
|---|
| 204 | function lfMakeSelect($objPage, $product_id) { |
|---|
| 205 | global $objPage; |
|---|
| 206 | $classcat_find1 = false; |
|---|
| 207 | $classcat_find2 = false; |
|---|
| 208 | // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎÍ̵ |
|---|
| 209 | $stock_find = false; |
|---|
| 210 | |
|---|
| 211 | // µ¬³Ê̾°ìÍ÷ |
|---|
| 212 | $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); |
|---|
| 213 | // µ¬³ÊʬÎà̾°ìÍ÷ |
|---|
| 214 | $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); |
|---|
| 215 | // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ |
|---|
| 216 | $arrProductsClass = lfGetProductsClass($product_id); |
|---|
| 217 | |
|---|
| 218 | // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ |
|---|
| 219 | $objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']]; |
|---|
| 220 | // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ |
|---|
| 221 | $objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']]; |
|---|
| 222 | |
|---|
| 223 | // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô |
|---|
| 224 | $count = count($arrProductsClass); |
|---|
| 225 | |
|---|
| 226 | $classcat_id1 = ""; |
|---|
| 227 | |
|---|
| 228 | $arrSele = array(); |
|---|
| 229 | $arrList = array(); |
|---|
| 230 | |
|---|
| 231 | $list_id = 0; |
|---|
| 232 | $arrList[0] = "\tlist0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'"; |
|---|
| 233 | $arrVal[0] = "\tval0 = new Array(''"; |
|---|
| 234 | |
|---|
| 235 | for ($i = 0; $i < $count; $i++) { |
|---|
| 236 | // ºß¸Ë¤Î¥Á¥§¥Ã¥¯ |
|---|
| 237 | if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { |
|---|
| 238 | continue; |
|---|
| 239 | } |
|---|
| 240 | |
|---|
| 241 | $stock_find = true; |
|---|
| 242 | |
|---|
| 243 | // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ |
|---|
| 244 | if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ |
|---|
| 245 | $arrList[$list_id].=");\n"; |
|---|
| 246 | $arrVal[$list_id].=");\n"; |
|---|
| 247 | $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; |
|---|
| 248 | $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1]; |
|---|
| 249 | $list_id++; |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ |
|---|
| 253 | $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; |
|---|
| 254 | |
|---|
| 255 | // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ |
|---|
| 256 | if($arrList[$list_id] == "") { |
|---|
| 257 | $arrList[$list_id] = "\tlist".$list_id." = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '".$arrClassCatName[$classcat_id2]."'"; |
|---|
| 258 | } else { |
|---|
| 259 | $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; |
|---|
| 260 | } |
|---|
| 261 | |
|---|
| 262 | // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ |
|---|
| 263 | if($arrVal[$list_id] == "") { |
|---|
| 264 | $arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'"; |
|---|
| 265 | } else { |
|---|
| 266 | $arrVal[$list_id].= ", '".$classcat_id2."'"; |
|---|
| 267 | } |
|---|
| 268 | } |
|---|
| 269 | |
|---|
| 270 | $arrList[$list_id].=");\n"; |
|---|
| 271 | $arrVal[$list_id].=");\n"; |
|---|
| 272 | |
|---|
| 273 | // µ¬³Ê1 |
|---|
| 274 | $objPage->arrClassCat1 = $arrSele; |
|---|
| 275 | |
|---|
| 276 | $lists = "\tlists = new Array("; |
|---|
| 277 | $no = 0; |
|---|
| 278 | |
|---|
| 279 | foreach($arrList as $val) { |
|---|
| 280 | $objPage->tpl_javascript.= $val; |
|---|
| 281 | if ($no != 0) { |
|---|
| 282 | $lists.= ",list".$no; |
|---|
| 283 | } else { |
|---|
| 284 | $lists.= "list".$no; |
|---|
| 285 | } |
|---|
| 286 | $no++; |
|---|
| 287 | } |
|---|
| 288 | $objPage->tpl_javascript.=$lists.");\n"; |
|---|
| 289 | |
|---|
| 290 | $vals = "\tvals = new Array("; |
|---|
| 291 | $no = 0; |
|---|
| 292 | |
|---|
| 293 | foreach($arrVal as $val) { |
|---|
| 294 | $objPage->tpl_javascript.= $val; |
|---|
| 295 | if ($no != 0) { |
|---|
| 296 | $vals.= ",val".$no; |
|---|
| 297 | } else { |
|---|
| 298 | $vals.= "val".$no; |
|---|
| 299 | } |
|---|
| 300 | $no++; |
|---|
| 301 | } |
|---|
| 302 | $objPage->tpl_javascript.=$vals.");\n"; |
|---|
| 303 | |
|---|
| 304 | // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID |
|---|
| 305 | $objPage->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . $_POST['classcategory_id2'] . "');"; |
|---|
| 306 | |
|---|
| 307 | // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë |
|---|
| 308 | if($arrProductsClass[0]['classcategory_id1'] != '0') { |
|---|
| 309 | $classcat_find1 = true; |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë |
|---|
| 313 | if($arrProductsClass[0]['classcategory_id2'] != '0') { |
|---|
| 314 | $classcat_find2 = true; |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | $objPage->tpl_classcat_find1 = $classcat_find1; |
|---|
| 318 | $objPage->tpl_classcat_find2 = $classcat_find2; |
|---|
| 319 | $objPage->tpl_stock_find = $stock_find; |
|---|
| 320 | |
|---|
| 321 | return $objPage; |
|---|
| 322 | } |
|---|
| 323 | |
|---|
| 324 | /* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */ |
|---|
| 325 | function lfInitParam() { |
|---|
| 326 | global $objFormParam; |
|---|
| 327 | |
|---|
| 328 | $objFormParam->addParam("µ¬³Ê1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); |
|---|
| 329 | $objFormParam->addParam("µ¬³Ê2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); |
|---|
| 330 | $objFormParam->addParam("¸Ä¿ô", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); |
|---|
| 331 | } |
|---|
| 332 | |
|---|
| 333 | /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ */ |
|---|
| 334 | function lfGetProductsClass($product_id) { |
|---|
| 335 | $arrRet = array(); |
|---|
| 336 | if(sfIsInt($product_id)) { |
|---|
| 337 | // ¾¦Éʵ¬³Ê¼èÆÀ |
|---|
| 338 | $objQuery = new SC_Query(); |
|---|
| 339 | $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; |
|---|
| 340 | $table = "vw_product_class AS prdcls"; |
|---|
| 341 | $where = "product_id = ?"; |
|---|
| 342 | $objQuery->setorder("rank1 DESC, rank2 DESC"); |
|---|
| 343 | $arrRet = $objQuery->select($col, $table, $where, array($product_id)); |
|---|
| 344 | } |
|---|
| 345 | return $arrRet; |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | /* ÅÐÏ¿ºÑ¤ß¥ª¥¹¥¹¥á¾¦ÉÊ¤ÎÆÉ¤ß¹þ¤ß */ |
|---|
| 349 | function lfPreGetRecommendProducts($product_id) { |
|---|
| 350 | $objQuery = new SC_Query(); |
|---|
| 351 | $objQuery->setorder("rank DESC"); |
|---|
| 352 | $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id)); |
|---|
| 353 | $max = count($arrRet); |
|---|
| 354 | $no = 0; |
|---|
| 355 | for($i = 0; $i < $max; $i++) { |
|---|
| 356 | $where = "del_flg = 0 AND product_id = ? AND status = 1"; |
|---|
| 357 | $arrProductInfo = $objQuery->select("main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate", "vw_products_allclass AS allcls", $where, array($arrRet[$i]['recommend_product_id'])); |
|---|
| 358 | |
|---|
| 359 | if(count($arrProductInfo) > 0) { |
|---|
| 360 | $arrRecommend[$no] = $arrProductInfo[0]; |
|---|
| 361 | $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id']; |
|---|
| 362 | $arrRecommend[$no]['comment'] = $arrRet[$i]['comment']; |
|---|
| 363 | $no++; |
|---|
| 364 | } |
|---|
| 365 | } |
|---|
| 366 | return $arrRecommend; |
|---|
| 367 | } |
|---|
| 368 | |
|---|
| 369 | /* ÆþÎÏÆâÍÆ¤Î¥Á¥§¥Ã¥¯ */ |
|---|
| 370 | function lfCheckError() { |
|---|
| 371 | global $objFormParam; |
|---|
| 372 | global $objPage; |
|---|
| 373 | // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£ |
|---|
| 374 | $arrRet = $objFormParam->getHashArray(); |
|---|
| 375 | $objErr = new SC_CheckError($arrRet); |
|---|
| 376 | $objErr->arrErr = $objFormParam->checkError(); |
|---|
| 377 | |
|---|
| 378 | // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯ |
|---|
| 379 | if ($objPage->tpl_classcat_find1) { |
|---|
| 380 | $objErr->doFunc(array("µ¬³Ê1", "classcategory_id1"), array("EXIST_CHECK")); |
|---|
| 381 | } |
|---|
| 382 | if ($objPage->tpl_classcat_find2) { |
|---|
| 383 | $objErr->doFunc(array("µ¬³Ê2", "classcategory_id2"), array("EXIST_CHECK")); |
|---|
| 384 | } |
|---|
| 385 | |
|---|
| 386 | return $objErr->arrErr; |
|---|
| 387 | } |
|---|
| 388 | |
|---|
| 389 | //±ÜÍ÷ÍúÎò¿·µ¬ÅÐÏ¿ |
|---|
| 390 | function lfRegistReadingData($tmp_id, $customer_id){ |
|---|
| 391 | $objQuery = new SC_Query; |
|---|
| 392 | $sqlval['customer_id'] = $customer_id; |
|---|
| 393 | $sqlval['reading_product_id'] = $tmp_id; |
|---|
| 394 | $sqlval['create_date'] = 'NOW()'; |
|---|
| 395 | $sqlval['update_date'] = 'NOW()'; |
|---|
| 396 | $objQuery->insert("dtb_customer_reading", $sqlval); |
|---|
| 397 | } |
|---|
| 398 | |
|---|
| 399 | //¤³¤Î¾¦ÉʤòÇã¤Ã¤¿¿Í¤Ï¤³¤ó¤Ê¾¦ÉʤâÇã¤Ã¤Æ¤¤¤Þ¤¹ |
|---|
| 400 | function lfGetRelateProducts($tmp_id) { |
|---|
| 401 | $objQuery = new SC_Query; |
|---|
| 402 | //¼«Æ°Ãê½Ð |
|---|
| 403 | $objQuery->setorder("random()"); |
|---|
| 404 | //ɽ¼¨·ï¿ô¤ÎÀ©¸Â |
|---|
| 405 | $objQuery->setlimit(RELATED_PRODUCTS_MAX); |
|---|
| 406 | //¸¡º÷¾ò·ï |
|---|
| 407 | $col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate"; |
|---|
| 408 | $from = "vw_products_allclass AS allcls "; |
|---|
| 409 | $where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? "; |
|---|
| 410 | $arrval[] = $tmp_id; |
|---|
| 411 | //·ë²Ì¤Î¼èÆÀ |
|---|
| 412 | $arrProducts = $objQuery->select($col, $from, $where, $arrval); |
|---|
| 413 | |
|---|
| 414 | return $arrProducts; |
|---|
| 415 | } |
|---|
| 416 | |
|---|
| 417 | //¾¦Éʤ´¤È¤Î¥ì¥Ó¥å¡¼¾ðÊó¤ò¼èÆÀ¤¹¤ë |
|---|
| 418 | function lfGetReviewData($id) { |
|---|
| 419 | $objQuery = new SC_Query; |
|---|
| 420 | //¾¦Éʤ´¤È¤Î¥ì¥Ó¥å¡¼¾ðÊó¤ò¼èÆÀ¤¹¤ë |
|---|
| 421 | $col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment"; |
|---|
| 422 | $from = "dtb_review"; |
|---|
| 423 | $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . REVIEW_REGIST_MAX; |
|---|
| 424 | $arrval[] = $id; |
|---|
| 425 | $arrReview = $objQuery->select($col, $from, $where, $arrval); |
|---|
| 426 | return $arrReview; |
|---|
| 427 | } |
|---|
| 428 | |
|---|
| 429 | //»ÙʧÊýË¡¤Î¼èÆÀ |
|---|
| 430 | //payment_id 1:¥¯¥ì¥¸¥Ã¥È¡¡2:¥·¥ç¥Ã¥Ô¥ó¥°¥í¡¼¥ó |
|---|
| 431 | function lfGetPayment() { |
|---|
| 432 | $objQuery = new SC_Query; |
|---|
| 433 | $col = "payment_id, rule, payment_method"; |
|---|
| 434 | $from = "dtb_payment"; |
|---|
| 435 | $where = "del_flg = 0"; |
|---|
| 436 | $order = "payment_id"; |
|---|
| 437 | $objQuery->setorder($order); |
|---|
| 438 | $arrRet = $objQuery->select($col, $from, $where); |
|---|
| 439 | return $arrRet; |
|---|
| 440 | } |
|---|
| 441 | |
|---|
| 442 | ?> |
|---|