[15367] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
| 4 | * |
---|
| 5 | * http://www.lockon.co.jp/ |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | // {{{ requires |
---|
| 9 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
---|
| 10 | |
---|
| 11 | /** |
---|
| 12 | * カート のページクラス. |
---|
| 13 | * |
---|
| 14 | * @package Page |
---|
| 15 | * @author LOCKON CO.,LTD. |
---|
| 16 | * @version $Id$ |
---|
| 17 | */ |
---|
| 18 | class LC_Page_FrontParts_Bloc_Cart extends LC_Page { |
---|
| 19 | |
---|
| 20 | // }}} |
---|
| 21 | // {{{ functions |
---|
| 22 | |
---|
| 23 | /** |
---|
| 24 | * Page を初期化する. |
---|
| 25 | * |
---|
| 26 | * @return void |
---|
| 27 | */ |
---|
| 28 | function init() { |
---|
| 29 | parent::init(); |
---|
| 30 | $this->tpl_mainpage = BLOC_PATH . 'cart.tpl'; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * Page のプロセス. |
---|
| 35 | * |
---|
| 36 | * @return void |
---|
| 37 | */ |
---|
| 38 | function process() { |
---|
| 39 | $objSubView = new SC_SiteView(); |
---|
| 40 | $objCart = new SC_CartSession(); |
---|
| 41 | $objSiteInfo = new SC_SiteInfo; |
---|
| 42 | |
---|
| 43 | if (count($_SESSION[$objCart->key]) > 0){ |
---|
| 44 | // カート情報を取得 |
---|
| 45 | $arrCartList = $objCart->getCartList(); |
---|
| 46 | |
---|
| 47 | // カート内の商品ID一覧を取得 |
---|
| 48 | $arrAllProductID = $objCart->getAllProductID(); |
---|
| 49 | // 商品が1つ以上入っている場合には商品名称を取得 |
---|
| 50 | if (count($arrAllProductID) > 0){ |
---|
| 51 | $objQuery = new SC_Query(); |
---|
| 52 | $arrVal = array(); |
---|
| 53 | $sql = ""; |
---|
| 54 | $sql = "SELECT name FROM dtb_products WHERE product_id IN ( ?"; |
---|
| 55 | $arrVal = array($arrAllProductID[0]); |
---|
| 56 | for($i = 1 ; $i < count($arrAllProductID) ; $i++){ |
---|
| 57 | $sql.= " ,? "; |
---|
| 58 | array_push($arrVal, $arrAllProductID[$i]); |
---|
| 59 | } |
---|
| 60 | $sql.= " )"; |
---|
| 61 | |
---|
| 62 | $arrProduct_name = $objQuery->getAll($sql, $arrVal); |
---|
| 63 | |
---|
| 64 | foreach($arrProduct_name as $key => $val){ |
---|
| 65 | $arrCartList[$key]['product_name'] = $val['name']; |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | // 店舗情報の取得 |
---|
| 69 | $arrInfo = $objSiteInfo->data; |
---|
| 70 | // 購入金額合計 |
---|
| 71 | $ProductsTotal = $objCart->getAllProductsTotal($arrInfo); |
---|
| 72 | |
---|
| 73 | // 合計個数 |
---|
| 74 | $TotalQuantity = $objCart->getTotalQuantity(); |
---|
| 75 | |
---|
| 76 | // 送料無料までの金額 |
---|
| 77 | $arrCartList[0]['ProductsTotal'] = $ProductsTotal; |
---|
| 78 | $arrCartList[0]['TotalQuantity'] = $TotalQuantity; |
---|
| 79 | $deliv_free = $arrInfo['free_rule'] - $ProductsTotal; |
---|
| 80 | $arrCartList[0]['free_rule'] = $arrInfo['free_rule']; |
---|
| 81 | $arrCartList[0]['deliv_free'] = $deliv_free; |
---|
| 82 | |
---|
| 83 | $this->arrCartList = $arrCartList; |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | $objSubView->assignobj($this); |
---|
| 87 | $objSubView->display($this->tpl_mainpage); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | /** |
---|
| 91 | * デストラクタ. |
---|
| 92 | * |
---|
| 93 | * @return void |
---|
| 94 | */ |
---|
| 95 | function destroy() { |
---|
| 96 | parent::destroy(); |
---|
| 97 | } |
---|
| 98 | } |
---|
| 99 | ?> |
---|