Changeset 19688


Ignore:
Timestamp:
2010/11/29 20:59:11 (13 years ago)
Author:
nanasess
bzr:base-revision:
svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_5-dev:19687
bzr:committer:
Kentaro Ohkouchi <ohkouchi@loop-az.jp>
bzr:file-ids:

data/Smarty/templates/admin/products/product.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fadmin%2Fproducts%2Fproduct.tpl
data/class/SC_CartSession.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2FSC_CartSession.php
data/class/SC_Product.php 18277@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcomu-ver2%2Fdata%2Fclass%2FSC_Product.php
data/class/helper/SC_Helper_DB.php 15176@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fhelper%2FSC_Helper_DB.php
data/class/pages/admin/products/LC_Page_Admin_Products_Product.php 15342@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fproducts%2FLC_Page_Admin_Products_Product.php
data/class/pages/shopping/LC_Page_Shopping_Payment.php 15223@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fshopping%2FLC_Page_Shopping_Payment.php
bzr:mapping-version:
v4
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
ohkouchi@loop-az.jp-20101129115904-lavlfei90639y783
bzr:revno:
2418
bzr:revprop:branch-nick:
branches/version-2_5-dev
bzr:root:
branches/version-2_5-dev
bzr:timestamp:
2010-11-29 20:59:04.048000097 +0900
bzr:user-agent:
bzr2.2.1+bzr-svn1.0.4
svn:original-date:
2010-11-29T11:59:04.048000Z
Message:

#823 商品種別によってカートを分ける

  • 商品種別に応じて配送方法を取得するよう変更
  • 商品規格に応じて支払方法を取得するよう変更
Location:
branches/version-2_5-dev/data
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/Smarty/templates/admin/products/product.tpl

    r19670 r19688  
    197197    </tr> 
    198198    <tr> 
     199      <th>支払方法</th> 
     200       <td> 
     201         <!--{html_checkboxes name="payment_ids" options=$arrPayments selected=$arrForm.payment_ids}--> 
     202       </td> 
     203    </tr> 
     204    <tr> 
    199205      <th>ポイント付与率<span class="attention"> *</span></th> 
    200206      <td> 
  • branches/version-2_5-dev/data/class/SC_CartSession.php

    r19680 r19688  
    349349    } 
    350350 
     351    /** 
     352     * カート内にある商品規格IDを全て取得する. 
     353     * 
     354     * @param integer $productTypeId 商品種別ID 
     355     * @return array 商品規格ID の配列 
     356     */ 
     357    function getAllProductClassID($productTypeId) { 
     358        $max = $this->getMax($productTypeId); 
     359        for($i = 0; $i <= $max; $i++) { 
     360            if($this->cartSession[$productTypeId][$i]['cart_no'] != "") { 
     361                $arrRet[] = $this->cartSession[$productTypeId][$i]['id']; 
     362            } 
     363        } 
     364        return $arrRet; 
     365    } 
     366 
    351367    function delAllProducts($productTypeId) { 
    352368        $max = $this->getMax($productTypeId); 
     
    499515        // 配送業者の送料を加算 
    500516        if (OPTION_DELIV_FEE == 1) { 
    501             $results['deliv_fee'] += $objDb->sfGetDelivFee( 
    502                                              array('deliv_pref' => $deliv_pref, 
    503                                                    'payment_id' => $payment_id)); 
     517            $results['deliv_fee'] += $objDb->sfGetDelivFee($deliv_pref, $productTypeId); 
    504518        } 
    505519 
  • branches/version-2_5-dev/data/class/SC_Product.php

    r19680 r19688  
    4848    /** 検索用並び替え条件配列 */ 
    4949    var $arrOrderData; 
    50      
     50 
    5151    /** 
    5252     * 商品検索結果の並び順を指定する。 
     
    574574        // TODO エラーハンドリング 
    575575        return true; 
     576    } 
     577 
     578    /** 
     579     * 引数の商品規格IDで有効な支払方法IDの配列を取得する. 
     580     * 
     581     * @param array $productClassIds 商品規格IDの配列 
     582     * @return array 支払方法IDの配列 
     583     */ 
     584    function getEnablePaymentIds($productClassIds) { 
     585        $size = count($productClassIds); 
     586        $objQuery =& SC_Query::getSingletonInstance(); 
     587        $objQuery->groupby = 'GROUP BY payment_id HAVING COUNT(payment_id) = ?'; 
     588        $paymentIds = $objQuery->getCol('dtb_payment_options', 'payment_id', 
     589                                        'product_class_id IN (' . implode(', ', array_pad(array(), $size, '?')) . ')', 
     590                                        array_merge($productClassIds, array($size)), 
     591                                        MDB2_FETCHMODE_ORDERED); 
     592        var_dump($productClassIds); 
     593        return $paymentIds; 
    576594    } 
    577595 
  • branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php

    r19680 r19688  
    14841484 
    14851485    /** 
    1486      * お届け時間を取得する. 
    1487      * 
    1488      * @param integer $payment_id 支払い方法ID 
     1486     * 商品種別からお届け時間を取得する. 
     1487     * 
     1488     * @param integer $productTypeId 商品種別ID 
    14891489     * @return array お届け時間の配列 
    14901490     */ 
    1491     function sfGetDelivTime($payment_id = "") { 
     1491    function sfGetDelivTime($productTypeId) { 
    14921492        $objQuery =& SC_Query::getSingletonInstance(); 
    14931493 
     
    14961496 
    14971497        if($payment_id != "") { 
    1498             $where = "del_flg = 0 AND payment_id = ?"; 
    1499             $arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id)); 
     1498            $where = "del_flg = 0 AND product_type_id = ?"; 
     1499            $arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($productTypeId)); 
    15001500            $deliv_id = $arrRet[0]['deliv_id']; 
    15011501        } 
     
    15161516     * @return string 指定の都道府県, 支払い方法の配送料金 
    15171517     */ 
    1518     function sfGetDelivFee($arrData) { 
    1519         $pref = $arrData['deliv_pref']; 
    1520         $payment_id = isset($arrData['payment_id']) ? $arrData['payment_id'] : ""; 
    1521  
    1522         $objQuery =& SC_Query::getSingletonInstance(); 
    1523  
    1524         $deliv_id = ""; 
    1525  
    1526         // 支払い方法が指定されている場合は、対応した配送業者を取得する 
    1527         if($payment_id != "") { 
    1528             $where = "del_flg = 0 AND payment_id = ?"; 
    1529             $arrRet = $objQuery->select("deliv_id", "dtb_payment", $where, array($payment_id)); 
    1530             $deliv_id = $arrRet[0]['deliv_id']; 
    1531         // 支払い方法が指定されていない場合は、先頭の配送業者を取得する 
    1532         } else { 
    1533             $where = "del_flg = 0"; 
    1534             $objQuery->setOrder("rank DESC"); 
    1535             $objQuery->setLimitOffset(1); 
    1536             $arrRet = $objQuery->select("deliv_id", "dtb_deliv", $where); 
    1537             $deliv_id = $arrRet[0]['deliv_id']; 
    1538         } 
     1518    function sfGetDelivFee($pref_id, $product_type_id) { 
     1519        $objQuery =& SC_Query::getSingletonInstance(); 
    15391520 
    15401521        // 配送業者から配送料を取得 
     
    15421523 
    15431524            // 都道府県が指定されていない場合は、東京都の番号を指定しておく 
    1544             if($pref == "") { 
    1545                 $pref = 13; 
     1525            if($pref_id == "") { 
     1526                $pref_id = 13; 
    15461527            } 
    15471528 
    15481529            $objQuery =& SC_Query::getSingletonInstance(); 
    1549             $where = "deliv_id = ? AND pref = ?"; 
    1550             $arrRet= $objQuery->select("fee", "dtb_delivfee", $where, array($deliv_id, $pref)); 
     1530            $where = "product_type_id = ? AND pref = ?"; 
     1531            $arrRet= $objQuery->select("fee", "dtb_delivfee", $where, array($product_type_id, $pref_id)); 
    15511532        } 
    15521533        return $arrRet[0]['fee']; 
  • branches/version-2_5-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php

    r19670 r19688  
    7474        $this->arrProductType = $masterData->getMasterData("mtb_product_type"); 
    7575        $this->arrMaker = SC_Helper_DB_Ex::sfGetIDValueList("dtb_maker", "maker_id", "name"); 
     76        $this->arrPayments = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); 
    7677        $this->tpl_nonclass = true; 
    7778    } 
  • branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Payment.php

    r19684 r19688  
    129129        $this->arrData = $objCartSess->calculate($this->cartKey, $objCustomer); 
    130130 
     131        // 購入金額の取得 
     132        $total_inctax = $objCartSess->getAllProductsTotal($this->cartKey); 
     133 
     134        // 支払い方法の取得 
     135        $this->arrPayment = $this->lfGetPayment($total_inctax, $this->cartKey, 
     136                                                $objCartSess->getAllProductClassID($this->cartKey)); 
     137 
    131138        if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
    132139 
     
    171178        } 
    172179 
    173         // 購入金額の取得 
    174         $total_inctax = $objCartSess->getAllProductsTotal($this->cartKey); 
    175         // 支払い方法の取得 
    176         $this->arrPayment = $this->lfGetPayment($total_inctax); 
    177180        // 支払い方法の画像があるなしを取得($img_show true:ある false:なし) 
    178181        $this->img_show = $this->lfGetImgShow($this->arrPayment); 
     
    371374    } 
    372375 
    373     function lfGetPayment($total_inctax) { 
     376    function lfGetPayment($total_inctax, $productTypeId, $productClassIds) { 
     377 
     378        // 有効な支払方法を取得 
     379        $objProduct = new SC_Product(); 
     380        $paymentIds = $objProduct->getEnablePaymentIds($productClassIds); 
     381        $where = 'del_flg = 0 AND payment_id IN (' . implode(', ', array_pad(array(), count($paymentIds), '?')) . ')'; 
     382 
    374383        $objQuery = new SC_Query(); 
    375384        $objQuery->setOrder("rank DESC"); 
    376  
    377         //削除されていない支払方法を取得 
    378         $arrval = null; 
    379         $where = "del_flg = 0 AND deliv_id IN (SELECT deliv_id FROM dtb_deliv WHERE del_flg = 0) "; 
    380  
    381         //ダウンロード商品の有無判定 
    382         if($this->cartdown != 0){ 
    383             //ダウンロード商品を含む場合は、オンライン決済以外は選択できない。 
    384             $arrval = explode(",", ONLINE_PAYMENT); 
    385             $tmp_where = ""; 
    386             foreach ($arrval as $val) { 
    387                 if($tmp_where == "") { 
    388                     $tmp_where.= "AND payment_id IN ( ?"; 
    389                 } else { 
    390                     $tmp_where.= ",? "; 
    391                 } 
    392             } 
    393             $tmp_where.= " ) "; 
    394             $where .= $tmp_where; 
    395         } 
    396  
    397385        // 削除されていない支払方法を取得 
    398         $arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", $where, $arrval); 
     386        $arrRet = $objQuery->select("payment_id, payment_method, rule, upper_rule, note, payment_image", "dtb_payment", $where, $paymentIds); 
    399387 
    400388        // 配列初期化 
     
    402390        // 選択可能な支払方法を判定 
    403391        foreach($arrRet as $data) { 
    404             //ダウンロード販売に対する注意追加 
    405             if($this->cartdown != 0){ 
    406                 $data['payment_method'] = $data['payment_method'] . "  (ダウンロード商品を含む場合、オンライン決済のみ選択可能です)"; 
    407             } 
    408392            // 下限と上限が設定されている 
    409393            if (strlen($data['rule']) != 0 && strlen($data['upper_rule']) != 0) { 
     
    466450        $total_inctax = $objCartSess->getAllProductsTotal(); 
    467451        // 支払い方法の取得 
    468         $arrPayment = $this->lfGetPayment($total_inctax); 
     452        $arrPayment = $this->lfGetPayment($total_inctax, $this->cartKey, 
     453                                          $objCartSess->getAllProductClassID($this->cartKey)); 
    469454        $pay_flag = true; 
    470455        foreach ($arrPayment as $key => $payment) { 
     
    485470        $objQuery = new SC_Query(); 
    486471        $where = "payment_id = ?"; 
    487         $arrRet = $objQuery->select("charge, deliv_id", "dtb_payment", $where, array($payment_id)); 
     472        $arrRet = $objQuery->select("charge", "dtb_payment", $where, array($payment_id)); 
    488473        return (array($arrRet[0]['charge'], $arrRet[0]['deliv_id'])); 
    489474    } 
     
    627612 
    628613        // 配送時間の取得 
    629         $arrRet = $objDb->sfGetDelivTime($this->objFormParam->getValue('payment_id')); 
     614        $arrRet = $objDb->sfGetDelivTime($this->cartKey); 
    630615        // JSONエンコード 
    631616        echo $objJson->encode($arrRet); 
Note: See TracChangeset for help on using the changeset viewer.