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