Ignore:
Timestamp:
2012/03/16 14:47:46 (12 years ago)
Author:
Seasoft
Message:

#1613 (typo修正・ソース整形・ソースコメントの改善)
#1605 (PHP4向けコードの除去、PHP5向けのコード最適化)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/SC_CartSession.php

    r21644 r21650  
    341341 
    342342                // 商品情報は常に取得 
     343                // TODO 同一インスタンス内では1回のみ呼ぶようにしたい 
    343344                $this->cartSession[$productTypeId][$i]['productsClass'] 
    344345                    =& $objProduct->getDetailAndProductsClass($this->cartSession[$productTypeId][$i]['id']); 
     
    514515     * 4. 在庫数チェック 
    515516     * 
    516      * @param string $key 商品種別ID 
     517     * @param string $productTypeId 商品種別ID 
    517518     * @return string エラーが発生した場合はエラーメッセージ 
    518519     */ 
     
    522523 
    523524        // カート内の情報を取得 
    524         $items = $this->getCartList($productTypeId); 
    525         foreach (array_keys($items) as $key) { 
    526             $item =& $items[$key]; 
    527             $product =& $item['productsClass']; 
     525        $arrItems = $this->getCartList($productTypeId); 
     526        foreach ($arrItems as &$arrItem) { 
     527            $product =& $arrItem['productsClass']; 
    528528            /* 
    529529             * 表示/非表示商品のチェック 
    530530             */ 
    531531            if (SC_Utils_Ex::isBlank($product) || $product['status'] != 1) { 
    532                 $this->delProduct($item['cart_no'], $productTypeId); 
     532                $this->delProduct($arrItem['cart_no'], $productTypeId); 
    533533                $tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n"; 
    534534            } else { 
     
    541541                    $tpl_message .= '※「' . $product['name'] . '」はまだ配送の準備ができておりません。'; 
    542542                    $tpl_message .= '恐れ入りますがお問い合わせページよりお問い合わせください。' . "\n"; 
    543                     $this->delProduct($item['cart_no'], $productTypeId); 
     543                    $this->delProduct($arrItem['cart_no'], $productTypeId); 
    544544                } 
    545545 
     
    548548                 */ 
    549549                $limit = $objProduct->getBuyLimit($product); 
    550                 if (!is_null($limit) && $item['quantity'] > $limit) { 
     550                if (!is_null($limit) && $arrItem['quantity'] > $limit) { 
    551551                    if ($limit > 0) { 
    552                         $this->setProductValue($item['id'], 'quantity', $limit, $productTypeId); 
    553                         $total_inctax = SC_Helper_DB_Ex::sfCalcIncTax($item['price']) * $limit; 
    554                         $this->setProductValue($item['id'], 'total_inctax', $total_inctax, $productTypeId); 
     552                        $this->setProductValue($arrItem['id'], 'quantity', $limit, $productTypeId); 
     553                        $total_inctax = SC_Helper_DB_Ex::sfCalcIncTax($arrItem['price']) * $limit; 
     554                        $this->setProductValue($arrItem['id'], 'total_inctax', $total_inctax, $productTypeId); 
    555555                        $tpl_message .= '※「' . $product['name'] . '」は販売制限(または在庫が不足)しております。'; 
    556556                        $tpl_message .= "一度に数量{$limit}を超える購入はできません。\n"; 
    557557                    } else { 
    558                         $this->delProduct($item['cart_no'], $productTypeId); 
     558                        $this->delProduct($arrItem['cart_no'], $productTypeId); 
    559559                        $tpl_message .= '※「' . $product['name'] . "」は売り切れました。\n"; 
    560560                        continue; 
     
    590590        $arrInfo = $objDb->sfGetBasisData(); 
    591591        if ($arrInfo['free_rule'] > 0) { 
    592             // 小計が無料条件を超えている場合 
     592            // 小計が送料無料条件以上の場合 
    593593            if ($subtotal >= $arrInfo['free_rule']) { 
    594594                return true; 
     
    633633        if (OPTION_PRODUCT_DELIV_FEE == 1) { 
    634634            $cartItems = $this->getCartList($productTypeId); 
    635             foreach ($cartItems as $item) { 
    636                 $results['deliv_fee'] += $item['productsClass']['deliv_fee'] * $item['quantity']; 
     635            foreach ($cartItems as $arrItem) { 
     636                $results['deliv_fee'] += $arrItem['productsClass']['deliv_fee'] * $arrItem['quantity']; 
    637637            } 
    638638        } 
Note: See TracChangeset for help on using the changeset viewer.