Ignore:
Timestamp:
2011/01/11 01:06:14 (13 years ago)
Author:
nanasess
bzr:base-revision:
nanasess@fsm.ne.jp-20110110075706-tq0uswsfrsetr0rq
bzr:committer:
Kentaro Ohkouchi <nanasess@fsm.ne.jp>
bzr:file-ids:

data/Smarty/templates/default/shopping/multiple.tpl multiple.tpl-20110109122547-u3fq5xmi1b4jn5n4-1
data/class/helper/SC_Helper_Purchase.php sc_helper_purchase.p-20101020100530-jyaoa7ch9pdfjqzp-1
data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php 16093@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fmypage%2FLC_Page_Mypage_DeliveryAddr.php
data/class/pages/shopping/LC_Page_Shopping_Deliv.php 15223@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fshopping%2FLC_Page_Shopping_Deliv.php
data/class/pages/shopping/LC_Page_Shopping_Multiple.php lc_page_shopping_mul-20110109122547-u3fq5xmi1b4jn5n4-2
data/mtb_constants_init.php 16505@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fmtb_constants_init.php
html/install/sql/insert_data.sql 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fhtml%2Finstall%2Fsql%2Finsert_data.sql
bzr:mapping-version:
v4
bzr:merge:

nanasess@fsm.ne.jp-20110110160316-nohmzw2i9u84chmz
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
nanasess@fsm.ne.jp-20110110160608-f5e40kzi21icyxjp
bzr:revno:
2591
bzr:revprop:branch-nick:
branches/version-2_5-dev
bzr:root:
branches/version-2_5-dev
bzr:text-revisions:

data/Smarty/templates/default/shopping/multiple.tpl nanasess@fsm.ne.jp-20110110160316-nohmzw2i9u84chmz
data/class/helper/SC_Helper_Purchase.php nanasess@fsm.ne.jp-20110110160316-nohmzw2i9u84chmz
data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php nanasess@fsm.ne.jp-20110110160316-nohmzw2i9u84chmz
data/class/pages/shopping/LC_Page_Shopping_Deliv.php nanasess@fsm.ne.jp-20110110160316-nohmzw2i9u84chmz
data/class/pages/shopping/LC_Page_Shopping_Multiple.php nanasess@fsm.ne.jp-20110110160316-nohmzw2i9u84chmz
data/mtb_constants_init.php nanasess@fsm.ne.jp-20110110160316-nohmzw2i9u84chmz
html/install/sql/insert_data.sql nanasess@fsm.ne.jp-20110110160316-nohmzw2i9u84chmz
bzr:timestamp:
2011-01-11 01:06:08.532999992 +0900
bzr:user-agent:
bzr2.2.2+bzr-svn1.0.4
svn:original-date:
2011-01-10T16:06:08.533000Z
Message:

#843(複数配送先の指定)

  • 会員購入時のデータの保存まで対応
  • TODO 非会員購入/数量変更のカート反映/戻るボタン/購入確認画面/Myページ/管理画面
Location:
branches/version-2_5-dev/data
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/Smarty/templates/default/shopping/multiple.tpl

    r19860 r19862  
    4848            </p> 
    4949        <!--{/if}--> 
    50  
     50        <form name="form1" id="form1" method="post" action="?"> 
     51            <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
     52            <input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->" /> 
     53            <input type="hidden" name="mode" value="confirm" /> 
    5154            <table summary="商品情報"> 
    5255                <tr> 
     
    5760                    <th>お届け先</th> 
    5861                </tr> 
    59                 <!--{foreach from=$items item=item }--> 
     62                <!--{foreach from=$items item=item name=cartItem}--> 
     63                    <!--{assign var=index value=$smarty.foreach.cartItem.index}--> 
    6064                    <tr style="<!--{if $item.error}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->"> 
    61                         <td><a href="?" onclick="fnFormModeSubmit('form<!--{$key}-->', 'delete', 'cart_no', '<!--{$item.cart_no}-->'); return false;">削除</a> 
     65                        <td> 
     66                          <a href="?" onclick="fnFormModeSubmit('form<!--{$key}-->', 'delete', 'cart_no', '<!--{$smarty.foreach.cartItem.index}-->'); return false;">削除</a> 
     67                          <input type="hidden" name="cart_no<!--{$index}-->" value="<!--{$index}-->" /> 
     68                          <input type="hidden" name="product_class_id<!--{$index}-->" value="<!--{$item.product_class_id}-->" /> 
    6269                        </td> 
    6370                        <td class="phototd"> 
     
    8087                            <!--{$item.price02|sfCalcIncTax:$arrInfo.tax:$arrInfo.tax_rule|number_format}-->円 
    8188                        </td> 
    82                         <td><input type="text" name="quantity" value="1" size="4" /></td> 
    83                         <td><select name="shipping"><!--{html_options options=$addrs}--></select></td> 
     89                        <td> 
     90                          <!--{assign var=key value="quantity`$index`"}--> 
     91                          <input type="text" name="<!--{$key}-->" value="<!--{$arrForm[$key].value}-->" size="4" /> 
     92                        </td> 
     93                        <td> 
     94                          <!--{assign var=key value="shipping`$index`"}--> 
     95                          <select name="<!--{$key}-->"><!--{html_options options=$addrs selected=$arrForm[$key].value}--></select> 
     96                        </td> 
    8497                     </tr> 
    8598                  <!--{/foreach}--> 
    8699            </table> 
    87  
    88100            <div class="tblareabtn"> 
    89                 <a href="<!--{$smarty.const.URL_CART_TOP}-->" onmouseover="chgImgImageSubmit('<!--{$TPL_DIR}-->img/button/btn_back_on.gif',back03)" onmouseout="chgImgImageSubmit('<!--{$TPL_DIR}-->img/button/btn_back.gif',back03)"> 
     101                <a href="<!--{$smarty.const.CART_URL_PATH}-->" onmouseover="chgImgImageSubmit('<!--{$TPL_DIR}-->img/button/btn_back_on.gif',back03)" onmouseout="chgImgImageSubmit('<!--{$TPL_DIR}-->img/button/btn_back.gif',back03)"> 
    90102                    <img src="<!--{$TPL_DIR}-->img/button/btn_back.gif" width="150" height="30" alt="戻る" border="0" name="back03" id="back03" /></a> 
    91103                <input type="image" onmouseover="chgImgImageSubmit('<!--{$TPL_DIR}-->img/button/btn_address_select_on.gif',this)" onmouseout="chgImgImageSubmit('<!--{$TPL_DIR}-->img/button/btn_address_select.gif',this)" src="<!--{$TPL_DIR}-->img/button/btn_address_select.gif" alt="選択したお届け先に送る" class="box190" name="send_button" id="send_button" /> 
  • branches/version-2_5-dev/data/class/helper/SC_Helper_Purchase.php

    r19861 r19862  
    7272        $orderId = $this->registerOrder($orderTemp, $objCartSession, 
    7373                                        $objCartSession->getKey()); 
    74         $this->registerShipping($orderId, $this->getShippingTemp()); 
     74        $shippingTemp =& $this->getShippingTemp(); 
     75        if (count($shippingTemp) > 1) { 
     76            foreach ($shippingTemp as $shippingId => $val) { 
     77                $this->registerShipmentItem($orderId, $shippingId, 
     78                                            $val['shipment_item']); 
     79            } 
     80        } 
     81        $this->registerShipping($orderId, $shippingTemp); 
    7582        $objQuery->commit(); 
     83        $this->unsetShippingTemp(); 
    7684        $objCustomer->updateSession(); 
    7785    } 
     
    257265     */ 
    258266    function copyFromOrder(&$dest, $src, 
     267                           $prefix = 'shipping', $src_prefix = 'order', 
    259268                           $keys = array('name01', 'name02', 'kana01', 'kana02', 
    260269                                         'sex', 'zip01', 'zip02', 'pref', 
    261270                                         'addr01', 'addr02', 
    262                                          'tel01', 'tel02', 'tel03'), 
    263                            $prefix = 'shipping', $src_prefix = 'order') { 
     271                                         'tel01', 'tel02', 'tel03')) { 
    264272        foreach ($keys as $key) { 
    265273            if (in_array($key, $keys)) { 
     
    375383            $sqlval['update_date'] = 'Now()'; 
    376384            $objQuery->insert("dtb_shipping", $sqlval); 
     385        } 
     386    } 
     387 
     388    /** 
     389     * 配送商品を登録する. 
     390     */ 
     391    function registerShipmentItem($orderId, $shippingId, $params) { 
     392        $objQuery =& SC_Query::getSingletonInstance(); 
     393        $objProduct = new SC_Product(); 
     394        foreach ($params as $productClassId => $val) { 
     395            $d = $objProduct->getDetailAndProductsClass($productClassId); 
     396            $sqlval['order_id'] = $orderId; 
     397            $sqlval['shipping_id'] = $shippingId; 
     398            $sqlval['product_class_id'] = $productClassId; 
     399            $sqlval['product_name'] = $d['name']; 
     400            $sqlval['product_code'] = $d['product_code']; 
     401            $sqlval['classcategory_name1'] = $d['classcategory_name1']; 
     402            $sqlval['classcategory_name2'] = $d['classcategory_name2']; 
     403            $sqlval['price'] = $d['price']; 
     404            $sqlval['quantity'] = $val['quantity']; 
     405            $objQuery->insert("dtb_shipment_item", $sqlval); 
    377406        } 
    378407    } 
  • branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php

    r19860 r19862  
    138138                    } 
    139139                } else { 
    140                      
    141                     if ($_POST['ParentPage'] == MYPAGE_DELIVADDR_URL_PATH || $_POST['ParentPage'] == DELIV_URL_PATH) { 
     140                    $validUrl = array(MYPAGE_DELIVADDR_URL_PATH, 
     141                                      DELIV_URL_PATH, 
     142                                      MULTIPLE_URL_PATH); 
     143                    if (in_array($_POST['ParentPage'], $validUrl)) { 
    142144                        $this->tpl_onload = "fnUpdateParent('". $this->getLocation($_POST['ParentPage']) ."'); window.close();"; 
    143145                    } else { 
  • branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Deliv.php

    r19861 r19862  
    8080        $objDb = new SC_Helper_DB_Ex(); 
    8181        $objPurchase = new SC_Helper_Purchase_Ex(); 
     82        $objQuery = SC_Query::getSingletonInstance();; 
    8283        // クッキー管理クラス 
    8384        $objCookie = new SC_Cookie(COOKIE_EXPIRE); 
     
    9798 
    9899        // ユーザユニークIDの取得と購入状態の正当性をチェック 
    99         $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); 
     100        $uniqid = $objSiteSess->getUniqId(); 
     101        $objPurchase->verifyChangeCart($uniqid, $objCartSess); 
     102 
    100103        $this->tpl_uniqid = $uniqid; 
    101104 
     
    128131            if(!$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) { 
    129132                // 仮登録の判定 
    130                 $objQuery = new SC_Query; 
     133 
    131134                $where = "email = ? AND status = 1 AND del_flg = 0"; 
    132135                $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'])); 
     
    141144            if($this->cartKey == PRODUCT_TYPE_DOWNLOAD){ 
    142145                // 会員情報の住所を受注一時テーブルに書き込む 
    143                 $objDb->sfRegistDelivData($uniqid, $objCustomer); 
     146                $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping'); 
     147                $sqlval['deliv_id'] = $objPurchase->getDeliv($this->cartKey); 
     148                $objPurchase->saveShippingTemp($sqlval); 
     149                $objPurchase->saveOrderTemp($uniqid, $sqlval, $objCustomer); 
    144150                // 正常に登録されたことを記録しておく 
    145151                $objSiteSess->setRegistFlag(); 
     
    152158        case 'delete': 
    153159            if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) { 
    154                 $objQuery = new SC_Query(); 
    155160                $where = "other_deliv_id = ?"; 
    156161                $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id'])); 
     
    168173                $objPurchase->saveShippingTemp($sqlval); 
    169174                $objPurchase->saveOrderTemp($uniqid, $sqlval, $objCustomer); 
    170                 //$this->lfRegistDelivData($uniqid, $objCustomer); 
     175 
    171176                // 正常に登録されたことを記録しておく 
    172177                $objSiteSess->setRegistFlag(); 
    173178                // お支払い方法選択ページへ移動 
    174                 $this->objDisplay->redirect($this->getLocation(SHOPPING_PAYMENT_URL_PATH, array(), true)); 
     179                SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URL_PATH); 
    175180                exit; 
    176181            // 別のお届け先がチェックされている場合 
    177182            } elseif($_POST['deliv_check'] >= 1) { 
    178183                if (SC_Utils_Ex::sfIsInt($_POST['deliv_check'])) { 
    179                     $objQuery = new SC_Query(); 
    180184                    $deliv_count = $objQuery->count("dtb_other_deliv","customer_id=? and other_deliv_id = ?" ,array($objCustomer->getValue('customer_id'), $_POST['deliv_check'])); 
    181185                    if ($deliv_count != 1) { 
     
    183187                    } 
    184188 
    185                     // 登録済みの別のお届け先を受注一時テーブルに書き込む 
    186                     $this->lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['deliv_check']); 
     189                    $otherDeliv = $objQuery->select("*", "dtb_other_deliv", 
     190                                                    "other_deliv_id = ?", 
     191                                                    array($other_deliv_id)); 
     192                    $sqlval = $otherDeliv[0]; 
     193                    $sqlval['deliv_id'] = $objPurchase->getDeliv($this->cartKey); 
     194                    $objPurchase->saveShippingTemp($sqlval, $other_deliv_id); 
     195                    $objPurchase->saveOrderTemp($uniqid, $sqlval, $objCustomer); 
     196 
    187197                    // 正常に登録されたことを記録しておく 
    188198                    $objSiteSess->setRegistFlag(); 
    189199                    // お支払い方法選択ページへ移動 
    190                     $this->objDisplay->redirect($this->getLocation(SHOPPING_PAYMENT_URL_PATH, array(), true)); 
     200                    SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URL_PATH); 
    191201                    exit; 
    192202                } 
     
    199209        case 'return': 
    200210            // 確認ページへ移動 
    201             $this->objDisplay->redirect($this->getLocation(CART_URL_PATH, array(), true)); 
     211            SC_Response_Ex::sendRedirect(CART_URL_PATH); 
    202212            exit; 
    203213            break; 
    204214        // お届け先複数指定 
    205215        case 'multiple': 
    206             $this->objDisplay->redirect($this->getLocation('./multiple.php', array(), true)); 
     216            SC_Response_Ex::sendRedirect('multiple.php'); 
    207217            exit; 
    208218            break; 
    209219 
    210220        default: 
    211             $objQuery = new SC_Query(); 
    212             $where = "order_temp_id = ?"; 
    213             $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid)); 
    214             if (empty($arrRet)) $arrRet = array(""); 
    215             $this->objFormParam->setParam($arrRet[0]); 
     221            $arrOrderTemp = $objPurchase->getOrderTemp($uniqid); 
     222            if (empty($arrOrderTemp)) $arrOrderTemp = array(""); 
     223            $this->objFormParam->setParam($arrOrderTemp); 
    216224            break; 
    217225        } 
     
    480488    } 
    481489 
    482     /* 会員情報の住所を一時受注テーブルへ */ 
    483     function lfRegistDelivData($uniqid, $objCustomer) { 
    484         // 登録データの作成 
    485         $sqlval['order_temp_id'] = $uniqid; 
    486         $sqlval['update_date'] = 'Now()'; 
    487         $sqlval['customer_id'] = $objCustomer->getValue('customer_id'); 
    488         $sqlval['order_name01'] = $objCustomer->getValue('name01'); 
    489         $sqlval['order_name02'] = $objCustomer->getValue('name02'); 
    490         $sqlval['order_kana01'] = $objCustomer->getValue('kana01'); 
    491         $sqlval['order_kana02'] = $objCustomer->getValue('kana02'); 
    492         $sqlval['order_zip01'] = $objCustomer->getValue('zip01'); 
    493         $sqlval['order_zip02'] = $objCustomer->getValue('zip02'); 
    494         $sqlval['order_pref'] = $objCustomer->getValue('pref'); 
    495         $sqlval['order_addr01'] = $objCustomer->getValue('addr01'); 
    496         $sqlval['order_addr02'] = $objCustomer->getValue('addr02'); 
    497         $sqlval['order_tel01'] = $objCustomer->getValue('tel01'); 
    498         $sqlval['order_tel02'] = $objCustomer->getValue('tel02'); 
    499         $sqlval['order_tel03'] = $objCustomer->getValue('tel03'); 
    500         $sqlval['order_fax01'] = $objCustomer->getValue('fax01'); 
    501         $sqlval['order_fax02'] = $objCustomer->getValue('fax02'); 
    502         $sqlval['order_fax03'] = $objCustomer->getValue('fax03'); 
    503         $sqlval['order_birth'] = $objCustomer->getValue('birth'); 
    504         $sqlval['order_email'] = $objCustomer->getValue('email'); 
    505         /* 
    506         $sqlval['deliv_check'] = '-1'; 
    507         $sqlval['deliv_name01'] = $objCustomer->getValue('name01'); 
    508         $sqlval['deliv_name02'] = $objCustomer->getValue('name02'); 
    509         $sqlval['deliv_kana01'] = $objCustomer->getValue('kana01'); 
    510         $sqlval['deliv_kana02'] = $objCustomer->getValue('kana02'); 
    511         $sqlval['deliv_zip01'] = $objCustomer->getValue('zip01'); 
    512         $sqlval['deliv_zip02'] = $objCustomer->getValue('zip02'); 
    513         $sqlval['deliv_pref'] = $objCustomer->getValue('pref'); 
    514         $sqlval['deliv_addr01'] = $objCustomer->getValue('addr01'); 
    515         $sqlval['deliv_addr02'] = $objCustomer->getValue('addr02'); 
    516         $sqlval['deliv_tel01'] = $objCustomer->getValue('tel01'); 
    517         $sqlval['deliv_tel02'] = $objCustomer->getValue('tel02'); 
    518         $sqlval['deliv_tel03'] = $objCustomer->getValue('tel03'); 
    519         $sqlval['deliv_fax01'] = $objCustomer->getValue('fax01'); 
    520         $sqlval['deliv_fax02'] = $objCustomer->getValue('fax02'); 
    521         $sqlval['deliv_fax03'] = $objCustomer->getValue('fax03'); 
    522         */ 
    523         $objDb = new SC_Helper_DB_Ex(); 
    524         $objDb->sfRegistTempOrder($uniqid, $sqlval); 
    525     } 
    526  
    527     /* 別のお届け先住所を一時受注テーブルへ */ 
    528     function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) { 
    529         // 登録データの作成 
    530         $sqlval['order_temp_id'] = $uniqid; 
    531         $sqlval['update_date'] = 'Now()'; 
    532         $sqlval['customer_id'] = $objCustomer->getValue('customer_id'); 
    533  
    534         $sqlval['order_name01'] = $objCustomer->getValue('name01'); 
    535         $sqlval['order_name02'] = $objCustomer->getValue('name02'); 
    536         $sqlval['order_kana01'] = $objCustomer->getValue('kana01'); 
    537         $sqlval['order_kana02'] = $objCustomer->getValue('kana02'); 
    538         $sqlval['order_zip01'] = $objCustomer->getValue('zip01'); 
    539         $sqlval['order_zip02'] = $objCustomer->getValue('zip02'); 
    540         $sqlval['order_pref'] = $objCustomer->getValue('pref'); 
    541         $sqlval['order_addr01'] = $objCustomer->getValue('addr01'); 
    542         $sqlval['order_addr02'] = $objCustomer->getValue('addr02'); 
    543         $sqlval['order_tel01'] = $objCustomer->getValue('tel01'); 
    544         $sqlval['order_tel02'] = $objCustomer->getValue('tel02'); 
    545         $sqlval['order_tel03'] = $objCustomer->getValue('tel03'); 
    546         $sqlval['order_fax01'] = $objCustomer->getValue('fax01'); 
    547         $sqlval['order_fax02'] = $objCustomer->getValue('fax02'); 
    548         $sqlval['order_fax03'] = $objCustomer->getValue('fax03'); 
    549         $sqlval['order_birth'] = $objCustomer->getValue('birth'); 
    550         $sqlval['order_email'] = $objCustomer->getValue('email'); 
    551  
    552  
    553         $objQuery = new SC_Query(); 
    554         $where = "other_deliv_id = ?"; 
    555         $arrRet = $objQuery->select("*", "dtb_other_deliv", $where, array($other_deliv_id)); 
    556         $_SESSION['shipping'] = $arrRet; 
    557         /* 
    558         $sqlval['deliv_check'] = $other_deliv_id; 
    559         $sqlval['deliv_name01'] = $arrRet[0]['name01']; 
    560         $sqlval['deliv_name02'] = $arrRet[0]['name02']; 
    561         $sqlval['deliv_kana01'] = $arrRet[0]['kana01']; 
    562         $sqlval['deliv_kana02'] = $arrRet[0]['kana02']; 
    563         $sqlval['deliv_zip01'] = $arrRet[0]['zip01']; 
    564         $sqlval['deliv_zip02'] = $arrRet[0]['zip02']; 
    565         $sqlval['deliv_pref'] = $arrRet[0]['pref']; 
    566         $sqlval['deliv_addr01'] = $arrRet[0]['addr01']; 
    567         $sqlval['deliv_addr02'] = $arrRet[0]['addr02']; 
    568         $sqlval['deliv_tel01'] = $arrRet[0]['tel01']; 
    569         $sqlval['deliv_tel02'] = $arrRet[0]['tel02']; 
    570         $sqlval['deliv_tel03'] = $arrRet[0]['tel03']; 
    571         */ 
    572         $objDb = new SC_Helper_DB_Ex(); 
    573         $objDb->sfRegistTempOrder($uniqid, $sqlval); 
    574     } 
    575  
    576490    /* 入力内容のチェック */ 
    577491    function lfCheckError() { 
  • branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Multiple.php

    r19860 r19862  
    6868        $objSiteSess = new SC_SiteSession(); 
    6969        $objCartSess = new SC_CartSession(); 
    70         $this->objCustomer = new SC_Customer(); 
    71  
    72         $this->addrs = $this->getDelivAddrs(); 
    73         $this->cartKey = $_SESSION['cartKey']; 
    74         $cartLists =& $objCartSess->getCartList($this->cartKey); 
     70        $objPurchase = new SC_Helper_Purchase_Ex(); 
     71        $objCustomer = new SC_Customer(); 
     72        $objQuery = SC_Query::getSingletonInstance(); 
     73        $this->objFormParam = new SC_FormParam(); 
     74 
     75        $this->addrs = $this->getDelivAddrs($objCustomer); 
     76        $this->items = $this->splitItems($objCartSess); 
     77 
     78        $this->lfInitParam($this->items); 
     79        $this->objFormParam->setParam($_POST); 
     80 
     81        $uniqid = $objSiteSess->getUniqId(); 
     82        $objPurchase->verifyChangeCart($uniqid, $objCartSess); 
     83 
     84        $this->tpl_uniqid = $uniqid; 
     85 
     86        $this->cartKey = $objCartSess->getKey(); 
     87        if ($_SERVER["REQUEST_METHOD"] == "POST") { 
     88            if (!SC_Helper_Session_Ex::isValidToken()) { 
     89                SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true); 
     90            } 
     91        } 
     92 
     93        if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
     94 
     95        switch ($_POST['mode']) { 
     96            case 'delete': 
     97                // TODO 
     98                break; 
     99 
     100            case 'confirm': 
     101                $this->arrErr = $this->lfCheckError($this->objFormParam); 
     102                if (SC_Utils_Ex::isBlank($this->arrErr)) { 
     103                    // TODO リファクタリング 
     104                    $params = $this->objFormParam->getHashArray(); 
     105                    $i = 0; 
     106                    while ($params['cart_no' . $i] != null) { 
     107                        $other_deliv_id = $params['shipping' . $i]; 
     108                        if ($other_deliv_id != 0) { 
     109                            $otherDeliv = $objQuery->select("*", "dtb_other_deliv", 
     110                                                            "other_deliv_id = ?", 
     111                                                            array($other_deliv_id)); 
     112                            foreach ($otherDeliv[0] as $key => $val) { 
     113                                $sqlval[$other_deliv_id]['shipping_' . $key] = $val; 
     114                            } 
     115                        } else { 
     116                            $objPurchase->copyFromCustomer($sqlval[0], $objCustomer, 
     117                                                           "shipping"); 
     118                        } 
     119                        $sqlval[$other_deliv_id]['deliv_id'] = $objPurchase->getDeliv($this->cartKey); 
     120                        $sqlval[$other_deliv_id]['shipment_item'][$params['product_class_id' . $i]]['shipping_id'] = $other_deliv_id; 
     121                        $sqlval[$other_deliv_id]['shipment_item'][$params['product_class_id' . $i]]['quantity'] += $params['quantity' . $i]; 
     122                        $sqlval[$other_deliv_id]['shipment_item'][$params['product_class_id' . $i]]['product_class_id'] = $params['product_class_id' . $i]; 
     123                        $i++; 
     124                    } 
     125 
     126                    foreach ($sqlval as $key => $val) { 
     127                        $objPurchase->saveShippingTemp($val, $key); 
     128                    } 
     129 
     130                    // FIXME 
     131                    $objPurchase->saveOrderTemp($uniqid, $sqlval[0], $objCustomer); 
     132                    $objSiteSess->setRegistFlag(); 
     133                    SC_Response_Ex::sendRedirect("payment.php"); 
     134                    exit; 
     135                } 
     136                break; 
     137 
     138        default: 
     139        } 
     140 
     141        $this->arrForm = $this->objFormParam->getFormParamList(); 
     142        $this->transactionid = SC_Helper_Session_Ex::getToken(); 
     143    } 
     144 
     145    /** 
     146     * デストラクタ. 
     147     * 
     148     * @return void 
     149     */ 
     150    function destroy() { 
     151        parent::destroy(); 
     152    } 
     153 
     154    /** 
     155     * フォームを初期化する. 
     156     */ 
     157    function lfInitParam($items) { 
     158        for ($i = 0; $i < count($items); $i++) { 
     159            $this->objFormParam->addParam("商品規格ID", "product_class_id" . $i, INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 
     160            $this->objFormParam->addParam("数量", "quantity" . $i, INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), 1); 
     161            $this->objFormParam->addParam("配送先住所", "shipping" . $i, INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 
     162            $this->objFormParam->addParam("カート番号", "cart_no" . $i, INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 
     163        } 
     164    } 
     165 
     166 
     167    /** 
     168     * カートの商品を数量ごとに分割する 
     169     */ 
     170    function splitItems(&$objCartSess) { 
     171        $cartLists =& $objCartSess->getCartList($objCartSess->getKey()); 
    75172        foreach (array_keys($cartLists) as $key) { 
    76173            for ($i = 0; $i < $cartLists[$key]['quantity']; $i++) { 
    77                 $this->items[] =& $cartLists[$key]['productsClass']; 
     174                $items[] =& $cartLists[$key]['productsClass']; 
    78175            } 
    79176        } 
    80  
    81     } 
    82  
    83     /** 
    84      * デストラクタ. 
    85      * 
    86      * @return void 
    87      */ 
    88     function destroy() { 
    89         parent::destroy(); 
     177        return $items; 
    90178    } 
    91179 
     
    96184     * 非会員の場合は, 「お届け先の指定」画面で入力した住所を取得する. 
    97185     */ 
    98     function getDelivAddrs() { 
    99         if ($this->objCustomer->isLoginSuccess()) { 
    100             $addrs = $this->objCustomer->getCustomerAddress($_SESSION['customer']['customer_id']); 
     186    function getDelivAddrs(&$objCustomer) { 
     187        if ($objCustomer->isLoginSuccess()) { 
     188            $addrs = $objCustomer->getCustomerAddress($_SESSION['customer']['customer_id']); 
    101189        } else { 
    102190            // TODO 
     
    111199        return $results; 
    112200    } 
     201 
     202    function lfCheckError(&$objFormParam) { 
     203        $objFormParam->convParam(); 
     204        return $objFormParam->checkError(); 
     205    } 
    113206} 
    114207?> 
  • branches/version-2_5-dev/data/mtb_constants_init.php

    r19833 r19862  
    337337/** お届け先設定 */ 
    338338define('DELIV_URL_PATH', URL_PATH . "shopping/deliv.php"); 
     339/** 複数お届け先設定 */ 
     340define('MULTIPLE_URL_PATH', URL_PATH . "shopping/multiple.php"); 
    339341/** Myページトップ */ 
    340342define('URL_MYPAGE_TOP', HTTPS_URL . "mypage/login.php"); 
Note: See TracChangeset for help on using the changeset viewer.