Ignore:
Timestamp:
2009/04/11 05:19:52 (15 years ago)
Author:
Seasoft
Message:

・商品送料対応

※商品規格ごとには設定できない難がある。

・送料カスタマイズ(拡張)を容易にするためのリファクタリング

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/helper/SC_Helper_DB.php

    r17854 r17970  
    14961496        // 商品ごとの送料が有効の場合 
    14971497        if (OPTION_PRODUCT_DELIV_FEE == 1) { 
    1498             $arrData['deliv_fee']+= $objCartSess->getAllProductsDelivFee(); 
     1498            // 全商品の合計送料を加算する 
     1499            $this->lfAddAllProductsDelivFee($arrData, $objPage, $objCartSess); 
    14991500        } 
    15001501 
    15011502        // 配送業者の送料が有効の場合 
    15021503        if (OPTION_DELIV_FEE == 1) { 
    1503             // 送料の合計を計算する 
    1504             $arrData['deliv_fee'] += $this->sfGetDelivFee($arrData); 
     1504            // 都道府県、支払い方法から配送料金を加算する 
     1505            $this->lfAddDelivFee($arrData); 
    15051506        } 
    15061507 
     
    16771678    } 
    16781679 
    1679  
     1680    /** 
     1681     * 全商品の合計送料を加算する 
     1682     */ 
     1683    function lfAddAllProductsDelivFee(&$arrData, &$objPage, &$objCartSess) { 
     1684        $objQuery = new SC_Query(); 
     1685        $max = $objCartSess->getMax(); 
     1686        for ($i = 0; $i <= $max; $i++) { 
     1687            // 商品送料 
     1688            $deliv_fee = $objQuery->getOne('SELECT deliv_fee FROM dtb_products WHERE product_id = ?', array($_SESSION[$objCartSess->key][$i]['id'][0])); 
     1689            // 数量 
     1690            $quantity = $_SESSION[$objCartSess->key][$i]['quantity']; 
     1691            // 合算 
     1692            $arrData['deliv_fee'] += $deliv_fee * $quantity; 
     1693        } 
     1694    } 
     1695 
     1696    /** 
     1697     * 都道府県、支払い方法から配送料金を加算する. 
     1698     * 
     1699     * @param array $arrData 
     1700     */ 
     1701    function lfAddDelivFee(&$arrData) { 
     1702        $arrData['deliv_fee'] += $this->sfGetDelivFee($arrRet); 
     1703    } 
    16801704 
    16811705} 
Note: See TracChangeset for help on using the changeset viewer.