1 | <?php |
---|
2 | /* |
---|
3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
4 | * |
---|
5 | * http://www.lockon.co.jp/ |
---|
6 | */ |
---|
7 | require_once("../require.php"); |
---|
8 | |
---|
9 | class LC_Page { |
---|
10 | var $arrSession; |
---|
11 | var $arrProductsClass; |
---|
12 | var $tpl_total_pretax; |
---|
13 | var $tpl_total_tax; |
---|
14 | var $tpl_total_point; |
---|
15 | var $tpl_message; |
---|
16 | function LC_Page() { |
---|
17 | /** 必ず指定する **/ |
---|
18 | $this->tpl_css = URL_DIR.'css/layout/cartin/index.css'; // メインCSSパス |
---|
19 | /** 必ず指定する **/ |
---|
20 | $this->tpl_mainpage = 'cart/index.tpl'; // メインテンプレート |
---|
21 | $this->tpl_title = "カゴの中を見る"; |
---|
22 | } |
---|
23 | } |
---|
24 | |
---|
25 | $objPage = new LC_Page(); |
---|
26 | $objView = new SC_SiteView(false); |
---|
27 | $objCartSess = new SC_CartSession("", false); |
---|
28 | $objSiteSess = new SC_SiteSession(); |
---|
29 | $objCampaignSess = new SC_CampaignSession(); |
---|
30 | $objSiteInfo = $objView->objSiteInfo; |
---|
31 | $objCustomer = new SC_Customer(); |
---|
32 | // 基本情報の取得 |
---|
33 | $arrInfo = $objSiteInfo->data; |
---|
34 | |
---|
35 | // 商品購入中にカート内容が変更された。 |
---|
36 | if($objCartSess->getCancelPurchase()) { |
---|
37 | $objPage->tpl_message = "商品購入中にカート内容が変更されましたので、お手数ですが購入手続きをやり直して下さい。"; |
---|
38 | } |
---|
39 | |
---|
40 | switch($_POST['mode']) { |
---|
41 | case 'up': |
---|
42 | $objCartSess->upQuantity($_POST['cart_no']); |
---|
43 | sfReload(); |
---|
44 | break; |
---|
45 | case 'down': |
---|
46 | $objCartSess->downQuantity($_POST['cart_no']); |
---|
47 | sfReload(); |
---|
48 | break; |
---|
49 | case 'delete': |
---|
50 | $objCartSess->delProduct($_POST['cart_no']); |
---|
51 | sfReload(); |
---|
52 | break; |
---|
53 | case 'confirm': |
---|
54 | // カート内情報の取得 |
---|
55 | $arrRet = $objCartSess->getCartList(); |
---|
56 | $max = count($arrRet); |
---|
57 | $cnt = 0; |
---|
58 | for ($i = 0; $i < $max; $i++) { |
---|
59 | // 商品規格情報の取得 |
---|
60 | $arrData = sfGetProductsClass($arrRet[$i]['id']); |
---|
61 | // DBに存在する商品 |
---|
62 | if($arrData != "") { |
---|
63 | $cnt++; |
---|
64 | } |
---|
65 | } |
---|
66 | // カート商品が1件以上存在する場合 |
---|
67 | if($cnt > 0) { |
---|
68 | // 正常に登録されたことを記録しておく |
---|
69 | $objSiteSess->setRegistFlag(); |
---|
70 | $pre_uniqid = $objSiteSess->getUniqId(); |
---|
71 | // 注文一時IDの発行 |
---|
72 | $objSiteSess->setUniqId(); |
---|
73 | $uniqid = $objSiteSess->getUniqId(); |
---|
74 | // エラーリトライなどで既にuniqidが存在する場合は、設定を引き継ぐ |
---|
75 | if($pre_uniqid != "") { |
---|
76 | $sqlval['order_temp_id'] = $uniqid; |
---|
77 | $where = "order_temp_id = ?"; |
---|
78 | $objQuery = new SC_Query(); |
---|
79 | $objQuery->update("dtb_order_temp", $sqlval, $where, array($pre_uniqid)); |
---|
80 | } |
---|
81 | // カートを購入モードに設定 |
---|
82 | $objCartSess->saveCurrentCart($uniqid); |
---|
83 | // 購入ページへ |
---|
84 | header("Location: " . URL_SHOP_TOP); |
---|
85 | } |
---|
86 | break; |
---|
87 | default: |
---|
88 | break; |
---|
89 | } |
---|
90 | |
---|
91 | // カート集計処理 |
---|
92 | $objPage = sfTotalCart($objPage, $objCartSess, $arrInfo); |
---|
93 | $objPage->arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer); |
---|
94 | |
---|
95 | $objPage->arrInfo = $arrInfo; |
---|
96 | |
---|
97 | // ログイン判定 |
---|
98 | if($objCustomer->isLoginSuccess()) { |
---|
99 | $objPage->tpl_login = true; |
---|
100 | $objPage->tpl_user_point = $objCustomer->getValue('point'); |
---|
101 | $objPage->tpl_name = $objCustomer->getValue('name01'); |
---|
102 | } |
---|
103 | |
---|
104 | // 送料無料までの金額を計算 |
---|
105 | $tpl_deliv_free = $objPage->arrInfo['free_rule'] - $objPage->tpl_total_pretax; |
---|
106 | $objPage->tpl_deliv_free = $tpl_deliv_free; |
---|
107 | |
---|
108 | // 前頁のURLを取得 |
---|
109 | $objPage->tpl_prev_url = $objCartSess->getPrevURL(); |
---|
110 | |
---|
111 | $objView->assignobj($objPage); |
---|
112 | // フレームを選択(キャンペーンページから遷移なら変更) |
---|
113 | $objCampaignSess->pageView($objView); |
---|
114 | |
---|
115 | //-------------------------------------------------------------------------------------------------------------------------- |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | ?> |
---|