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 | ?>
|
---|