コード例 #1
0
ファイル: Display.php プロジェクト: ChigusaYasoda/ec-cube
 /**
  * デバイス毎の出力方法を自動で変更する、ファサード
  * Enter description here ...
  */
 public function setDevice($device = DEVICE_TYPE_PC)
 {
     switch ($device) {
         case DEVICE_TYPE_MOBILE:
             if (USE_MOBILE === false) {
                 exit;
             }
             $this->response->setContentType('text/html');
             $this->setView(new MobileView(true, DEVICE_TYPE_MOBILE));
             break;
         case DEVICE_TYPE_SMARTPHONE:
             $this->setView(new SmartphoneView(true, DEVICE_TYPE_SMARTPHONE));
             break;
         case DEVICE_TYPE_PC:
             $this->setView(new SiteView(true, DEVICE_TYPE_PC));
             break;
         case DEVICE_TYPE_ADMIN:
             $this->setView(new AdminView());
     }
     $this->deviceSeted = true;
 }
コード例 #2
0
ファイル: Multiple.php プロジェクト: ChigusaYasoda/ec-cube
 /**
  * Page のプロセス.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     /* @var $objPurchase PurchaseHelper */
     $objPurchase = Application::alias('eccube.helper.purchase');
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     /* @var $objSiteSess SiteSession */
     $objSiteSess = Application::alias('eccube.site_session');
     /* @var $objCartSess CartSession */
     $objCartSess = Application::alias('eccube.cart_session');
     /* @var $objCustomer Customer */
     $objCustomer = Application::alias('eccube.customer');
     /* @var $objFormParam FormParam */
     $objFormParam = Application::alias('eccube.form_param');
     /* @var $objAddress AddressHelper */
     $objAddress = Application::alias('eccube.helper.address');
     // 複数配送先指定が無効な場合はエラー
     if (USE_MULTIPLE_SHIPPING === false) {
         Utils::sfDispSiteError(PAGE_ERROR, '', true);
         Application::alias('eccube.response')->actionExit();
     }
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $this->arrAddress = $this->getDelivAddress($objCustomer, $objPurchase, $objAddress);
     $this->tpl_addrmax = count($this->arrAddress) - 2;
     // 「選択してください」と会員の住所をカウントしない
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     $this->arrCartItem = $objCartSess->getCartList($objCartSess->getKey());
     $this->lfInitParam($objFormParam, $this->arrCartItem);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     switch ($this->getMode()) {
         case 'confirm':
             $objFormParam->setParam($_POST);
             $this->arrErr = $this->lfCheckError($objFormParam, $this->arrCartItem);
             if (Utils::isBlank($this->arrErr)) {
                 // フォームの情報を一時保存しておく
                 $_SESSION['multiple_temp'] = $objFormParam->getHashArray();
                 $this->saveMultipleShippings($this->tpl_uniqid, $objFormParam, $objCustomer, $objPurchase, $objAddress);
                 $objSiteSess->setRegistFlag();
                 Application::alias('eccube.response')->sendRedirect('confirm.php');
                 Application::alias('eccube.response')->actionExit();
             }
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             $objSiteSess->setRegistFlag();
             // 確認ページへ移動
             Response::sendRedirect('confirm.php');
             Response::actionExit();
             break;
         default:
             break;
     }
     $this->arrForm = $objFormParam->getFormParamList();
 }
コード例 #3
0
ファイル: Confirm.php プロジェクト: ChigusaYasoda/ec-cube
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     /* @var $objPurchase PurchaseHelper */
     $objPurchase = Application::alias('eccube.helper.purchase');
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     /* @var $objCartSess CartSession */
     $objCartSess = Application::alias('eccube.cart_session');
     /* @var $objSiteSess SiteSession */
     $objSiteSess = Application::alias('eccube.site_session');
     /* @var $objCustomer Customer */
     $objCustomer = Application::alias('eccube.customer');
     $this->is_multiple = $objPurchase->isMultiple();
     // 前のページで正しく登録手続きが行われた記録があるか判定
     if (!$objSiteSess->isPrePage()) {
         Utils::sfDispSiteError(PAGE_ERROR, $objSiteSess);
     }
     // ユーザユニークIDの取得と購入状態の正当性をチェック
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     $this->cartKey = $objCartSess->getKey();
     // カート内商品のチェック
     $this->tpl_message = $objCartSess->checkProducts($this->cartKey);
     if (!Utils::isBlank($this->tpl_message)) {
         Application::alias('eccube.response')->sendRedirect(CART_URL);
         Application::alias('eccube.response')->actionExit();
     }
     $this->is_download = $this->cartKey == PRODUCT_TYPE_DOWNLOAD;
     // カートの商品を取得
     $this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple);
     $this->arrCartItems = $objCartSess->getCartList($this->cartKey);
     // 合計金額
     $this->tpl_total_inctax = $objCartSess->getAllProductsTotal($this->cartKey);
     // 税額
     $this->tpl_total_tax = $objCartSess->getAllProductsTax($this->cartKey);
     $this->tpl_total_tax = $objCartSess->getAllProductsTax($this->cartKey);
     $objFormParam = new FormParam();
     $this->lfInitParam($objFormParam, $this->arrShipping);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     $objFormParam->trimParam();
     // 一時受注テーブルの読込
     $arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid);
     // 配送業者を取得
     $objDelivery = new DeliveryHelper();
     $this->arrDeliv = $objDelivery->getList($this->cartKey, false, true);
     $this->tpl_is_single_deliv = $objDelivery->isSingleDeliv($this->cartKey);
     // お届け日一覧の取得
     $this->arrDelivDate = $objPurchase->getDelivDate($objCartSess, $this->cartKey);
     if (Utils::sfIsInt($arrOrderTemp['deliv_id'])) {
         $this->arrPayment = $objPurchase->getSelectablePayment($objCartSess, $arrOrderTemp['deliv_id'], true);
         $this->arrDelivTime = DeliveryHelper::getDelivTime($arrOrderTemp['deliv_id']);
     }
     // カート集計を元に最終計算
     $arrCalcResults = $objCartSess->calculate($this->cartKey, $objCustomer, $arrOrderTemp['use_point'], $objPurchase->getShippingPref($this->is_multiple), $arrOrderTemp['charge'], $arrOrderTemp['discount'], $arrOrderTemp['deliv_id'], $arrOrderTemp['order_pref'], $arrOrderTemp['order_country_id']);
     $this->arrForm = array_merge($arrOrderTemp, $arrCalcResults);
     foreach ($objFormParam->getHashArray() as $key => $param) {
         if (!Utils::isBlank($param) && Utils::isBlank($this->arrForm[$key])) {
             $this->arrForm[$key] = $param;
         }
     }
     // 会員ログインチェック
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = '******';
         $this->tpl_user_point = $objCustomer->getValue('point');
     }
     // 決済モジュールを使用するかどうか
     $this->use_module = Application::alias('eccube.helper.payment')->useModule($this->arrForm['payment_id']);
     switch ($this->getMode()) {
         case 'select_deliv':
             $sqlval = $objFormParam->getHashArray();
             if (Utils::isBlank($sqlval['use_point'])) {
                 $sqlval['use_point'] = '0';
             }
             $deliv_id = $objFormParam->getValue('deliv_id');
             $arrPayment = $objPurchase->getSelectablePayment($objCartSess, $deliv_id);
             $sqlval['payment_id'] = $arrPayment[0]['payment_id'];
             $sqlval['payment_method'] = $arrPayment[0]['payment_method'];
             $objPurchase->saveOrderTemp($this->tpl_uniqid, $sqlval);
             Response::reload();
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 正常な推移であることを記録しておく
             $objSiteSess->setRegistFlag();
             Application::alias('eccube.response')->sendRedirect(SHOPPING_PAYMENT_URLPATH);
             Application::alias('eccube.response')->actionExit();
             break;
         case 'confirm':
             $this->saveShippings($objFormParam, $this->arrDelivTime);
             $deliv_id = $objFormParam->getValue('deliv_id');
             $arrPayment = $objPurchase->getSelectablePayment($objCartSess, $deliv_id);
             $this->lfRegistPayment($this->tpl_uniqid, $objFormParam->getHashArray(), $objPurchase, $arrPayment);
             /*
              * 決済モジュールで必要なため, 受注番号を取得
              */
             $this->arrForm['order_id'] = $objPurchase->getNextOrderID();
             $_SESSION['order_id'] = $this->arrForm['order_id'];
             // 集計結果を受注一時テーブルに反映
             $objPurchase->saveOrderTemp($this->tpl_uniqid, $this->arrForm, $objCustomer);
             // 正常に登録されたことを記録しておく
             $objSiteSess->setRegistFlag();
             // 決済モジュールを使用する場合
             if ($this->use_module) {
                 $objPurchase->completeOrder(ORDER_PENDING);
                 Application::alias('eccube.response')->sendRedirect(SHOPPING_MODULE_URLPATH);
                 // 購入完了ページ
             } else {
                 $objPurchase->completeOrder(ORDER_NEW);
                 PurchaseHelper::sendOrderMail($this->arrForm['order_id'], $this);
                 Application::alias('eccube.response')->sendRedirect(SHOPPING_COMPLETE_URLPATH);
             }
             Application::alias('eccube.response')->actionExit();
             break;
         default:
             break;
     }
 }