Changeset 17970


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

・商品送料対応

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

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

Location:
branches/comu-ver2/data
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/Smarty/templates/default/admin/products/confirm.tpl

    r17967 r17970  
    9090    </tr> 
    9191    <!--{/if}--> 
     92 
     93    <tr> 
     94      <th>商品送料</th> 
     95      <td> 
     96        <!--{$arrForm.deliv_fee|escape}--> 
     97        円</td> 
     98    </tr> 
    9299    <tr> 
    93100      <th>ポイント付与率</th> 
  • branches/comu-ver2/data/Smarty/templates/default/admin/products/product.tpl

    r17967 r17970  
    152152    <!--{/if}--> 
    153153 
    154     <!--{* 送料の個別指定は次期開発で追加予定 
    155154    <tr> 
    156155      <th>商品送料</th> 
     
    159158        <input type="text" name="deliv_fee" value="<!--{$arrForm.deliv_fee|escape}-->" size="6" class="box6" maxlength="<!--{$smarty.const.PRICE_LEN}-->" style="<!--{if $arrErr.deliv_fee != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}--><!--{/if}-->"/>円 
    160159        <span class="attention"> (半角数字で入力)</span> 
    161       </td> 
    162     </tr> 
    163     *}--> 
    164  
     160        <!--{if $smarty.const.OPTION_PRODUCT_DELIV_FEE != 1}--><br /><span class="attention">※現在無効です</span> (パラメータ OPTION_PRODUCT_DELIV_FEE)<!--{/if}--> 
     161      </td> 
     162    </tr> 
    165163    <tr> 
    166164      <th>ポイント付与率<span class="attention"> *</span></th> 
  • branches/comu-ver2/data/class/SC_CartSession.php

    r17891 r17970  
    348348    } 
    349349 
    350     // 全商品の合計送料 
    351     function getAllProductsDelivFee() { 
    352         // ポイント合計 
    353         $total = 0; 
    354         $max = $this->getMax(); 
    355         for($i = 0; $i <= $max; $i++) { 
    356             $deliv_fee = $_SESSION[$this->key][$i]['deliv_fee']; 
    357             $quantity = $_SESSION[$this->key][$i]['quantity']; 
    358             $total+= ($deliv_fee * $quantity); 
    359         } 
    360         return $total; 
    361     } 
    362  
    363350    // カートの中の売り切れチェック 
    364351    function chkSoldOut($arrCartList, $is_mobile = false){ 
  • 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.