Index: /branches/version-2_5-dev/html/install/sql/create_table_pgsql.sql
===================================================================
--- /branches/version-2_5-dev/html/install/sql/create_table_pgsql.sql	(revision 19860)
+++ /branches/version-2_5-dev/html/install/sql/create_table_pgsql.sql	(revision 19861)
@@ -697,5 +697,5 @@
     shipping_addr02 text,
     deliv_id int NOT NULL,
-    time_id int NOT NULL,
+    time_id int,
     shipping_fee NUMERIC,
     shipping_time TEXT,
Index: /branches/version-2_5-dev/html/install/sql/create_table_mysql.sql
===================================================================
--- /branches/version-2_5-dev/html/install/sql/create_table_mysql.sql	(revision 19860)
+++ /branches/version-2_5-dev/html/install/sql/create_table_mysql.sql	(revision 19861)
@@ -695,5 +695,5 @@
     shipping_addr02 text,
     deliv_id int NOT NULL,
-    time_id int NOT NULL,
+    time_id int,
     shipping_fee NUMERIC,
     shipping_time TEXT,
Index: /branches/version-2_5-dev/data/class/helper/SC_Helper_Purchase.php
===================================================================
--- /branches/version-2_5-dev/data/class/helper/SC_Helper_Purchase.php	(revision 19860)
+++ /branches/version-2_5-dev/data/class/helper/SC_Helper_Purchase.php	(revision 19861)
@@ -71,5 +71,6 @@
         $orderTemp['status'] = $orderStatus;
         $orderId = $this->registerOrder($orderTemp, $objCartSession,
-                                        $_SESSION['cartKey']);
+                                        $objCartSession->getKey());
+        $this->registerShipping($orderId, $this->getShippingTemp());
         $objQuery->commit();
         $objCustomer->updateSession();
@@ -172,4 +173,11 @@
 
     /**
+     * セッションの配送情報を取得する.
+     */
+    function getShippingTemp() {
+        return $_SESSION['shipping'];
+    }
+
+    /**
      * 配送情報をセッションに保存する.
      */
@@ -188,4 +196,11 @@
 
     /**
+     * セッションの配送情報を破棄する.
+     */
+    function unsetShippingTemp() {
+        unset($_SESSION['shipping']);
+    }
+
+    /**
      * 会員情報を受注情報にコピーする.
      *
@@ -196,15 +211,14 @@
      * @param array $dest コピー先の配列
      * @param SC_Customer $objCustomer SC_Customer インスタンス
+     * @param string $prefix コピー先の接頭辞. デフォルト order
      * @param array $keys コピー対象のキー
-     * @param string $prefix コピー先の接頭辞. デフォルト order
      * @return void
      */
-    function copyFromCustomer(&$dest, &$objCustomer,
+    function copyFromCustomer(&$dest, &$objCustomer, $prefix = 'order',
                               $keys = array('name01', 'name02', 'kana01', 'kana02',
                                             'sex', 'zip01', 'zip02', 'pref',
                                             'addr01', 'addr02',
                                             'tel01', 'tel02', 'tel03', 'job',
-                                            'birth', 'email'),
-                              $prefix = 'order') {
+                                            'birth', 'email')) {
         if ($objCustomer->isLoginSuccess(true)) {
 
@@ -329,4 +343,37 @@
             }
             return $arrDelivTime;
+    }
+
+    /**
+     * 商品種別ID から配送業者ID を取得する.
+     */
+    function getDeliv($productTypeId) {
+        $objQuery =& SC_Query::getSingletonInstance();
+        return $objQuery->get("deliv_id", "dtb_deliv", "product_type_id = ?",
+                                 array($productTypeId));
+    }
+
+    /**
+     * 配送情報を登録する.
+     */
+    function registerShipping($orderId, $params) {
+        $objQuery =& SC_Query::getSingletonInstance();
+
+        $cols = $objQuery->listTableFields('dtb_shipping');
+
+        foreach ($params as $shipping_id => $shipping_val) {
+            // 存在するカラムのみ INSERT
+            foreach ($shipping_val as $key => $val) {
+                if (in_array($key, $cols)) {
+                    $sqlval[$key] = $val;
+                }
+            }
+
+            $sqlval['order_id'] = $orderId;
+            $sqlval['shipping_id'] = $shipping_id;
+            $sqlval['create_date'] = 'Now()';
+            $sqlval['update_date'] = 'Now()';
+            $objQuery->insert("dtb_shipping", $sqlval);
+        }
     }
 
Index: /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Confirm.php
===================================================================
--- /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Confirm.php	(revision 19860)
+++ /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Confirm.php	(revision 19861)
@@ -77,4 +77,5 @@
         $objQuery = new SC_Query();
         $objDb = new SC_Helper_DB_Ex();
+        $objPurchase = new SC_Helper_Purchase_Ex();
 
         // 前のページで正しく登録手続きが行われた記録があるか判定
@@ -82,12 +83,9 @@
 
         // ユーザユニークIDの取得と購入状態の正当性をチェック
-        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
+        $uniqid = $objSiteSess->getUniqId();
+        $objPurchase->verifyChangeCart($uniqid, $objCartSess);
         $this->tpl_uniqid = $uniqid;
 
-        //ダウンロード商品判定
-        $this->cartdown = $objDb->chkCartDown($objCartSess);
-
-
-        $this->cartKey = $_SESSION['cartKey'];
+        $this->cartKey = $objCartSess->getKey();
 
         // カート内商品のチェック
@@ -108,5 +106,5 @@
         // TODO リファクタリング
         // 一時受注テーブルの読込
-        $tmpData = $objDb->sfGetOrderTemp($uniqid);
+        $tmpData = $objPurchase->getOrderTemp($uniqid);
 
         // カート集計を元に最終計算
@@ -144,11 +142,8 @@
             $arrData["order_id"] = $objQuery->nextval("dtb_order_order_id");
 
-            // セッション情報を保持
-            $arrData['session'] = serialize($_SESSION);
-
             // 集計結果を受注一時テーブルに反映
             unset($arrData[0]); // FIXME
             unset($arrData[1]);
-            $objDb->sfRegistTempOrder($uniqid, $arrData);
+            $objPurchase->saveOrderTemp($uniqid, $arrData, $objCustomer);
             // 正常に登録されたことを記録しておく
             $objSiteSess->setRegistFlag();
@@ -157,10 +152,9 @@
             if($payment_type != "") {
                 $_SESSION["payment_id"] = $arrData['payment_id'];
-                $objPurchase = new SC_Helper_Purchase_Ex();
+
                 $objPurchase->completeOrder(ORDER_PENDING);
                 $this->objDisplay->redirect($this->getLocation(SHOPPING_MODULE_URL_PATH));
             }else{
                 // 受注を完了し, 購入完了ページへ
-                $objPurchase = new SC_Helper_Purchase_Ex();
                 $objPurchase->completeOrder(ORDER_NEW);
                 $objPurchase->sendOrderMail($arrData["order_id"]);
Index: /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Payment.php
===================================================================
--- /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Payment.php	(revision 19860)
+++ /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Payment.php	(revision 19861)
@@ -143,9 +143,11 @@
             if(count($this->arrErr) == 0) {
                 // DBへのデータ登録
-                $this->lfRegistData($uniqid);
+                $this->lfRegistData($uniqid, $objPurchase);
+                $_SESSION['shipping'][0]['time_id'] = $this->objFormParam->getValue('deliv_time_id');
+                $_SESSION['shipping'][0]['deliv_date'] = $this->objFormParam->getValue('deliv_date');
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
                 // 確認ページへ移動
-                $this->objDisplay->redirect($this->getLocation(SHOPPING_CONFIRM_URL_PATH, array(), true));
+                SC_Response_Ex::sendRedirect(SHOPPING_CONFIRM_URL_PATH);
                 exit;
             }else{
@@ -161,5 +163,5 @@
             // 正常な推移であることを記録しておく
             $objSiteSess->setRegistFlag();
-            $this->objDisplay->redirect(SHOPPING_URL);
+            SC_Response_Ex::sendRedirect(SHOPPING_URL);
             exit;
             break;
@@ -364,8 +366,8 @@
         $this->objFormParam->addParam("お支払い方法", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("ポイント", "use_point", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK", "ZERO_START"));
-        $this->objFormParam->addParam("お届け時間", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), "", false);
+        $this->objFormParam->addParam("お届け時間", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("ご質問", "message", LTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("ポイントを使用する", "point_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '2');
-        $this->objFormParam->addParam("お届け日", "deliv_date", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"), "", false);
+        $this->objFormParam->addParam("お届け日", "deliv_date", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
     }
 
@@ -427,6 +429,5 @@
 
     /* DBへデータの登録 */
-    function lfRegistData($uniqid) {
-        $objDb = new SC_Helper_DB_Ex();
+    function lfRegistData($uniqid, &$objPurchase) {
 
         $sqlval = $this->objFormParam->getDbArray();
@@ -444,6 +445,5 @@
         }
 
-        // 受注_Tempテーブルに登録
-        $objDb->sfRegistTempOrder($uniqid, $sqlval);
+        $objPurchase->saveOrderTemp($uniqid, $sqlval);
     }
 
Index: /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping.php
===================================================================
--- /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping.php	(revision 19860)
+++ /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping.php	(revision 19861)
@@ -141,5 +141,5 @@
             if(count($this->arrErr) == 0) {
                 // DBへのデータ登録
-                $this->lfRegistData($uniqid, $objPurchase, $objCustomer);
+                $this->lfRegistData($uniqid, $objPurchase, $objCustomer, $this->cartKey);
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
@@ -163,5 +163,5 @@
             if(count($this->arrErr) == 0) {
                 // DBへのデータ登録
-                $this->lfRegistData($uniqid, $objPurchase, $objCustomer);
+                $this->lfRegistData($uniqid, $objPurchase, $objCustomer, $this->cartKey);
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
@@ -337,5 +337,5 @@
 
     /* DBへデータの登録 */
-    function lfRegistData($uniqid, &$objPurchase, &$objCustomer) {
+    function lfRegistData($uniqid, &$objPurchase, &$objCustomer, $productTypeId) {
         $params = $this->objFormParam->getHashArray();
         $sqlval = $this->objFormParam->getDbArray();
@@ -344,7 +344,8 @@
         $sqlval['update_date'] = 'Now()';
         $sqlval['customer_id'] = '0';
+        $sqlval['deliv_id'] = $objPurchase->getDeliv($productTypeId);
 
         // お届け先を指定しない場合、
-        if ($sqlval['deliv_check'] != '1') {
+        if ($params['deliv_check'] != '1') {
             // order_* を shipping_* へコピー
             $objPurchase->copyFromOrder($sqlval, $params);
Index: /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Deliv.php
===================================================================
--- /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Deliv.php	(revision 19860)
+++ /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Deliv.php	(revision 19861)
@@ -79,4 +79,5 @@
         $objCustomer = new SC_Customer();
         $objDb = new SC_Helper_DB_Ex();
+        $objPurchase = new SC_Helper_Purchase_Ex();
         // クッキー管理クラス
         $objCookie = new SC_Cookie(COOKIE_EXPIRE);
@@ -99,6 +100,5 @@
         $this->tpl_uniqid = $uniqid;
 
-        //ダウンロード商品判定
-        $this->cartdown = $objDb->chkCartDown($objCartSess);
+        $this->cartKey = $objCartSess->getKey();
 
         if (!isset($_POST['mode'])) $_POST['mode'] = "";
@@ -139,5 +139,5 @@
             }
             //ダウンロード商品判定
-            if($this->cartdown==2){
+            if($this->cartKey == PRODUCT_TYPE_DOWNLOAD){
                 // 会員情報の住所を受注一時テーブルに書き込む
                 $objDb->sfRegistDelivData($uniqid, $objCustomer);
@@ -160,8 +160,13 @@
         // 会員登録住所に送る
         case 'customer_addr':
+            $sqlval = array();
             // 会員登録住所がチェックされている場合
             if ($_POST['deliv_check'] == '-1') {
                 // 会員情報の住所を受注一時テーブルに書き込む
-                $this->lfRegistDelivData($uniqid, $objCustomer);
+                $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping');
+                $sqlval['deliv_id'] = $objPurchase->getDeliv($this->cartKey);
+                $objPurchase->saveShippingTemp($sqlval);
+                $objPurchase->saveOrderTemp($uniqid, $sqlval, $objCustomer);
+                //$this->lfRegistDelivData($uniqid, $objCustomer);
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
