source: branches/feature-module-update/html/mobile/cart/index.php @ 15078

Revision 15078, 3.6 KB checked in by nanasess, 17 years ago (diff)

r15064 から svn cp
とりあえず暫定コミット.

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