1 | <?php |
---|
2 | /* |
---|
3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
4 | * |
---|
5 | * http://www.lockon.co.jp/ |
---|
6 | */ |
---|
7 | |
---|
8 | // {{{ requires |
---|
9 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
---|
10 | |
---|
11 | /** |
---|
12 | * 商品詳細 のページクラス. |
---|
13 | * |
---|
14 | * @package Page |
---|
15 | * @author LOCKON CO.,LTD. |
---|
16 | * @version $Id$ |
---|
17 | */ |
---|
18 | class LC_Page_Products_Detail extends LC_Page { |
---|
19 | |
---|
20 | /** ステータス */ |
---|
21 | var $arrSTATUS; |
---|
22 | |
---|
23 | /** ステータス画像 */ |
---|
24 | var $arrSTATUS_IMAGE; |
---|
25 | |
---|
26 | /** 発送予定日 */ |
---|
27 | var $arrDELIVERYDATE; |
---|
28 | |
---|
29 | /** おすすめレベル */ |
---|
30 | var $arrRECOMMEND; |
---|
31 | |
---|
32 | /** フォームパラメータ */ |
---|
33 | var $objFormParam; |
---|
34 | |
---|
35 | /** アップロードファイル */ |
---|
36 | var $objUpFile; |
---|
37 | |
---|
38 | // }}} |
---|
39 | // {{{ functions |
---|
40 | |
---|
41 | /** |
---|
42 | * Page を初期化する. |
---|
43 | * |
---|
44 | * @return void |
---|
45 | */ |
---|
46 | function init() { |
---|
47 | parent::init(); |
---|
48 | $masterData = new SC_DB_MasterData_Ex(); |
---|
49 | $this->arrSTATUS = $masterData->getMasterData("mtb_status"); |
---|
50 | $this->arrSTATUS_IMAGE = $masterData->getMasterData("mtb_status_image"); |
---|
51 | $this->arrDELIVERYDATE = $masterData->getMasterData("mtb_delivery_date"); |
---|
52 | $this->arrRECOMMEND = $masterData->getMasterData("mtb_recommend"); |
---|
53 | } |
---|
54 | |
---|
55 | /** |
---|
56 | * Page のプロセス. |
---|
57 | * |
---|
58 | * @return void |
---|
59 | */ |
---|
60 | function process() { |
---|
61 | $objView = new SC_SiteView(); |
---|
62 | $objCustomer = new SC_Customer(); |
---|
63 | $objQuery = new SC_Query(); |
---|
64 | $objDb = new SC_Helper_DB_Ex(); |
---|
65 | |
---|
66 | // レイアウトデザインを取得 |
---|
67 | $helper = new SC_Helper_PageLayout_Ex(); |
---|
68 | $helper->sfGetPageLayout($this, false, "products/detail.php"); |
---|
69 | |
---|
70 | // パラメータ管理クラス |
---|
71 | $this->objFormParam = new SC_FormParam(); |
---|
72 | // パラメータ情報の初期化 |
---|
73 | $this->lfInitParam(); |
---|
74 | // POST値の取得 |
---|
75 | $this->objFormParam->setParam($_POST); |
---|
76 | |
---|
77 | // ファイル管理クラス |
---|
78 | $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR); |
---|
79 | // ファイル情報の初期化 |
---|
80 | $this->lfInitFile(); |
---|
81 | |
---|
82 | // 管理ページからの確認の場合は、非公開の商品も表示する。 |
---|
83 | if(isset($_GET['admin']) && $_GET['admin'] == 'on') { |
---|
84 | $where = "del_flg = 0"; |
---|
85 | } else { |
---|
86 | $where = "del_flg = 0 AND status = 1"; |
---|
87 | } |
---|
88 | |
---|
89 | if(isset($_POST['mode']) && $_POST['mode'] != "") { |
---|
90 | $tmp_id = $_POST['product_id']; |
---|
91 | } else { |
---|
92 | $tmp_id = $_GET['product_id']; |
---|
93 | } |
---|
94 | |
---|
95 | // 値の正当性チェック |
---|
96 | if(!SC_Utils_Ex::sfIsInt($_GET['product_id']) |
---|
97 | || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) { |
---|
98 | SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); |
---|
99 | } |
---|
100 | // ログイン判定 |
---|
101 | if($objCustomer->isLoginSuccess()) { |
---|
102 | //お気に入りボタン表示 |
---|
103 | $this->tpl_login = true; |
---|
104 | |
---|
105 | /* 閲覧ログ機能は現在未使用 |
---|
106 | |
---|
107 | $table = "dtb_customer_reading"; |
---|
108 | $where = "customer_id = ? "; |
---|
109 | $arrval[] = $objCustomer->getValue('customer_id'); |
---|
110 | //顧客の閲覧商品数 |
---|
111 | $rpcnt = $objQuery->count($table, $where, $arrval); |
---|
112 | |
---|
113 | //閲覧数が設定数以下 |
---|
114 | if ($rpcnt < CUSTOMER_READING_MAX){ |
---|
115 | //閲覧履歴に新規追加 |
---|
116 | lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id')); |
---|
117 | } else { |
---|
118 | //閲覧履歴の中で一番古いものを削除して新規追加 |
---|
119 | $oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?"; |
---|
120 | $old = $objQuery->getone($oldsql, array($objCustomer->getValue("customer_id"))); |
---|
121 | $where = "customer_id = ? AND update_date = ? "; |
---|
122 | $arrval = array($objCustomer->getValue("customer_id"), $old); |
---|
123 | //削除 |
---|
124 | $objQuery->delete($table, $where, $arrval); |
---|
125 | //追加 |
---|
126 | lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id')); |
---|
127 | } |
---|
128 | */ |
---|
129 | } |
---|
130 | |
---|
131 | |
---|
132 | // 規格選択セレクトボックスの作成 |
---|
133 | $this->lfMakeSelect($tmp_id); |
---|
134 | |
---|
135 | // 商品IDをFORM内に保持する。 |
---|
136 | $this->tpl_product_id = $tmp_id; |
---|
137 | |
---|
138 | if (!isset($_['mode'])) $_POST['mode'] = ""; |
---|
139 | |
---|
140 | switch($_POST['mode']) { |
---|
141 | case 'cart': |
---|
142 | // 入力値の変換 |
---|
143 | $this->objFormParam->convParam(); |
---|
144 | $this->arrErr = $this->lfCheckError(); |
---|
145 | if(count($this->arrErr) == 0) { |
---|
146 | $objCartSess = new SC_CartSession(); |
---|
147 | $classcategory_id1 = $_POST['classcategory_id1']; |
---|
148 | $classcategory_id2 = $_POST['classcategory_id2']; |
---|
149 | |
---|
150 | // 規格1が設定されていない場合 |
---|
151 | if(!$this->tpl_classcat_find1) { |
---|
152 | $classcategory_id1 = '0'; |
---|
153 | } |
---|
154 | |
---|
155 | // 規格2が設定されていない場合 |
---|
156 | if(!$this->tpl_classcat_find2) { |
---|
157 | $classcategory_id2 = '0'; |
---|
158 | } |
---|
159 | |
---|
160 | $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); |
---|
161 | $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity')); |
---|
162 | $this->sendRedirect($this->getLocation(URL_CART_TOP)); |
---|
163 | exit; |
---|
164 | } |
---|
165 | break; |
---|
166 | |
---|
167 | default: |
---|
168 | break; |
---|
169 | } |
---|
170 | |
---|
171 | $objQuery = new SC_Query(); |
---|
172 | // DBから商品情報を取得する。 |
---|
173 | $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id)); |
---|
174 | $this->arrProduct = $arrRet[0]; |
---|
175 | |
---|
176 | // 商品コードの取得 |
---|
177 | $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code"; |
---|
178 | $arrProductCode = $objQuery->getall($code_sql, array($tmp_id)); |
---|
179 | $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode); |
---|
180 | $this->arrProductCode = $arrProductCode["product_code"]; |
---|
181 | |
---|
182 | // 購入制限数を取得 |
---|
183 | if($this->arrProduct['sale_unlimited'] == 1 || $this->arrProduct['sale_limit'] > SALE_LIMIT_MAX) { |
---|
184 | $this->tpl_sale_limit = SALE_LIMIT_MAX; |
---|
185 | } else { |
---|
186 | $this->tpl_sale_limit = $this->arrProduct['sale_limit']; |
---|
187 | } |
---|
188 | |
---|
189 | // サブタイトルを取得 |
---|
190 | $arrFirstCat = $objDb->sfGetFirstCat($arrRet[0]['category_id']); |
---|
191 | $this->tpl_subtitle = $arrFirstCat['name']; |
---|
192 | |
---|
193 | // DBからのデータを引き継ぐ |
---|
194 | $this->objUpFile->setDBFileList($this->arrProduct); |
---|
195 | // ファイル表示用配列を渡す |
---|
196 | $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true); |
---|
197 | // 支払方法の取得 |
---|
198 | $this->arrPayment = $this->lfGetPayment(); |
---|
199 | // 入力情報を渡す |
---|
200 | $this->arrForm = $this->objFormParam->getFormParamList(); |
---|
201 | //レビュー情報の取得 |
---|
202 | $this->arrReview = $this->lfGetReviewData($tmp_id); |
---|
203 | // トラックバック情報の取得 |
---|
204 | |
---|
205 | // トラックバック機能の稼働状況チェック |
---|
206 | if (SC_Utils_Ex::sfGetSiteControlFlg(SITE_CONTROL_TRACKBACK) != 1) { |
---|
207 | $this->arrTrackbackView = "OFF"; |
---|
208 | } else { |
---|
209 | $this->arrTrackbackView = "ON"; |
---|
210 | $this->arrTrackback = $this->lfGetTrackbackData($tmp_id); |
---|
211 | } |
---|
212 | $this->trackback_url = TRACKBACK_TO_URL . $tmp_id; |
---|
213 | // タイトルに商品名を入れる |
---|
214 | $this->tpl_title = "商品詳細 ". $this->arrProduct["name"]; |
---|
215 | //オススメ商品情報表示 |
---|
216 | $this->arrRecommend = $this->lfPreGetRecommendProducts($tmp_id); |
---|
217 | //この商品を買った人はこんな商品も買っています |
---|
218 | $this->arrRelateProducts = $this->lfGetRelateProducts($tmp_id); |
---|
219 | |
---|
220 | // 拡大画像のウィンドウサイズをセット |
---|
221 | $image_path = IMAGE_SAVE_DIR . basename($this->arrFile["main_large_image"]["filepath"]); |
---|
222 | list($large_width, $large_height) = getimagesize($image_path); |
---|
223 | $this->tpl_large_width = $large_width + 60; |
---|
224 | $this->tpl_large_height = $large_height + 80; |
---|
225 | |
---|
226 | $this->lfConvertParam(); |
---|
227 | |
---|
228 | $objView->assignobj($this); |
---|
229 | $objView->display(SITE_FRAME); |
---|
230 | } |
---|
231 | |
---|
232 | /** |
---|
233 | * デストラクタ. |
---|
234 | * |
---|
235 | * @return void |
---|
236 | */ |
---|
237 | function destroy() { |
---|
238 | parent::destroy(); |
---|
239 | } |
---|
240 | |
---|
241 | /* ファイル情報の初期化 */ |
---|
242 | function lfInitFile() { |
---|
243 | $this->objUpFile->addFile("一覧-メイン画像", 'main_list_image', array('jpg','gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); |
---|
244 | $this->objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT); |
---|
245 | $this->objUpFile->addFile("詳細-メイン拡大画像", 'main_large_image', array('jpg'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT); |
---|
246 | for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { |
---|
247 | $this->objUpFile->addFile("詳細-サブ画像$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT); |
---|
248 | $this->objUpFile->addFile("詳細-サブ拡大画像$cnt", "sub_large_image$cnt", array('jpg'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT); |
---|
249 | } |
---|
250 | $this->objUpFile->addFile("商品比較画像", 'file1', array('jpg'), IMAGE_SIZE, false, NORMAL_IMAGE_HEIGHT, NORMAL_IMAGE_HEIGHT); |
---|
251 | $this->objUpFile->addFile("商品詳細ファイル", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false); |
---|
252 | } |
---|
253 | |
---|
254 | /* 規格選択セレクトボックスの作成 */ |
---|
255 | function lfMakeSelect($product_id) { |
---|
256 | |
---|
257 | $objDb = new SC_Helper_DB_Ex(); |
---|
258 | $classcat_find1 = false; |
---|
259 | $classcat_find2 = false; |
---|
260 | // 在庫ありの商品の有無 |
---|
261 | $stock_find = false; |
---|
262 | |
---|
263 | // 規格名一覧 |
---|
264 | $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name"); |
---|
265 | // 規格分類名一覧 |
---|
266 | $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); |
---|
267 | // 商品規格情報の取得 |
---|
268 | $arrProductsClass = $this->lfGetProductsClass($product_id); |
---|
269 | |
---|
270 | // 規格1クラス名の取得 |
---|
271 | $this->tpl_class_name1 = isset($arrClassName[$arrProductsClass[0]['class_id1']]) |
---|
272 | ? $arrClassName[$arrProductsClass[0]['class_id1']] : ""; |
---|
273 | // 規格2クラス名の取得 |
---|
274 | $this->tpl_class_name2 = isset($arrClassName[$arrProductsClass[0]['class_id2']]) |
---|
275 | ? $arrClassName[$arrProductsClass[0]['class_id2']] : ""; |
---|
276 | |
---|
277 | // すべての組み合わせ数 |
---|
278 | $count = count($arrProductsClass); |
---|
279 | |
---|
280 | $classcat_id1 = ""; |
---|
281 | |
---|
282 | $arrSele = array(); |
---|
283 | $arrList = array(); |
---|
284 | |
---|
285 | $list_id = 0; |
---|
286 | $arrList[0] = "\tlist0 = new Array('選択してください'"; |
---|
287 | $arrVal[0] = "\tval0 = new Array(''"; |
---|
288 | |
---|
289 | for ($i = 0; $i < $count; $i++) { |
---|
290 | // 在庫のチェック |
---|
291 | if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { |
---|
292 | continue; |
---|
293 | } |
---|
294 | |
---|
295 | $stock_find = true; |
---|
296 | |
---|
297 | // 規格1のセレクトボックス用 |
---|
298 | if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ |
---|
299 | $arrList[$list_id].=");\n"; |
---|
300 | $arrVal[$list_id].=");\n"; |
---|
301 | $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; |
---|
302 | $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1]; |
---|
303 | $list_id++; |
---|
304 | } |
---|
305 | |
---|
306 | // 規格2のセレクトボックス用 |
---|
307 | $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; |
---|
308 | |
---|
309 | // セレクトボックス表示値 |
---|
310 | if (!isset($arrList[$list_id])) $arrList[$list_id] = ""; |
---|
311 | if($arrList[$list_id] == "") { |
---|
312 | $arrList[$list_id] = "\tlist".$list_id." = new Array('選択してください', '".$arrClassCatName[$classcat_id2]."'"; |
---|
313 | } else { |
---|
314 | $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; |
---|
315 | } |
---|
316 | |
---|
317 | // セレクトボックスPOST値 |
---|
318 | if (!isset($arrVal[$list_id])) $arrVal[$list_id] = ""; |
---|
319 | if($arrVal[$list_id] == "") { |
---|
320 | $arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'"; |
---|
321 | } else { |
---|
322 | $arrVal[$list_id].= ", '".$classcat_id2."'"; |
---|
323 | } |
---|
324 | } |
---|
325 | |
---|
326 | $arrList[$list_id].=");\n"; |
---|
327 | $arrVal[$list_id].=");\n"; |
---|
328 | |
---|
329 | // 規格1 |
---|
330 | $this->arrClassCat1 = $arrSele; |
---|
331 | |
---|
332 | $lists = "\tlists = new Array("; |
---|
333 | $no = 0; |
---|
334 | |
---|
335 | foreach($arrList as $val) { |
---|
336 | $this->tpl_javascript.= $val; |
---|
337 | if ($no != 0) { |
---|
338 | $lists.= ",list".$no; |
---|
339 | } else { |
---|
340 | $lists.= "list".$no; |
---|
341 | } |
---|
342 | $no++; |
---|
343 | } |
---|
344 | $this->tpl_javascript.=$lists.");\n"; |
---|
345 | |
---|
346 | $vals = "\tvals = new Array("; |
---|
347 | $no = 0; |
---|
348 | |
---|
349 | foreach($arrVal as $val) { |
---|
350 | $this->tpl_javascript.= $val; |
---|
351 | if ($no != 0) { |
---|
352 | $vals.= ",val".$no; |
---|
353 | } else { |
---|
354 | $vals.= "val".$no; |
---|
355 | } |
---|
356 | $no++; |
---|
357 | } |
---|
358 | $this->tpl_javascript.=$vals.");\n"; |
---|
359 | |
---|
360 | // 選択されている規格2ID |
---|
361 | if (!isset($_POST['classcategory_id2'])) $_POST['classcategory_id2'] = ""; |
---|
362 | $this->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . htmlspecialchars($_POST['classcategory_id2'], ENT_QUOTES) . "');"; |
---|
363 | |
---|
364 | // 規格1が設定されている |
---|
365 | if($arrProductsClass[0]['classcategory_id1'] != '0') { |
---|
366 | $classcat_find1 = true; |
---|
367 | } |
---|
368 | |
---|
369 | // 規格2が設定されている |
---|
370 | if($arrProductsClass[0]['classcategory_id2'] != '0') { |
---|
371 | $classcat_find2 = true; |
---|
372 | } |
---|
373 | |
---|
374 | $this->tpl_classcat_find1 = $classcat_find1; |
---|
375 | $this->tpl_classcat_find2 = $classcat_find2; |
---|
376 | $this->tpl_stock_find = $stock_find; |
---|
377 | } |
---|
378 | |
---|
379 | /* パラメータ情報の初期化 */ |
---|
380 | function lfInitParam() { |
---|
381 | $this->objFormParam->addParam("規格1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); |
---|
382 | $this->objFormParam->addParam("規格2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); |
---|
383 | $this->objFormParam->addParam("個数", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); |
---|
384 | } |
---|
385 | |
---|
386 | /* 商品規格情報の取得 */ |
---|
387 | function lfGetProductsClass($product_id) { |
---|
388 | $arrRet = array(); |
---|
389 | if(SC_Utils_Ex::sfIsInt($product_id)) { |
---|
390 | // 商品規格取得 |
---|
391 | $objQuery = new SC_Query(); |
---|
392 | $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; |
---|
393 | $table = "vw_product_class AS prdcls"; |
---|
394 | $where = "product_id = ?"; |
---|
395 | $objQuery->setorder("rank1 DESC, rank2 DESC"); |
---|
396 | $arrRet = $objQuery->select($col, $table, $where, array($product_id)); |
---|
397 | } |
---|
398 | return $arrRet; |
---|
399 | } |
---|
400 | |
---|
401 | /* 登録済みオススメ商品の読み込み */ |
---|
402 | function lfPreGetRecommendProducts($product_id) { |
---|
403 | $arrRecommend = array(); |
---|
404 | $objQuery = new SC_Query(); |
---|
405 | $objQuery->setorder("rank DESC"); |
---|
406 | $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id)); |
---|
407 | $max = count($arrRet); |
---|
408 | $no = 0; |
---|
409 | for($i = 0; $i < $max; $i++) { |
---|
410 | $where = "del_flg = 0 AND product_id = ? AND status = 1"; |
---|
411 | $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'])); |
---|
412 | |
---|
413 | if(count($arrProductInfo) > 0) { |
---|
414 | $arrRecommend[$no] = $arrProductInfo[0]; |
---|
415 | $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id']; |
---|
416 | $arrRecommend[$no]['comment'] = $arrRet[$i]['comment']; |
---|
417 | $no++; |
---|
418 | } |
---|
419 | } |
---|
420 | return $arrRecommend; |
---|
421 | } |
---|
422 | |
---|
423 | /* 入力内容のチェック */ |
---|
424 | function lfCheckError() { |
---|
425 | // 入力データを渡す。 |
---|
426 | $arrRet = $this->objFormParam->getHashArray(); |
---|
427 | $objErr = new SC_CheckError($arrRet); |
---|
428 | $objErr->arrErr = $this->objFormParam->checkError(); |
---|
429 | |
---|
430 | // 複数項目チェック |
---|
431 | if ($this->tpl_classcat_find1) { |
---|
432 | $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK")); |
---|
433 | } |
---|
434 | if ($this->tpl_classcat_find2) { |
---|
435 | $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK")); |
---|
436 | } |
---|
437 | |
---|
438 | return $objErr->arrErr; |
---|
439 | } |
---|
440 | |
---|
441 | //閲覧履歴新規登録 |
---|
442 | function lfRegistReadingData($tmp_id, $customer_id){ |
---|
443 | $objQuery = new SC_Query; |
---|
444 | $sqlval['customer_id'] = $customer_id; |
---|
445 | $sqlval['reading_product_id'] = $tmp_id; |
---|
446 | $sqlval['create_date'] = 'NOW()'; |
---|
447 | $sqlval['update_date'] = 'NOW()'; |
---|
448 | $objQuery->insert("dtb_customer_reading", $sqlval); |
---|
449 | } |
---|
450 | |
---|
451 | //この商品を買った人はこんな商品も買っています |
---|
452 | function lfGetRelateProducts($tmp_id) { |
---|
453 | $objQuery = new SC_Query; |
---|
454 | //自動抽出 |
---|
455 | $objQuery->setorder("random()"); |
---|
456 | //表示件数の制限 |
---|
457 | $objQuery->setlimit(RELATED_PRODUCTS_MAX); |
---|
458 | //検索条件 |
---|
459 | $col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate"; |
---|
460 | $from = "vw_products_allclass AS allcls "; |
---|
461 | $where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? "; |
---|
462 | $arrval[] = $tmp_id; |
---|
463 | //結果の取得 |
---|
464 | $arrProducts = $objQuery->select($col, $from, $where, $arrval); |
---|
465 | |
---|
466 | return $arrProducts; |
---|
467 | } |
---|
468 | |
---|
469 | //商品ごとのレビュー情報を取得する |
---|
470 | function lfGetReviewData($id) { |
---|
471 | $objQuery = new SC_Query; |
---|
472 | //商品ごとのレビュー情報を取得する |
---|
473 | $col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment"; |
---|
474 | $from = "dtb_review"; |
---|
475 | $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . REVIEW_REGIST_MAX; |
---|
476 | $arrval[] = $id; |
---|
477 | $arrReview = $objQuery->select($col, $from, $where, $arrval); |
---|
478 | return $arrReview; |
---|
479 | } |
---|
480 | |
---|
481 | /* |
---|
482 | * 商品ごとのトラックバック情報を取得する |
---|
483 | * |
---|
484 | * @param $product_id |
---|
485 | * @return $arrTrackback |
---|
486 | */ |
---|
487 | function lfGetTrackbackData($product_id) { |
---|
488 | |
---|
489 | $arrTrackback = array(); |
---|
490 | |
---|
491 | $objQuery = new SC_Query; |
---|
492 | //商品ごとのトラックバック情報を取得する |
---|
493 | $col = "blog_name, url, title, excerpt, title, create_date"; |
---|
494 | $from = "dtb_trackback"; |
---|
495 | $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . TRACKBACK_VIEW_MAX; |
---|
496 | $arrval[] = $product_id; |
---|
497 | $arrTrackback = $objQuery->select($col, $from, $where, $arrval); |
---|
498 | return $arrTrackback; |
---|
499 | } |
---|
500 | |
---|
501 | //支払方法の取得 |
---|
502 | //payment_id 1:クレジット 2:ショッピングローン |
---|
503 | function lfGetPayment() { |
---|
504 | $objQuery = new SC_Query; |
---|
505 | $col = "payment_id, rule, payment_method"; |
---|
506 | $from = "dtb_payment"; |
---|
507 | $where = "del_flg = 0"; |
---|
508 | $order = "payment_id"; |
---|
509 | $objQuery->setorder($order); |
---|
510 | $arrRet = $objQuery->select($col, $from, $where); |
---|
511 | return $arrRet; |
---|
512 | } |
---|
513 | |
---|
514 | function lfConvertParam() { |
---|
515 | if (!isset($this->arrForm['quantity']['value'])) $this->arrForm['quantity']['value'] = ""; |
---|
516 | $value = $this->arrForm['quantity']['value']; |
---|
517 | $this->arrForm['quantity']['value'] = htmlspecialchars($value, ENT_QUOTES, CHAR_CODE); |
---|
518 | } |
---|
519 | } |
---|
520 | ?> |
---|