Changeset 18859 for branches/version-2_5-dev/data/class/SC_CartSession.php
- Timestamp:
- 2010/10/19 15:02:14 (13 years ago)
- bzr:base-revision:
- ohkouchi@loop-az.jp-20101018023620-433ytapfds3h0dr0
- bzr:committer:
- Kentaro Ohkouchi <ohkouchi@loop-az.jp>
- bzr:file-ids:
data/class/SC_CartSession.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2FSC_CartSession.php
data/class/helper/SC_Helper_DB.php 15176@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fhelper%2FSC_Helper_DB.php
data/class/pages/cart/LC_Page_Cart.php 15179@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fcart%2FLC_Page_Cart.php
data/class/pages/shopping/LC_Page_Shopping_Confirm.php 15223@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fshopping%2FLC_Page_Shopping_Confirm.php
data/class/pages/shopping/LC_Page_Shopping_Payment.php 15223@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fshopping%2FLC_Page_Shopping_Payment.php
data/class/util/SC_Utils.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Futil%2FSC_Utils.php- bzr:mapping-version:
- v4
- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- ohkouchi@loop-az.jp-20101019060210-f9ll2iywezf74j7f
- bzr:revno:
- 2339
- bzr:revprop:branch-nick:
- branches/version-2_5-dev
- bzr:root:
- branches/version-2_5-dev
- bzr:timestamp:
- 2010-10-19 15:02:10.290999889 +0900
- bzr:user-agent:
- bzr2.2.0+bzr-svn1.0.3
- svn:original-date:
- 2010-10-19T06:02:10.291000Z
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_CartSession.php
r18852 r18859 318 318 } 319 319 320 /** 321 * すべてのカートの内容を取得する. 322 * 323 * @return array すべてのカートの内容 324 */ 325 function getAllCartList() { 326 $results = array(); 327 $cartKeys = $this->getKeys(); 328 $i = 0; 329 foreach ($cartKeys as $key) { 330 $cartItems = $this->getCartList($key); 331 foreach (array_keys($cartItems) as $itemKey) { 332 $cartItem =& $cartItems[$itemKey]; 333 $results[$key][$i] =& $cartItem; 334 $i++; 335 } 336 } 337 return $results; 338 } 339 320 340 // カート内にある商品IDを全て取得する 321 341 function getAllProductID($productTypeId) { … … 436 456 } 437 457 458 /** 459 * カートの内容を計算する. 460 * 461 * カートの内容を計算し, 下記のキーを保持する連想配列を返す. 462 * 463 * - tax: 税額 464 * - subtotal: カート内商品の小計 465 * - deliv_fee: カート内商品の合計送料 466 * - total: 合計金額 467 * - payment_total: お支払い合計 468 * - add_point: 加算ポイント 469 * 470 * TODO ダウンロード商品のみの場合の送料を検討する 471 * TODO 使用ポイント, 配送都道府県, 支払い方法, 手数料の扱いを検討 472 * 473 * @param integer $productTypeId 商品種別ID 474 * @param SC_Customer $objCustomer ログイン中の SC_Customer インスタンス 475 * @param integer $use_point 今回使用ポイント 476 * @param integer $deliv_pref 配送先都道府県ID 477 * @param integer $payment_id 支払い方法ID 478 * @param integer $charge 手数料 479 * @return array カートの計算結果の配列 480 */ 481 function calculate($productTypeId, &$objCustomer = null, $use_point = 0, 482 $deliv_pref = "", $payment_id = "", $charge = 0) { 483 $objDb = new SC_Helper_DB_Ex(); 484 485 $total_point = $this->getAllProductsPoint($productTypeId); 486 $results['tax'] = $this->getAllProductsTax($productTypeId); 487 $results['subtotal'] = $this->getAllProductsTotal($productTypeId); 488 $results['deliv_fee'] = 0; 489 490 // 商品ごとの送料を加算 491 if (OPTION_PRODUCT_DELIV_FEE == 1) { 492 $cartItems = $this->getCartList($productTypeId); 493 foreach ($cartItems as $item) { 494 $results['deliv_fee'] += $item['deliv_fee'] * $item['quantity']; 495 } 496 } 497 498 // 配送業者の送料を加算 499 if (OPTION_DELIV_FEE == 1) { 500 $results['deliv_fee'] += $objDb->sfGetDelivFee( 501 array('deliv_pref' => $deliv_pref, 502 'payment_id' => $payment_id)); 503 } 504 505 // 送料無料の購入数が設定されている場合 506 if (DELIV_FREE_AMOUNT > 0) { 507 // 商品の合計数量 508 $total_quantity = $this->getTotalQuantity($productTypeId); 509 510 if($total_quantity >= DELIV_FREE_AMOUNT) { 511 $results['deliv_fee'] = 0; 512 } 513 } 514 515 // 送料無料条件が設定されている場合 516 $arrInfo = $objDb->sf_getBasisData(); 517 if($arrInfo['free_rule'] > 0) { 518 // 小計が無料条件を超えている場合 519 if($results['subtotal'] >= $arrInfo['free_rule']) { 520 $results['deliv_fee'] = 0; 521 } 522 } 523 524 // 合計を計算 525 $results['total'] = $results['subtotal']; 526 $results['total'] += $results['deliv_fee']; 527 $results['total'] += $charge; 528 529 // お支払い合計 530 $results['payment_total'] = $results['total'] - $use_point * POINT_VALUE; 531 532 // 加算ポイントの計算 533 if (USE_POINT !== false) { 534 $results['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($total_point, 535 $use_point); 536 if($objCustomer != "") { 537 // 誕生日月であった場合 538 if($objCustomer->isBirthMonth()) { 539 $results['birth_point'] = BIRTH_MONTH_POINT; 540 $results['add_point'] += $results['birth_point']; 541 } 542 } 543 if($results['add_point'] < 0) { 544 $results['add_point'] = 0; 545 } 546 } 547 return $results; 548 } 549 438 550 function getKeys() { 439 551 return array_keys($this->cartSession);
Note: See TracChangeset
for help on using the changeset viewer.