Changeset 23124 for branches/version-2_13-dev/data/class/SC_CartSession.php
- Timestamp:
- 2013/08/24 23:33:52 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/SC_CartSession.php
r23085 r23124 31 31 { 32 32 /** ユニークIDを指定する. */ 33 var$key_tmp;33 public $key_tmp; 34 34 35 35 /** カートのセッション変数. */ 36 var$cartSession;36 public $cartSession; 37 37 38 38 /* コンストラクタ */ 39 function __construct($cartKey = 'cart')39 public function __construct($cartKey = 'cart') 40 40 { 41 41 if (!isset($_SESSION[$cartKey])) { … … 46 46 47 47 // 商品購入処理中のロック 48 function saveCurrentCart($key_tmp, $productTypeId)48 public function saveCurrentCart($key_tmp, $productTypeId) 49 49 { 50 50 $this->key_tmp = 'savecart_' . $key_tmp; … … 62 62 63 63 // 商品購入中の変更があったかをチェックする。 64 function getCancelPurchase($productTypeId)64 public function getCancelPurchase($productTypeId) 65 65 { 66 66 $ret = isset($this->cartSession[$productTypeId]['cancel_purchase']) … … 72 72 73 73 // 購入処理中に商品に変更がなかったかを判定 74 function checkChangeCart($productTypeId)74 public function checkChangeCart($productTypeId) 75 75 { 76 76 $change = false; … … 100 100 101 101 // 次に割り当てるカートのIDを取得する 102 function getNextCartID($productTypeId)102 public function getNextCartID($productTypeId) 103 103 { 104 104 $count = array(); … … 111 111 112 112 // 値のセット 113 function setProductValue($id, $key, $val, $productTypeId)113 public function setProductValue($id, $key, $val, $productTypeId) 114 114 { 115 115 $max = $this->getMax($productTypeId); … … 124 124 125 125 // カート内商品の最大要素番号を取得する。 126 function getMax($productTypeId)126 public function getMax($productTypeId) 127 127 { 128 128 $max = 0; … … 141 141 142 142 // カート内商品数量の合計 143 function getTotalQuantity($productTypeId)143 public function getTotalQuantity($productTypeId) 144 144 { 145 145 $total = 0; … … 153 153 154 154 // 全商品の合計価格 155 function getAllProductsTotal($productTypeId, $pref_id = 0, $country_id = 0)155 public function getAllProductsTotal($productTypeId, $pref_id = 0, $country_id = 0) 156 156 { 157 157 // 税込み合計 … … 176 176 $total+= ($incTax * $quantity); 177 177 } 178 178 179 return $total; 179 180 } 180 181 181 182 // 全商品の合計税金 182 function getAllProductsTax($productTypeId, $pref_id = 0, $country_id = 0)183 public function getAllProductsTax($productTypeId, $pref_id = 0, $country_id = 0) 183 184 { 184 185 // 税合計 … … 200 201 201 202 // 全商品の合計ポイント 202 function getAllProductsPoint($productTypeId)203 public function getAllProductsPoint($productTypeId) 203 204 { 204 205 // ポイント合計 … … 227 228 228 229 // カートへの商品追加 229 function addProduct($product_class_id, $quantity)230 public function addProduct($product_class_id, $quantity) 230 231 { 231 232 $objProduct = new SC_Product_Ex(); … … 251 252 252 253 // 前頁のURLを記録しておく 253 function setPrevURL($url, $excludePaths = array())254 public function setPrevURL($url, $excludePaths = array()) 254 255 { 255 256 // 前頁として記録しないページを指定する。 … … 273 274 274 275 // 前頁のURLを取得する 275 function getPrevURL()276 public function getPrevURL() 276 277 { 277 278 return isset($_SESSION['prev_url']) ? $_SESSION['prev_url'] : ''; … … 279 280 280 281 // キーが一致した商品の削除 281 function delProductKey($keyname, $val, $productTypeId)282 public function delProductKey($keyname, $val, $productTypeId) 282 283 { 283 284 $max = count($this->cartSession[$productTypeId]); … … 289 290 } 290 291 291 function setValue($key, $val, $productTypeId)292 public function setValue($key, $val, $productTypeId) 292 293 { 293 294 $this->cartSession[$productTypeId][$key] = $val; 294 295 } 295 296 296 function getValue($key, $productTypeId)297 public function getValue($key, $productTypeId) 297 298 { 298 299 return $this->cartSession[$productTypeId][$key]; … … 303 304 * productsClass項目から、不必要な項目を削除する。 304 305 */ 305 function adjustSessionProductsClass(&$arrProductsClass)306 public function adjustSessionProductsClass(&$arrProductsClass) 306 307 { 307 308 $arrNecessaryItems = array( … … 334 335 * getCartList用にcartSession情報をセットする 335 336 * 336 * @param integer $product_type_id 商品種別ID337 * @param integer $key337 * @param integer $product_type_id 商品種別ID 338 * @param integer $key 338 339 * @return void 339 340 * 340 341 * MEMO: せっかく一回だけ読み込みにされてますが、税率対応の関係でちょっと保留 341 342 */ 342 function setCartSession4getCartList($productTypeId, $key)343 public function setCartSession4getCartList($productTypeId, $key) 343 344 { 344 345 $objProduct = new SC_Product_Ex(); … … 367 368 * 商品種別ごとにカート内商品の一覧を取得する. 368 369 * 369 * @param integer $productTypeId 商品種別ID370 * @param integer $pref_id税金計算用注文者都道府県ID371 * @param integer $country_id税金計算用注文者国ID372 * @return array カート内商品一覧の配列373 */ 374 function getCartList($productTypeId, $pref_id = 0, $country_id = 0)370 * @param integer $productTypeId 商品種別ID 371 * @param integer $pref_id 税金計算用注文者都道府県ID 372 * @param integer $country_id 税金計算用注文者国ID 373 * @return array カート内商品一覧の配列 374 */ 375 public function getCartList($productTypeId, $pref_id = 0, $country_id = 0) 375 376 { 376 377 $objProduct = new SC_Product_Ex(); … … 443 444 * @return array 全てのカートの内容 444 445 */ 445 function getAllCartList()446 public function getAllCartList() 446 447 { 447 448 $results = array(); … … 463 464 * カート内にある商品規格IDを全て取得する. 464 465 * 465 * @param integer $productTypeId 商品種別ID466 * @return array 商品規格ID の配列467 */ 468 function getAllProductClassID($productTypeId)466 * @param integer $productTypeId 商品種別ID 467 * @return array 商品規格ID の配列 468 */ 469 public function getAllProductClassID($productTypeId) 469 470 { 470 471 $max = $this->getMax($productTypeId); … … 482 483 * 商品種別ID を指定して, カート内の商品を全て削除する. 483 484 * 484 * @param integer $productTypeId 商品種別ID485 * @param integer $productTypeId 商品種別ID 485 486 * @return void 486 487 */ 487 function delAllProducts($productTypeId)488 public function delAllProducts($productTypeId) 488 489 { 489 490 $max = $this->getMax($productTypeId); … … 494 495 495 496 // 商品の削除 496 function delProduct($cart_no, $productTypeId)497 public function delProduct($cart_no, $productTypeId) 497 498 { 498 499 $max = $this->getMax($productTypeId); … … 505 506 506 507 // 数量の増加 507 function upQuantity($cart_no, $productTypeId)508 public function upQuantity($cart_no, $productTypeId) 508 509 { 509 510 $quantity = $this->getQuantity($cart_no, $productTypeId); … … 514 515 515 516 // 数量の減少 516 function downQuantity($cart_no, $productTypeId)517 public function downQuantity($cart_no, $productTypeId) 517 518 { 518 519 $quantity = $this->getQuantity($cart_no, $productTypeId); … … 525 526 * カート番号と商品種別IDを指定して, 数量を取得する. 526 527 * 527 * @param integer $cart_noカート番号528 * @param integer $productTypeId 商品種別ID528 * @param integer $cart_no カート番号 529 * @param integer $productTypeId 商品種別ID 529 530 * @return integer 該当商品規格の数量 530 531 */ 531 function getQuantity($cart_no, $productTypeId)532 public function getQuantity($cart_no, $productTypeId) 532 533 { 533 534 $max = $this->getMax($productTypeId); … … 542 543 * カート番号と商品種別IDを指定して, 数量を設定する. 543 544 * 544 * @param integer $quantity 設定する数量545 * @param integer $cart_no カート番号545 * @param integer $quantity 設定する数量 546 * @param integer $cart_no カート番号 546 547 * @param integer $productTypeId 商品種別ID 547 548 * @retrun void 548 549 */ 549 function setQuantity($quantity, $cart_no, $productTypeId)550 public function setQuantity($quantity, $cart_no, $productTypeId) 550 551 { 551 552 $max = $this->getMax($productTypeId); … … 560 561 * カート番号と商品種別IDを指定して, 商品規格IDを取得する. 561 562 * 562 * @param integer $cart_noカート番号563 * @param integer $productTypeId 商品種別ID563 * @param integer $cart_no カート番号 564 * @param integer $productTypeId 商品種別ID 564 565 * @return integer 商品規格ID 565 566 */ 566 function getProductClassId($cart_no, $productTypeId)567 public function getProductClassId($cart_no, $productTypeId) 567 568 { 568 569 for ($i = 0; $i < count($this->cartSession[$productTypeId]); $i++) { … … 584 585 * 4. 在庫数チェック 585 586 * 586 * @param string $productTypeId 商品種別ID587 * @param string $productTypeId 商品種別ID 587 588 * @return string エラーが発生した場合はエラーメッセージ 588 589 */ 589 function checkProducts($productTypeId)590 public function checkProducts($productTypeId) 590 591 { 591 592 $objProduct = new SC_Product_Ex(); … … 642 643 * 送料無料条件を満たすかどうかチェックする 643 644 * 644 * @param integer $productTypeId 商品種別ID645 * @param integer $productTypeId 商品種別ID 645 646 * @return boolean 送料無料の場合 true 646 647 */ 647 function isDelivFree($productTypeId)648 public function isDelivFree($productTypeId) 648 649 { 649 650 $objDb = new SC_Helper_DB_Ex(); … … 685 686 * - add_point: 加算ポイント 686 687 * 687 * @param integer $productTypeId 商品種別ID688 * @param SC_Customer $objCustomerログイン中の SC_Customer インスタンス689 * @param integer $use_point今回使用ポイント690 * @param integer|array $deliv_pref 配送先都道府県ID.688 * @param integer $productTypeId 商品種別ID 689 * @param SC_Customer $objCustomer ログイン中の SC_Customer インスタンス 690 * @param integer $use_point 今回使用ポイント 691 * @param integer|array $deliv_pref 配送先都道府県ID. 691 692 複数に配送する場合は都道府県IDの配列 692 * @param integer $charge手数料693 * @param integer $discount値引き694 * @param integer $deliv_id配送業者ID695 * @param integer $order_pref注文者の都道府県ID696 * @param integer $order_country_id 注文者の国697 * @return array カートの計算結果の配列698 */ 699 function calculate($productTypeId, &$objCustomer, $use_point = 0,693 * @param integer $charge 手数料 694 * @param integer $discount 値引き 695 * @param integer $deliv_id 配送業者ID 696 * @param integer $order_pref 注文者の都道府県ID 697 * @param integer $order_country_id 注文者の国 698 * @return array カートの計算結果の配列 699 */ 700 public function calculate($productTypeId, &$objCustomer, $use_point = 0, 700 701 $deliv_pref = '', $charge = 0, $discount = 0, $deliv_id = 0, 701 702 $order_pref = 0, $order_country_id = 0 … … 761 762 * @return array 商品種別IDの配列 762 763 */ 763 function getKeys()764 public function getKeys() 764 765 { 765 766 $keys = array_keys($this->cartSession); … … 778 779 * カートに設定された現在のキー(商品種別ID)を登録する. 779 780 * 780 * @param integer $key 商品種別ID781 * @param integer $key 商品種別ID 781 782 * @return void 782 783 */ 783 function registerKey($key)784 public function registerKey($key) 784 785 { 785 786 $_SESSION['cartKey'] = $key; … … 791 792 * @return void 792 793 */ 793 function unsetKey()794 public function unsetKey() 794 795 { 795 796 unset($_SESSION['cartKey']); … … 801 802 * @return integer 商品種別ID 802 803 */ 803 function getKey()804 public function getKey() 804 805 { 805 806 return $_SESSION['cartKey']; … … 811 812 * @return boolean カートが複数商品種別の場合 true 812 813 */ 813 function isMultiple()814 public function isMultiple() 814 815 { 815 816 return count($this->getKeys()) > 1; … … 819 820 * 引数の商品種別の商品がカートに含まれるかどうか. 820 821 * 821 * @param integer $product_type_id 商品種別ID822 * @param integer $product_type_id 商品種別ID 822 823 * @return boolean 指定の商品種別がカートに含まれる場合 true 823 824 */ 824 function hasProductType($product_type_id)825 public function hasProductType($product_type_id) 825 826 { 826 827 return in_array($product_type_id, $this->getKeys());
Note: See TracChangeset
for help on using the changeset viewer.