Ignore:
Timestamp:
2012/06/19 16:15:24 (12 years ago)
Author:
pineray
Message:

#1669 #1859 初期化漏れ、無駄な変数等

File:
1 edited

Legend:

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

    r21920 r21925  
    5151        } 
    5252        // 1世代古いコピー情報は、削除しておく 
    53         foreach ($_SESSION as $k => $val) { 
     53        foreach (array_keys($_SESSION) as $k) { 
    5454            if ($k != $this->key_tmp && preg_match('/^savecart_/', $k)) { 
    5555                unset($this->cartSession[$productTypeId][$k]); 
     
    8787            // 一時カートのクリア 
    8888            unset($_SESSION[$this->key_tmp]); 
    89             $this->cartSession[$productTypeId][$key]['cancel_purchase'] = true; 
     89            $this->cartSession[$productTypeId]['cancel_purchase'] = true; 
    9090        } else { 
    9191            $this->cartSession[$productTypeId]['cancel_purchase'] = false; 
     
    9696    // 次に割り当てるカートのIDを取得する 
    9797    function getNextCartID($productTypeId) { 
    98         foreach ($this->cartSession[$productTypeId] as $key => $val) { 
    99             $arrRet[] = $this->cartSession[$productTypeId][$key]['cart_no']; 
    100         } 
    101         return max($arrRet) + 1; 
     98        $count = array(); 
     99        foreach (array_keys($this->cartSession[$productTypeId]) as $key) { 
     100            $count[] = $this->cartSession[$productTypeId][$key]['cart_no']; 
     101        } 
     102        return max($count) + 1; 
    102103    } 
    103104 
     
    143144        $max = 0; 
    144145        if (count($this->cartSession[$productTypeId]) > 0) { 
    145             foreach ($this->cartSession[$productTypeId] as $key => $val) { 
     146            foreach (array_keys($this->cartSession[$productTypeId]) as $key) { 
    146147                if (is_numeric($key)) { 
    147148                    if ($max < $key) { 
     
    393394    function getAllProductID($productTypeId) { 
    394395        $max = $this->getMax($productTypeId); 
     396        $productIDs = array(); 
    395397        for ($i = 0; $i <= $max; $i++) { 
    396398            if ($this->cartSession[$productTypeId][$i]['cart_no'] != '') { 
    397                 $arrRet[] = $this->cartSession[$productTypeId][$i]['id'][0]; 
    398             } 
    399         } 
    400         return $arrRet; 
     399                $productIDs[] = $this->cartSession[$productTypeId][$i]['id'][0]; 
     400            } 
     401        } 
     402        return $productIDs; 
    401403    } 
    402404 
     
    409411    function getAllProductClassID($productTypeId) { 
    410412        $max = $this->getMax($productTypeId); 
     413        $productClassIDs = array(); 
    411414        for ($i = 0; $i <= $max; $i++) { 
    412415            if ($this->cartSession[$productTypeId][$i]['cart_no'] != '') { 
    413                 $arrRet[] = $this->cartSession[$productTypeId][$i]['id']; 
    414             } 
    415         } 
    416         return $arrRet; 
     416                $productClassIDs[] = $this->cartSession[$productTypeId][$i]['id']; 
     417            } 
     418        } 
     419        return $productClassIDs; 
    417420    } 
    418421 
     
    497500     */ 
    498501    function getProductClassId($cart_no, $productTypeId) { 
    499         for ($i = 0; $i <= $max; $i++) { 
     502        for ($i = 0; $i < count($this->cartSession[$productTypeId]); $i++) { 
    500503            if ($this->cartSession[$productTypeId][$i]['cart_no'] == $cart_no) { 
    501504                return $this->cartSession[$productTypeId][$i]['id']; 
     
    625628    ) { 
    626629 
     630        $results = array(); 
    627631        $total_point = $this->getAllProductsPoint($productTypeId); 
    628632        $results['tax'] = $this->getAllProductsTax($productTypeId); 
Note: See TracChangeset for help on using the changeset viewer.