public function testGetShippingTemp_保有フラグがONの場合_商品のある情報のみ取得する()
 {
     $this->setUpShipping($this->getMultipleShipping());
     $this->expected = array('00001' => array('shipment_id' => '00001', 'shipment_item' => array('商品1'), 'shipping_pref' => '東京都'), '00002' => array('shipment_id' => '00002', 'shipment_item' => array('商品2'), 'shipping_pref' => '沖縄県'));
     $this->actual = SC_Helper_Purchase::getShippingTemp(TRUE);
     $this->verify('配送情報');
 }
 /**
  * 複数配送情報を一時保存する.
  *
  * 会員ログインしている場合は, その他のお届け先から住所情報を取得する.
  *
  * @param  integer            $uniqid       一時受注テーブルのユニークID
  * @param  SC_FormParam       $objFormParam SC_FormParam インスタンス
  * @param  SC_Customer        $objCustomer  SC_Customer インスタンス
  * @param  SC_Helper_Purchase $objPurchase  SC_Helper_Purchase インスタンス
  * @return void
  */
 public function saveMultipleShippings($uniqid, &$objFormParam, &$objCustomer, &$objPurchase, &$objAddress)
 {
     $arrParams = $objFormParam->getSwapArray();
     foreach ($arrParams as $arrParam) {
         $other_deliv_id = $arrParam['shipping'];
         if ($objCustomer->isLoginSuccess(true)) {
             if ($other_deliv_id != 0) {
                 $otherDeliv = $objAddress->getAddress($other_deliv_id, $objCustomer->getValue('customer_id'));
                 if (!$otherDeliv) {
                     SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', false, "入力値が不正です。<br />正しい値を入力してください。");
                     SC_Response_Ex::actionExit();
                 }
                 foreach ($otherDeliv as $key => $val) {
                     $arrValues[$other_deliv_id]['shipping_' . $key] = $val;
                 }
             } else {
                 $objPurchase->copyFromCustomer($arrValues[0], $objCustomer, 'shipping');
             }
         } else {
             $arrValues = $objPurchase->getShippingTemp();
         }
         $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] += $arrParam['quantity'];
     }
     $objPurchase->clearShipmentItemTemp();
     foreach ($arrValues as $shipping_id => $arrVal) {
         $objPurchase->saveShippingTemp($arrVal, $shipping_id);
     }
     foreach ($arrItemTemp as $other_deliv_id => $arrProductClassIds) {
         foreach ($arrProductClassIds as $product_class_id => $quantity) {
             if ($quantity == 0) {
                 continue;
             }
             $objPurchase->setShipmentItemTemp($other_deliv_id, $product_class_id, $quantity);
         }
     }
     //不必要な配送先を削除
     foreach ($_SESSION['shipping'] as $id => $arrShipping) {
         if (!isset($arrShipping['shipment_item'])) {
             $objPurchase->unsetOneShippingTemp($id);
         }
     }
     // $arrValues[0] には, 購入者の情報が格納されている
     $objPurchase->saveOrderTemp($uniqid, $arrValues[0], $objCustomer);
 }
コード例 #3
0
 /**
  * 入力済みの購入情報をフォームに設定する.
  *
  * 受注一時テーブル, セッションの配送情報から入力済みの購入情報を取得し,
  * フォームに設定する.
  *
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
  * @param integer $uniqid 購入一時情報のユニークID
  * @return void
  */
 function setFormParams(&$objFormParam, &$objPurchase, $uniqid)
 {
     $arrOrderTemp = $objPurchase->getOrderTemp($uniqid);
     if (SC_Utils_Ex::isBlank($arrOrderTemp)) {
         $arrOrderTemp = array('order_email' => '', 'order_birth' => '');
     }
     $arrShippingTemp = $objPurchase->getShippingTemp();
     $objFormParam->setParam($arrOrderTemp);
     /*
      * count($arrShippingTemp) > 1 は複数配送であり,
      * $arrShippingTemp[0] は注文者が格納されている
      */
     if (count($arrShippingTemp) > 1) {
         $objFormParam->setParam($arrShippingTemp[1]);
     } else {
         $objFormParam->setParam($arrShippingTemp[0]);
     }
     $objFormParam->setValue('order_email02', $arrOrderTemp['order_email']);
     $objFormParam->setDBDate($arrOrderTemp['order_birth']);
 }
コード例 #4
0
 /**
  * 複数配送情報を一時保存する.
  *
  * 会員ログインしている場合は, その他のお届け先から住所情報を取得する.
  *
  * @param integer $uniqid 一時受注テーブルのユニークID
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param SC_Customer $objCustomer SC_Customer インスタンス
  * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
  * @param SC_CartSession $objCartSess SC_CartSession インスタンス
  * @return void
  */
 function saveMultipleShippings($uniqid, &$objFormParam, &$objCustomer, &$objPurchase, &$objCartSess, &$objAddress)
 {
     $arrParams = $objFormParam->getSwapArray();
     foreach ($arrParams as $arrParam) {
         $other_deliv_id = $arrParam['shipping'];
         if ($objCustomer->isLoginSuccess(true)) {
             if ($other_deliv_id != 0) {
                 $otherDeliv = $objAddress->getAddress($other_deliv_id);
                 foreach ($otherDeliv as $key => $val) {
                     $arrValues[$other_deliv_id]['shipping_' . $key] = $val;
                 }
             } else {
                 $objPurchase->copyFromCustomer($arrValues[0], $objCustomer, 'shipping');
             }
         } else {
             $arrValues = $objPurchase->getShippingTemp();
         }
         $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] += $arrParam['quantity'];
     }
     $objPurchase->clearShipmentItemTemp();
     foreach ($arrValues as $shipping_id => $arrVal) {
         $objPurchase->saveShippingTemp($arrVal, $shipping_id);
     }
     foreach ($arrItemTemp as $other_deliv_id => $arrProductClassIds) {
         foreach ($arrProductClassIds as $product_class_id => $quantity) {
             if ($quantity == 0) {
                 continue;
             }
             $objPurchase->setShipmentItemTemp($other_deliv_id, $product_class_id, $quantity);
         }
     }
     //不必要な配送先を削除
     foreach ($_SESSION['shipping'] as $id => $arrShipping) {
         if (!isset($arrShipping['shipment_item'])) {
             $objPurchase->unsetOneShippingTemp($id);
         }
     }
     // $arrValues[0] には, 購入者の情報が格納されている
     $objPurchase->saveOrderTemp($uniqid, $arrValues[0], $objCustomer);
 }
コード例 #5
0
 /**
  * 複数配送情報を一時保存する.
  *
  * 会員ログインしている場合は, その他のお届け先から住所情報を取得する.
  *
  * @param integer $uniqid 一時受注テーブルのユニークID
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param SC_Customer $objCustomer SC_Customer インスタンス
  * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
  * @param SC_CartSession $objCartSess SC_CartSession インスタンス
  * @return void
  */
 function saveMultipleShippings($uniqid, &$objFormParam, &$objCustomer, &$objPurchase, &$objCartSess)
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $arrParams = $objFormParam->getSwapArray();
     foreach ($arrParams as $arrParam) {
         $other_deliv_id = $arrParam['shipping'];
         if ($objCustomer->isLoginSuccess(true)) {
             if ($other_deliv_id != 0) {
                 $otherDeliv = $objQuery->select('*', 'dtb_other_deliv', 'other_deliv_id = ?', array($other_deliv_id));
                 foreach ($otherDeliv[0] as $key => $val) {
                     $arrValues[$other_deliv_id]['shipping_' . $key] = $val;
                 }
             } else {
                 $objPurchase->copyFromCustomer($arrValues[0], $objCustomer, 'shipping');
             }
         } else {
             $arrValues = $objPurchase->getShippingTemp();
         }
         $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] += $arrParam['quantity'];
     }
     $objPurchase->clearShipmentItemTemp();
     foreach ($arrValues as $shipping_id => $arrVal) {
         $objPurchase->saveShippingTemp($arrVal, $shipping_id);
     }
     foreach ($arrItemTemp as $other_deliv_id => $arrProductClassIds) {
         foreach ($arrProductClassIds as $product_class_id => $quantity) {
             if ($quantity == 0) {
                 continue;
             }
             $objPurchase->setShipmentItemTemp($other_deliv_id, $product_class_id, $quantity);
         }
     }
     // $arrValues[0] には, 購入者の情報が格納されている
     $objPurchase->saveOrderTemp($uniqid, $arrValues[0], $objCustomer);
 }