コード例 #1
0
ファイル: Multiple.php プロジェクト: ChigusaYasoda/ec-cube
 /**
  * 複数配送情報を一時保存する.
  *
  * 会員ログインしている場合は, その他のお届け先から住所情報を取得する.
  *
  * @param   integer         $uniqid       一時受注テーブルのユニークID
  * @param   FormParam       $objFormParam FormParam インスタンス
  * @param   Customer        $objCustomer  Customer インスタンス
  * @param   PurchaseHelper  $objPurchase  PurchaseHelper インスタンス
  * @param   AddressHelper   $objAddress
  * @return  void
  */
 public function saveMultipleShippings($uniqid, FormParam &$objFormParam, Customer &$objCustomer, PurchaseHelper &$objPurchase, AddressHelper &$objAddress)
 {
     $arrValues = array();
     $arrItemTemp = array();
     $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) {
                     Utils::sfDispSiteError(FREE_ERROR_MSG, '', false, "入力値が不正です。<br />正しい値を入力してください。");
                     Application::alias('eccube.response')->actionExit();
                 }
                 foreach ($otherDeliv as $key => $val) {
                     $arrValues[$other_deliv_id]['shipping_' . $key] = $val;
                 }
             } else {
                 $objPurchase->copyFromCustomer($arrValues[0], $objCustomer, 'shipping');
             }
         } else {
             $arrValues = $objPurchase->getShippingTemp();
         }
         if (!isset($arrItemTemp[$other_deliv_id])) {
             $arrItemTemp[$other_deliv_id] = array();
         }
         if (!isset($arrItemTemp[$other_deliv_id][$arrParam['product_class_id']])) {
             $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] = 0;
         }
         $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);
 }
コード例 #2
0
ファイル: Index.php プロジェクト: ChigusaYasoda/ec-cube
 /**
  * データの一時登録を行う.
  *
  * 非会員向けの処理
  * @param integer            $uniqid       受注一時テーブルのユニークID
  * @param PurchaseHelper $objPurchase  PurchaseHelper インスタンス
  * @param Customer        $objCustomer  Customer インスタンス
  * @param FormParam       $objFormParam FormParam インスタンス
  * @param boolean            $isMultiple   複数配送の場合 true
  */
 public function lfRegistData($uniqid, &$objPurchase, Customer &$objCustomer, &$objFormParam, $isMultiple = false)
 {
     $arrParams = $objFormParam->getHashArray();
     // 注文者をお届け先とする配列を取得
     $arrShippingOwn = array();
     $objPurchase->copyFromOrder($arrShippingOwn, $arrParams);
     // 都度入力されたお届け先
     $arrShipping = $objPurchase->extractShipping($arrParams);
     if ($isMultiple) {
         $objPurchase->unsetOneShippingTemp(0);
         $objPurchase->unsetOneShippingTemp(1);
         $objPurchase->saveShippingTemp($arrShippingOwn, 0);
         if ($arrParams['deliv_check'] == '1') {
             $objPurchase->saveShippingTemp($arrShipping, 1);
         }
     } else {
         $objPurchase->unsetAllShippingTemp(true);
         if ($arrParams['deliv_check'] == '1') {
             $objPurchase->saveShippingTemp($arrShipping, 1);
         } else {
             $objPurchase->saveShippingTemp($arrShippingOwn, 0);
         }
     }
     $arrValues = $objFormParam->getDbArray();
     // 登録データの作成
     $arrValues['order_birth'] = Utils::sfGetTimestamp($arrParams['order_year'], $arrParams['order_month'], $arrParams['order_day']);
     $arrValues['update_date'] = 'CURRENT_TIMESTAMP';
     $arrValues['customer_id'] = '0';
     $objPurchase->saveOrderTemp($uniqid, $arrValues, $objCustomer);
 }
コード例 #3
0
ファイル: Deliv.php プロジェクト: ChigusaYasoda/ec-cube
 /**
  * お届け先チェックの値に応じて, お届け先情報を保存する.
  *
  * 会員住所がチェックされている場合は, 会員情報からお届け先を取得する.
  * その他のお届け先がチェックされている場合は, その他のお届け先からお届け先を取得する.
  * お届け先チェックの値が不正な場合は false を返す.
  *
  * @param  integer            $other_deliv_id
  * @param  string             $uniqid         受注一時テーブルのユニークID
  * @param  PurchaseHelper $objPurchase    PurchaseHelper インスタンス
  * @param  Customer        $objCustomer    Customer インスタンス
  * @param AddressHelper $objAddress
  * @return boolean            お届け先チェックの値が妥当な場合 true
  */
 public function registerDeliv($other_deliv_id, $uniqid, PurchaseHelper &$objPurchase, Customer &$objCustomer, AddressHelper $objAddress)
 {
     $arrValues = array();
     // 会員登録住所がチェックされている場合
     if ($other_deliv_id == 0) {
         $objPurchase->copyFromCustomer($arrValues, $objCustomer, 'shipping');
         // 別のお届け先がチェックされている場合
     } else {
         $arrOtherDeliv = $objAddress->getAddress($other_deliv_id, $objCustomer->getValue('customer_id'));
         if (!$arrOtherDeliv) {
             return false;
         }
         $objPurchase->copyFromOrder($arrValues, $arrOtherDeliv, 'shipping', '');
     }
     $objPurchase->saveShippingTemp($arrValues, $other_deliv_id);
     $objPurchase->saveOrderTemp($uniqid, $arrValues, $objCustomer);
     return true;
 }