source: branches/dev/html/cart/index.php @ 295

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