Ignore:
Timestamp:
2007/09/05 11:01:20 (17 years ago)
Author:
nanasess
Message:

リファクタリング

  • DB インスタンスを生成する関数の移動
Location:
branches/feature-module-update/data/class
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/helper/SC_Helper_DB.php

    r15592 r15604  
    12121212 
    12131213    /** 
     1214     * 集計情報を元に最終計算を行う. 
     1215     * 
     1216     * @param array $arrData 各種情報 
     1217     * @param LC_Page $objPage LC_Page インスタンス 
     1218     * @param SC_CartSession $objCartSess SC_CartSession インスタンス 
     1219     * @param array $arrInfo 店舗情報の配列 
     1220     * @param SC_Customer $objCustomer SC_Customer インスタンス 
     1221     * @return array 最終計算後の配列 
     1222     */ 
     1223    function sfTotalConfirm($arrData, &$objPage, &$objCartSess, $arrInfo, &$objCustomer = "") { 
     1224        // 未定義変数を定義 
     1225        if (!isset($arrData['deliv_pref'])) $arrData['deliv_pref'] = ""; 
     1226        if (!isset($arrData['payment_id'])) $arrData['payment_id'] = ""; 
     1227        if (!isset($arrData['charge'])) $arrData['charge'] = ""; 
     1228        if (!isset($arrData['use_point'])) $arrData['use_point'] = ""; 
     1229 
     1230        // 商品の合計個数 
     1231        $total_quantity = $objCartSess->getTotalQuantity(true); 
     1232 
     1233        // 税金の取得 
     1234        $arrData['tax'] = $objPage->tpl_total_tax; 
     1235        // 小計の取得 
     1236        $arrData['subtotal'] = $objPage->tpl_total_pretax; 
     1237 
     1238        // 合計送料の取得 
     1239        $arrData['deliv_fee'] = 0; 
     1240 
     1241        // 商品ごとの送料が有効の場合 
     1242        if (OPTION_PRODUCT_DELIV_FEE == 1) { 
     1243            $arrData['deliv_fee']+= $objCartSess->getAllProductsDelivFee(); 
     1244        } 
     1245 
     1246        // 配送業者の送料が有効の場合 
     1247        if (OPTION_DELIV_FEE == 1) { 
     1248            // 送料の合計を計算する 
     1249            $arrData['deliv_fee'] 
     1250                += $this->sfGetDelivFee($arrData['deliv_pref'], 
     1251                                           $arrData['payment_id']); 
     1252 
     1253        } 
     1254 
     1255        // 送料無料の購入数が設定されている場合 
     1256        if(DELIV_FREE_AMOUNT > 0) { 
     1257            if($total_quantity >= DELIV_FREE_AMOUNT) { 
     1258                $arrData['deliv_fee'] = 0; 
     1259            } 
     1260        } 
     1261 
     1262        // 送料無料条件が設定されている場合 
     1263        if($arrInfo['free_rule'] > 0) { 
     1264            // 小計が無料条件を超えている場合 
     1265            if($arrData['subtotal'] >= $arrInfo['free_rule']) { 
     1266                $arrData['deliv_fee'] = 0; 
     1267            } 
     1268        } 
     1269 
     1270        // 合計の計算 
     1271        $arrData['total'] = $objPage->tpl_total_pretax; // 商品合計 
     1272        $arrData['total']+= $arrData['deliv_fee'];      // 送料 
     1273        $arrData['total']+= $arrData['charge'];         // 手数料 
     1274        // お支払い合計 
     1275        $arrData['payment_total'] = $arrData['total'] - ($arrData['use_point'] * POINT_VALUE); 
     1276        // 加算ポイントの計算 
     1277        $arrData['add_point'] = SC_Utils::sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo); 
     1278 
     1279        if($objCustomer != "") { 
     1280            // 誕生日月であった場合 
     1281            if($objCustomer->isBirthMonth()) { 
     1282                $arrData['birth_point'] = BIRTH_MONTH_POINT; 
     1283                $arrData['add_point'] += $arrData['birth_point']; 
     1284            } 
     1285        } 
     1286 
     1287        if($arrData['add_point'] < 0) { 
     1288            $arrData['add_point'] = 0; 
     1289        } 
     1290        return $arrData; 
     1291    } 
     1292 
     1293    /** 
    12141294     * レコードの存在チェックを行う. 
    12151295     * 
  • branches/feature-module-update/data/class/util/SC_Utils.php

    r15592 r15604  
    912912    } 
    913913 
    914     /* 集計情報を元に最終計算 */ 
    915     function sfTotalConfirm($arrData, $objPage, $objCartSess, $arrInfo, $objCustomer = "") { 
    916         // 未定義変数を定義 
    917         if (!isset($arrData['deliv_pref'])) $arrData['deliv_pref'] = ""; 
    918         if (!isset($arrData['payment_id'])) $arrData['payment_id'] = ""; 
    919         if (!isset($arrData['charge'])) $arrData['charge'] = ""; 
    920         if (!isset($arrData['use_point'])) $arrData['use_point'] = ""; 
    921  
    922         // 商品の合計個数 
    923         $total_quantity = $objCartSess->getTotalQuantity(true); 
    924  
    925         // 税金の取得 
    926         $arrData['tax'] = $objPage->tpl_total_tax; 
    927         // 小計の取得 
    928         $arrData['subtotal'] = $objPage->tpl_total_pretax; 
    929  
    930         // 合計送料の取得 
    931         $arrData['deliv_fee'] = 0; 
    932  
    933         // 商品ごとの送料が有効の場合 
    934         if (OPTION_PRODUCT_DELIV_FEE == 1) { 
    935             $arrData['deliv_fee']+= $objCartSess->getAllProductsDelivFee(); 
    936         } 
    937  
    938         // 配送業者の送料が有効の場合 
    939         if (OPTION_DELIV_FEE == 1) { 
    940             // 送料の合計を計算する 
    941             $arrData['deliv_fee'] 
    942                 += SC_Utils::sfGetDelivFee($arrData['deliv_pref'], 
    943                                            $arrData['payment_id']); 
    944  
    945         } 
    946  
    947         // 送料無料の購入数が設定されている場合 
    948         if(DELIV_FREE_AMOUNT > 0) { 
    949             if($total_quantity >= DELIV_FREE_AMOUNT) { 
    950                 $arrData['deliv_fee'] = 0; 
    951             } 
    952         } 
    953  
    954         // 送料無料条件が設定されている場合 
    955         if($arrInfo['free_rule'] > 0) { 
    956             // 小計が無料条件を超えている場合 
    957             if($arrData['subtotal'] >= $arrInfo['free_rule']) { 
    958                 $arrData['deliv_fee'] = 0; 
    959             } 
    960         } 
    961  
    962         // 合計の計算 
    963         $arrData['total'] = $objPage->tpl_total_pretax; // 商品合計 
    964         $arrData['total']+= $arrData['deliv_fee'];      // 送料 
    965         $arrData['total']+= $arrData['charge'];         // 手数料 
    966         // お支払い合計 
    967         $arrData['payment_total'] = $arrData['total'] - ($arrData['use_point'] * POINT_VALUE); 
    968         // 加算ポイントの計算 
    969         $arrData['add_point'] = SC_Utils::sfGetAddPoint($objPage->tpl_total_point, $arrData['use_point'], $arrInfo); 
    970  
    971         if($objCustomer != "") { 
    972             // 誕生日月であった場合 
    973             if($objCustomer->isBirthMonth()) { 
    974                 $arrData['birth_point'] = BIRTH_MONTH_POINT; 
    975                 $arrData['add_point'] += $arrData['birth_point']; 
    976             } 
    977         } 
    978  
    979         if($arrData['add_point'] < 0) { 
    980             $arrData['add_point'] = 0; 
    981         } 
    982  
    983         return $arrData; 
    984     } 
    985  
    986914    /* DBから取り出した日付の文字列を調整する。*/ 
    987915    function sfDispDBDate($dbdate, $time = true) { 
Note: See TracChangeset for help on using the changeset viewer.