source: trunk/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Cart.php @ 18758

Revision 18758, 3.6 KB checked in by kajiwara, 14 years ago (diff)

EC-CUBE Ver2.4.4 分コミット。詳細はこちら( http://www.ec-cube.net/release/detail.php?release_id=223

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once(CLASS_PATH . "pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php");
26
27/**
28 * カート のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id:LC_Page_FrontParts_Bloc_Cart.php 15532 2007-08-31 14:39:46Z nanasess $
33 */
34class LC_Page_FrontParts_Bloc_Cart extends LC_Page_FrontParts_Bloc {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $bloc_file = 'cart.tpl';
47        $this->setTplMainpage($bloc_file);
48    }
49
50    /**
51     * Page のプロセス.
52     *
53     * @return void
54     */
55    function process() {
56        $objSubView = new SC_SiteView();
57        $objCart = new SC_CartSession();
58        $objSiteInfo = new SC_SiteInfo;
59
60        if (count($_SESSION[$objCart->key]) > 0){
61            // カート情報を取得
62            $arrCartList = $objCart->getCartList();
63
64            // カート内の商品ID一覧を取得
65            $arrAllProductID = $objCart->getAllProductID();
66            // 商品が1つ以上入っている場合には商品名称を取得
67            if (count($arrAllProductID) > 0){
68                $objQuery = new SC_Query();
69                $arrVal = array();
70                $sql = "";
71                $sql = "SELECT name FROM dtb_products WHERE product_id IN ( ?";
72                $arrVal = array($arrAllProductID[0]);
73                for($i = 1 ; $i < count($arrAllProductID) ; $i++){
74                    $sql.= " ,? ";
75                    array_push($arrVal, $arrAllProductID[$i]);
76                }
77                $sql.= " )";
78
79                $arrProduct_name = $objQuery->getAll($sql, $arrVal);
80
81                foreach($arrProduct_name as $key => $val){
82                    $arrCartList[$key]['product_name'] = $val['name'];
83                }
84            }
85            // 店舗情報の取得
86            $arrInfo = $objSiteInfo->data;
87            // 購入金額合計
88            $ProductsTotal = $objCart->getAllProductsTotal($arrInfo);
89
90            // 合計個数
91            $TotalQuantity = $objCart->getTotalQuantity();
92
93            // 送料無料までの金額
94            $arrCartList[0]['ProductsTotal'] = $ProductsTotal;
95            $arrCartList[0]['TotalQuantity'] = $TotalQuantity;
96            $deliv_free = $arrInfo['free_rule'] - $ProductsTotal;
97            $arrCartList[0]['free_rule'] = $arrInfo['free_rule'];
98            $arrCartList[0]['deliv_free'] = $deliv_free;
99
100            $this->arrCartList = $arrCartList;
101        }
102
103        $objSubView->assignobj($this);
104        $objSubView->display($this->tpl_mainpage);
105    }
106
107    /**
108     * デストラクタ.
109     *
110     * @return void
111     */
112    function destroy() {
113        parent::destroy();
114    }
115}
116?>
Note: See TracBrowser for help on using the repository browser.