source: branches/mobile/html/cart/index.php @ 10399

Revision 10399, 3.0 KB checked in by uehara, 16 years ago (diff)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8
9class 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$objSiteInfo = $objView->objSiteInfo;
30$objCustomer = new SC_Customer();
31// ´ðËܾðÊó¤Î¼èÆÀ
32$arrInfo = $objSiteInfo->data;
33
34// ¾¦ÉÊ¹ØÆþÃæ¤Ë¥«¡¼¥ÈÆâÍÆ¤¬Êѹ¹¤µ¤ì¤¿¡£
35if($objCartSess->getCancelPurchase()) {
36    $objPage->tpl_message = "¾¦ÉÊ¹ØÆþÃæ¤Ë¥«¡¼¥ÈÆâÍÆ¤¬Êѹ¹¤µ¤ì¤Þ¤·¤¿¤Î¤Ç¡¢¤ª¼ê¿ô¤Ç¤¹¤¬¹ØÆþ¼ê³¤­¤ò¤ä¤êľ¤·¤Æ²¼¤µ¤¤¡£";
37}
38
39switch($_POST['mode']) {
40case 'up':
41    $objCartSess->upQuantity($_POST['cart_no']);
42    sfReload();
43    break;
44case 'down':
45    $objCartSess->downQuantity($_POST['cart_no']);
46    sfReload();
47    break;
48case 'delete':
49    $objCartSess->delProduct($_POST['cart_no']);
50    sfReload();
51    break;
52case 'confirm':
53    // ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
54    $arrRet = $objCartSess->getCartList();
55    $max = count($arrRet);
56    $cnt = 0;
57    for ($i = 0; $i < $max; $i++) {
58        // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ   
59        $arrData = sfGetProductsClass($arrRet[$i]['id']);
60        // DB¤Ë¸ºß¤¹¤ë¾¦ÉÊ
61        if($arrData != "") {
62            $cnt++;
63        }
64    }
65    // ¥«¡¼¥È¾¦Éʤ¬1·ï°Ê¾å¸ºß¤¹¤ë¾ì¹ç
66    if($cnt > 0) {
67        // Àµ¾ï¤ËÅÐÏ¿¤µ¤ì¤¿¤³¤È¤òµ­Ï¿¤·¤Æ¤ª¤¯
68        $objSiteSess->setRegistFlag();
69        $pre_uniqid = $objSiteSess->getUniqId();
70        // Ãíʸ°ì»þID¤Îȯ¹Ô
71        $objSiteSess->setUniqId();
72        $uniqid = $objSiteSess->getUniqId();
73        // ¥¨¥é¡¼¥ê¥È¥é¥¤¤Ê¤É¤Ç´û¤Ëuniqid¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï¡¢ÀßÄê¤ò°ú¤­·Ñ¤°
74        if($pre_uniqid != "") {
75            $sqlval['order_temp_id'] = $uniqid;
76            $where = "order_temp_id = ?";
77            $objQuery = new SC_Query();
78            $objQuery->update("dtb_order_temp", $sqlval, $where, array($pre_uniqid));
79        }
80        // ¥«¡¼¥È¤ò¹ØÆþ¥â¡¼¥É¤ËÀßÄê
81        $objCartSess->saveCurrentCart($uniqid);
82        // ¹ØÆþ¥Ú¡¼¥¸¤Ø
83        header("Location: " . URL_SHOP_TOP);       
84    }
85    break;
86default:
87    break;
88}
89
90// ¥«¡¼¥È½¸·×½èÍý
91$objPage = sfTotalCart($objPage, $objCartSess, $arrInfo);
92$objPage->arrData = sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer);
93
94$objPage->arrInfo = $arrInfo;
95
96// ¥í¥°¥¤¥óȽÄê
97if($objCustomer->isLoginSuccess()) {
98    $objPage->tpl_login = true;
99    $objPage->tpl_user_point = $objCustomer->getValue('point');
100    $objPage->tpl_name = $objCustomer->getValue('name01');
101}
102
103// Á÷ÎÁ̵ÎÁ¤Þ¤Ç¤Î¶â³Û¤ò·×»»
104$tpl_deliv_free = $objPage->arrInfo['free_rule'] - $objPage->tpl_total_pretax;
105$objPage->tpl_deliv_free = $tpl_deliv_free;
106
107// Á°ÊǤÎURL¤ò¼èÆÀ
108$objPage->tpl_prev_url = $objCartSess->getPrevURL();
109
110$objView->assignobj($objPage);
111$objView->display(SITE_FRAME);
112//--------------------------------------------------------------------------------------------------------------------------
113?>
Note: See TracBrowser for help on using the repository browser.