Changeset 20814


Ignore:
Timestamp:
2011/04/05 23:09:18 (13 years ago)
Author:
shutta
Message:

refs #1200 #1235 送料無料チェック部分を別関数に分離

File:
1 edited

Legend:

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

    r20813 r20814  
    487487 
    488488    /** 
     489     * 送料無料条件を満たすかどうかチェックする 
     490     * 
     491     * @param integer $productTypeId 商品種別ID 
     492     * @return boolean 送料無料の場合 true 
     493     */ 
     494    function isDelivFree($productTypeId) { 
     495        $objDb = new SC_Helper_DB_Ex(); 
     496 
     497        $subtotal = $this->getAllProductsTotal($productTypeId); 
     498 
     499        // 送料無料の購入数が設定されている場合 
     500        if (DELIV_FREE_AMOUNT > 0) { 
     501            // 商品の合計数量 
     502            $total_quantity = $this->getTotalQuantity($productTypeId); 
     503 
     504            if($total_quantity >= DELIV_FREE_AMOUNT) { 
     505                return true; 
     506            } 
     507        } 
     508 
     509        // 送料無料条件が設定されている場合 
     510        $arrInfo = $objDb->sfGetBasisData(); 
     511        if ($arrInfo['free_rule'] > 0) { 
     512            // 小計が無料条件を超えている場合 
     513            if($subtotal >= $arrInfo['free_rule']) { 
     514                return true; 
     515            } 
     516        } 
     517 
     518        return false; 
     519    } 
     520 
     521    /** 
    489522     * カートの内容を計算する. 
    490523     * 
     
    535568        } 
    536569 
    537         // 送料無料の購入数が設定されている場合 
    538         if (DELIV_FREE_AMOUNT > 0) { 
    539             // 商品の合計数量 
    540             $total_quantity = $this->getTotalQuantity($productTypeId); 
    541  
    542             if($total_quantity >= DELIV_FREE_AMOUNT) { 
    543                 $results['deliv_fee'] = 0; 
    544             } 
    545         } 
    546  
    547         // 送料無料条件が設定されている場合 
    548         $arrInfo = $objDb->sfGetBasisData(); 
    549         if($arrInfo['free_rule'] > 0) { 
    550             // 小計が無料条件を超えている場合 
    551             if($results['subtotal'] >= $arrInfo['free_rule']) { 
    552                 $results['deliv_fee'] = 0; 
    553             } 
     570        // 送料無料チェック 
     571        if ($this->isDelivFree($productTypeId)) { 
     572            $results['deliv_fee'] = 0; 
    554573        } 
    555574 
Note: See TracChangeset for help on using the changeset viewer.