/** * Page のAction. * * @return void */ public function action() { /* @var $objCustomer Customer */ $objCustomer = Application::alias('eccube.customer'); if (!Utils::sfIsInt($_GET['send_id'])) { Utils::sfDispSiteError(CUSTOMER_ERROR); } $arrMailView = $this->lfGetMailView($_GET['send_id'], $objCustomer->getValue('customer_id')); if (empty($arrMailView)) { Utils::sfDispSiteError(CUSTOMER_ERROR); } $this->tpl_subject = $arrMailView[0]['subject']; $this->tpl_body = $arrMailView[0]['mail_body']; if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_PC) { $this->setTemplate('mypage/mail_view.tpl'); } else { $this->tpl_title = 'メール履歴詳細'; $this->tpl_mainpage = 'mypage/mail_view.tpl'; } switch ($this->getMode()) { case 'getDetail': echo Utils::jsonEncode($arrMailView); Application::alias('eccube.response')->actionExit(); break; default: break; } }
/** * Page のAction. * * @return void */ public function action() { switch ($this->getMode()) { case 'confirm': // トークンを設定 $this->refusal_transactionid = $this->getRefusalToken(); $this->tpl_mainpage = 'mypage/refusal_confirm.tpl'; $this->tpl_subtitle = '退会手続き(確認ページ)'; break; case 'complete': // トークン入力チェック if (!$this->isValidRefusalToken()) { // エラー画面へ遷移する Utils::sfDispSiteError(PAGE_ERROR, '', true); Application::alias('eccube.response')->actionExit(); } /* @var $objCustomer Customer */ $objCustomer = Application::alias('eccube.customer'); $this->lfSendRefusalMail($objCustomer->getValue('customer_id')); $this->lfDeleteCustomer($objCustomer->getValue('customer_id')); $objCustomer->EndSession(); Application::alias('eccube.response')->sendRedirect('refusal_complete.php'); break; default: if (Application::alias('eccube.display')->detectDevice() == DEVICE_TYPE_MOBILE) { $this->refusal_transactionid = $this->getRefusalToken(); } break; } }
/** * Page のAction. * * @return void */ public function action() { /* @var $objCustomer Customer */ $objCustomer = Application::alias('eccube.customer'); $customer_id = $objCustomer->getValue('customer_id'); /* @var $objAddress AddressHelper */ $objAddress = Application::alias('eccube.helper.address'); /* @var $objFormParam FormParam */ $objFormParam = Application::alias('eccube.form_param'); $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); switch ($this->getMode()) { // お届け先の削除 case 'delete': if ($objFormParam->checkError()) { Utils::sfDispSiteError(CUSTOMER_ERROR); Application::alias('eccube.response')->actionExit(); } if (!$objAddress->deleteAddress($objFormParam->getValue('other_deliv_id'), $customer_id)) { Utils::sfDispSiteError(FREE_ERROR_MSG, '', false, '別のお届け先を削除できませんでした。'); Application::alias('eccube.response')->actionExit(); } break; // スマートフォン版のもっと見るボタン用 // スマートフォン版のもっと見るボタン用 case 'getList': $arrData = $objFormParam->getHashArray(); //別のお届け先情報 $arrOtherDeliv = $objAddress->getList($customer_id, ($arrData['pageno'] - 1) * SEARCH_PMAX); //県名をセット $arrOtherDeliv = $this->setPref($arrOtherDeliv, $this->arrPref); $arrOtherDeliv['delivCount'] = count($arrOtherDeliv); $this->arrOtherDeliv = $arrOtherDeliv; echo Utils::jsonEncode($this->arrOtherDeliv); Application::alias('eccube.response')->actionExit(); break; // お届け先の表示 // お届け先の表示 default: break; } //別のお届け先情報 $this->arrOtherDeliv = $objAddress->getList($customer_id); //お届け先登録数 $this->tpl_linemax = count($this->arrOtherDeliv); // 1ページあたりの件数 $this->dispNumber = SEARCH_PMAX; }
/** * Page のプロセス. * * @return void */ public function process() { $order_id = $this->getOrderId(); if ($order_id === false) { Utils::sfDispSiteError(PAGE_ERROR, '', true); return; } $module_path = $this->getModulePath($order_id); if ($module_path === false) { $msg = 'モジュールファイルの取得に失敗しました。<br />この手続きは無効となりました。'; Utils::sfDispSiteError(FREE_ERROR_MSG, '', true, $msg); return; } require_once $module_path; }
/** * Page のAction. * * @return void */ public function action() { //決済処理中ステータスのロールバック /* @var $objPurchase PurchaseHelper */ $objPurchase = Application::alias('eccube.helper.purchase'); $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG); //受注詳細データの取得 $arrOrderDetail = $this->lfGetOrderDetail($_POST['order_id']); //ログインしていない、またはDBに情報が無い場合 if (empty($arrOrderDetail)) { Utils::sfDispSiteError(CUSTOMER_ERROR); } $this->lfAddCartProducts($arrOrderDetail); Application::alias('eccube.response')->sendRedirect(CART_URL); }
/** * Page のプロセス. * * @return void */ public function process() { parent::process(); $objView = new SiteView(); $objSess = new Session(); Utils::sfIsSuccess($objSess); if (isset($_SESSION['preview']) && $_SESSION['preview'] === 'ON') { // プレビュー用のレイアウトデザインを取得 /* @var $objLayout PageLayoutHelper */ $objLayout = Application::alias('eccube.helper.page_layout'); $objLayout->sfGetPageLayout($this, true); // 画面の表示 $objView->assignobj($this); $objView->display(SITE_FRAME); return; } Utils::sfDispSiteError(PAGE_ERROR); }
/** * Page のAction. * * @return void */ public function action() { //決済処理中ステータスのロールバック /* @var $objPurchase PurchaseHelper */ $objPurchase = Application::alias('eccube.helper.purchase'); $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG); /* @var $objCustomer Customer */ $objCustomer = Application::alias('eccube.customer'); /* @var $objProduct Product */ $objProduct = Application::alias('eccube.product'); if (!Utils::sfIsInt($_GET['order_id'])) { Utils::sfDispSiteError(CUSTOMER_ERROR); } $order_id = $_GET['order_id']; $this->is_price_change = false; //受注データの取得 $this->tpl_arrOrderData = $objPurchase->getOrder($order_id, $objCustomer->getValue('customer_id')); if (empty($this->tpl_arrOrderData)) { Utils::sfDispSiteError(CUSTOMER_ERROR); } $this->arrShipping = $this->lfGetShippingDate($objPurchase, $order_id, $this->arrWDAY); $this->isMultiple = count($this->arrShipping) > 1; // 支払い方法の取得 $this->arrPayment = Application::alias('eccube.helper.payment')->getIDValueList(); // 受注商品明細の取得 $this->tpl_arrOrderDetail = $objPurchase->getOrderDetail($order_id); foreach ($this->tpl_arrOrderDetail as $product_index => $arrOrderProductDetail) { //必要なのは商品の販売金額のみなので、遅い場合は、別途SQL作成した方が良い $arrTempProductDetail = $objProduct->getProductsClass($arrOrderProductDetail['product_class_id']); // 税計算 $this->tpl_arrOrderDetail[$product_index]['price_inctax'] = $this->tpl_arrOrderDetail[$product_index]['price'] + TaxRuleHelper::calcTax($this->tpl_arrOrderDetail[$product_index]['price'], $this->tpl_arrOrderDetail[$product_index]['tax_rate'], $this->tpl_arrOrderDetail[$product_index]['tax_rule']); $arrTempProductDetail['price02_inctax'] = TaxRuleHelper::sfCalcIncTax($arrTempProductDetail['price02'], $arrTempProductDetail['product_id'], $arrTempProductDetail['product_class_id']); if ($this->tpl_arrOrderDetail[$product_index]['price_inctax'] != $arrTempProductDetail['price02_inctax']) { $this->is_price_change = true; } $this->tpl_arrOrderDetail[$product_index]['product_price_inctax'] = $arrTempProductDetail['price02_inctax'] ? $arrTempProductDetail['price02_inctax'] : 0; } $this->tpl_arrOrderDetail = $this->setMainListImage($this->tpl_arrOrderDetail); $objPurchase->setDownloadableFlgTo($this->tpl_arrOrderDetail); // モバイルダウンロード対応処理 $this->lfSetAU($this->tpl_arrOrderDetail); // 受注メール送信履歴の取得 $this->tpl_arrMailHistory = $this->lfGetMailHistory($order_id); }
/** * Page のAction. * * @return void */ public function action() { switch ($this->getMode()) { case 'regist': //-- 本登録完了のためにメールから接続した場合 //-- 入力チェック $this->arrErr = $this->lfCheckError($_GET); if ($this->arrErr) { Utils::sfDispSiteError(FREE_ERROR_MSG, '', true, $this->arrErr['id']); } $registSecretKey = $this->lfRegistData($_GET); //本会員登録(フラグ変更) $this->lfSendRegistMail($registSecretKey); //本会員登録完了メール送信 Application::alias('eccube.response')->sendRedirect('complete.php', array('ci' => Application::alias('eccube.helper.customer')->sfGetCustomerId($registSecretKey))); break; //-- それ以外のアクセスは無効とする //-- それ以外のアクセスは無効とする default: Utils::sfDispSiteError(FREE_ERROR_MSG, '', true, '無効なアクセスです。'); break; } }
/** * * @param Product $objProduct * @param FormParam $objFormParam * @return void */ public function doDefault(&$objProduct, &$objFormParam) { //商品一覧の表示処理 $strnavi = $this->objNavi->strnavi; // 表示文字列 $this->tpl_strnavi = empty($strnavi) ? ' ' : $strnavi; // 規格1クラス名 $this->tpl_class_name1 = $objProduct->className1; // 規格2クラス名 $this->tpl_class_name2 = $objProduct->className2; // 規格1 $this->arrClassCat1 = $objProduct->classCats1; // 規格1が設定されている $this->tpl_classcat_find1 = $objProduct->classCat1_find; // 規格2が設定されている $this->tpl_classcat_find2 = $objProduct->classCat2_find; $this->tpl_stock_find = $objProduct->stock_find; $this->tpl_product_class_id = $objProduct->product_class_id; $this->tpl_product_type = $objProduct->product_type; $js_fnOnLoad = ''; // 商品ステータスを取得 $this->productStatus = $this->arrProducts['productStatus']; unset($this->arrProducts['productStatus']); $this->tpl_javascript .= 'eccube.productsClassCategories = ' . Utils::jsonEncode($objProduct->classCategories) . ';'; if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_PC) { //onloadスクリプトを設定. 在庫ありの商品のみ出力する foreach ($this->arrProducts as $arrProduct) { if ($arrProduct['stock_unlimited_max'] || $arrProduct['stock_max'] > 0) { $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});"; } } } //カート処理 $target_product_id = intval($this->arrForm['product_id']); if ($target_product_id > 0) { // 商品IDの正当性チェック if (!Utils::sfIsInt($this->arrForm['product_id']) || !Application::alias('eccube.helper.db')->isRecord('dtb_products', 'product_id', $this->arrForm['product_id'], 'del_flg = 0 AND status = 1')) { Utils::sfDispSiteError(PRODUCT_NOT_FOUND); } // 入力内容のチェック $arrErr = $this->lfCheckError($objFormParam); if (empty($arrErr)) { $this->lfAddCart($this->arrForm); // 開いているカテゴリーツリーを維持するためのパラメーター $arrQueryString = array('category_id' => $this->arrForm['category_id']); Application::alias('eccube.response')->sendRedirect(CART_URL, $arrQueryString); Application::alias('eccube.response')->actionExit(); } $js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id); } else { // カート「戻るボタン」用に保持 $netURL = new \Net_URL(); //該当メソッドが無いため、$_SESSIONに直接セット $_SESSION['cart_referer_url'] = $netURL->getURL(); } $this->tpl_javascript .= 'function fnOnLoad() {' . $js_fnOnLoad . '}'; $this->tpl_onload .= 'fnOnLoad(); '; }
/** * 選択されたカテゴリとその子カテゴリの情報を取得し、 * ページオブジェクトに格納する。 * * @param string $category_id カテゴリID * @param boolean $count_check 有効な商品がないカテゴリを除くかどうか * @return void */ public function lfGetCategories($category_id, $count_check = false) { $arrCategory = null; // 選択されたカテゴリ $arrChildren = array(); // 子カテゴリ $arrAll = Application::alias('eccube.helper.db')->getCatTree($category_id, $count_check); foreach ($arrAll as $category) { // 選択されたカテゴリの場合 if ($category['category_id'] == $category_id) { $arrCategory = $category; continue; } // 関係のないカテゴリはスキップする。 if ($category['parent_category_id'] != $category_id) { continue; } // 子カテゴリの場合は、孫カテゴリが存在するかどうかを調べる。 $arrGrandchildrenID = Utils::sfGetUnderChildrenArray($arrAll, 'parent_category_id', 'category_id', $category['category_id']); $category['has_children'] = count($arrGrandchildrenID) > 0; $arrChildren[] = $category; } if (!isset($arrCategory)) { Utils::sfDispSiteError(CATEGORY_NOT_FOUND); } // 子カテゴリの商品数を合計する。 $children_product_count = 0; foreach ($arrChildren as $category) { $children_product_count += $category['product_count']; } // 選択されたカテゴリに直属の商品がある場合は、子カテゴリの先頭に追加する。 if ($arrCategory['product_count'] > $children_product_count) { $arrCategory['product_count'] -= $children_product_count; // 子カテゴリの商品数を除く。 $arrCategory['has_children'] = false; // 商品一覧ページに遷移させるため。 array_unshift($arrChildren, $arrCategory); } return array('arrChildren' => $arrChildren, 'arrCategory' => $arrCategory); }
/** * 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 $objCookie Cookie */ $objCookie = Application::alias('eccube.cookie'); $objFormParam = Application::alias('eccube.form_param'); $nonmember_mainpage = 'shopping/nonmember_input.tpl'; $nonmember_title = 'お客様情報入力'; $this->tpl_uniqid = $objSiteSess->getUniqId(); $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); $this->cartKey = $objCartSess->getKey(); // ログイン済みの場合は次画面に遷移 if ($objCustomer->isLoginSuccess(true)) { Application::alias('eccube.response')->sendRedirect($this->getNextlocation($this->cartKey, $this->tpl_uniqid, $objCustomer, $objPurchase, $objSiteSess, $objCartSess)); Application::alias('eccube.response')->actionExit(); // 非会員かつ, ダウンロード商品の場合はエラー表示 } else { if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) { $msg = 'ダウンロード商品を含むお買い物は、会員登録が必要です。<br/>' . 'お手数ですが、会員登録をお願いします。'; Utils::sfDispSiteError(FREE_ERROR_MSG, $objSiteSess, false, $msg); Application::alias('eccube.response')->actionExit(); } } // 携帯端末IDが一致する会員が存在するかどうかをチェックする。 if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_MOBILE) { $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId(); } switch ($this->getMode()) { // ログイン実行 case 'login': $this->lfInitLoginFormParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->trimParam(); $objFormParam->convParam(); $objFormParam->toLower('login_email'); $this->arrErr = $objFormParam->checkError(); // ログイン判定 if (Utils::isBlank($this->arrErr) && $objCustomer->doLogin($objFormParam->getValue('login_email'), $objFormParam->getValue('login_pass'))) { // クッキー保存判定 if ($objFormParam->getValue('login_memory') == '1' && strlen($objFormParam->getValue('login_email')) >= 1) { $objCookie->setCookie('login_email', $objFormParam->getValue('login_email')); } else { $objCookie->setCookie('login_email', ''); } // モバイルサイトで携帯アドレスの登録が無い場合、携帯アドレス登録ページへ遷移 if (Application::alias('eccube.display')->detectDevice() == DEVICE_TYPE_MOBILE) { if (!$objCustomer->hasValue('email_mobile')) { Application::alias('eccube.response')->sendRedirectFromUrlPath('entry/email_mobile.php'); Application::alias('eccube.response')->actionExit(); } // スマートフォンの場合はログイン成功を返す } elseif (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo Utils::jsonEncode(array('success' => $this->getNextLocation($this->cartKey, $this->tpl_uniqid, $objCustomer, $objPurchase, $objSiteSess, $objCartSess))); Application::alias('eccube.response')->actionExit(); } Application::alias('eccube.response')->sendRedirect($this->getNextLocation($this->cartKey, $this->tpl_uniqid, $objCustomer, $objPurchase, $objSiteSess)); Application::alias('eccube.response')->actionExit(); // ログインに失敗した場合 } else { // 仮登録の場合 if (Application::alias('eccube.helper.customer')->checkTempCustomer($objFormParam->getValue('login_email'))) { if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } else { Utils::sfDispSiteError(TEMP_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } } else { if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } else { Utils::sfDispSiteError(SITE_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } } } break; // お客様情報登録 // お客様情報登録 case 'nonmember_confirm': $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrErr = $this->lfCheckError($objFormParam); if (Utils::isBlank($this->arrErr)) { $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam); $arrParams = $objFormParam->getHashArray(); $shipping_id = $arrParams['deliv_check'] == '1' ? 1 : 0; $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id); $objSiteSess->setRegistFlag(); Application::alias('eccube.response')->sendRedirect(SHOPPING_PAYMENT_URLPATH); Application::alias('eccube.response')->actionExit(); } break; // 前のページに戻る // 前のページに戻る case 'return': Application::alias('eccube.response')->sendRedirect(CART_URL); Application::alias('eccube.response')->actionExit(); break; // 複数配送ページへ遷移 // 複数配送ページへ遷移 case 'multiple': // 複数配送先指定が無効な場合はエラー if (USE_MULTIPLE_SHIPPING === false) { Utils::sfDispSiteError(PAGE_ERROR, '', true); Application::alias('eccube.response')->actionExit(); } $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrErr = $this->lfCheckError($objFormParam); if (Utils::isBlank($this->arrErr)) { $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam, true); $objSiteSess->setRegistFlag(); Application::alias('eccube.response')->sendRedirect(MULTIPLE_URLPATH); Application::alias('eccube.response')->actionExit(); } $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; break; // お客様情報入力ページの表示 // お客様情報入力ページの表示 case 'nonmember': $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; $this->lfInitParam($objFormParam); // ※breakなし // ※breakなし default: // 前のページから戻ってきた場合は, お客様情報入力ページ if (isset($_GET['from']) && $_GET['from'] == 'nonmember') { $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; $this->lfInitParam($objFormParam); } else { // 通常はログインページ $this->lfInitLoginFormParam($objFormParam); } $this->setFormParams($objFormParam, $objPurchase, $this->tpl_uniqid); break; } // 入力値の取得 $this->arrForm = $objFormParam->getFormParamList(); // 記憶したメールアドレスを取得 $this->tpl_login_email = $objCookie->getCookie('login_email'); if (!Utils::isBlank($this->tpl_login_email)) { $this->tpl_login_memory = '1'; } }
/** * 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'); $objFormParam = $this->lfInitParam($_POST); $this->mode = $this->getMode(); // モバイル対応 if (Application::alias('eccube.display')->detectDevice() == DEVICE_TYPE_MOBILE) { if (isset($_GET['cart_no'])) { $objFormParam->setValue('cart_no', $_GET['cart_no']); } if (isset($_GET['cartKey'])) { $objFormParam->setValue('cartKey', $_GET['cartKey']); } } $this->cartKeys = $objCartSess->getKeys(); foreach ($this->cartKeys as $key) { // 商品購入中にカート内容が変更された。 if ($objCartSess->getCancelPurchase($key)) { $this->tpl_message .= "商品購入中にカート内容が変更されましたので、お手数ですが購入手続きをやり直して下さい。\n"; } } $cart_no = $objFormParam->getValue('cart_no'); $cartKey = $objFormParam->getValue('cartKey'); // エラーチェック $arrError = $objFormParam->checkError(); if (isset($arrError) && !empty($arrError)) { Utils::sfDispSiteError(CART_NOT_FOUND); Application::alias('eccube.response')->actionExit(); } $objFormParam4OpenCategoryTree = $this->lfInitParam4OpenCategoryTree($_REQUEST); if ($objFormParam4OpenCategoryTree->getValue('product_id')) { $arrQueryString = array('product_id' => $objFormParam4OpenCategoryTree->getValue('product_id')); } else { $arrQueryString = array('category_id' => $objFormParam4OpenCategoryTree->getValue('category_id')); } switch ($this->mode) { case 'confirm': // カート内情報の取得 $cartList = $objCartSess->getCartList($cartKey); // カート商品が1件以上存在する場合 if (count($cartList) > 0) { // カートを購入モードに設定 $this->lfSetCurrentCart($objSiteSess, $objCartSess, $cartKey); // 購入ページへ Application::alias('eccube.response')->sendRedirect(SHOPPING_URL); Application::alias('eccube.response')->actionExit(); } break; case 'up': //1個追加 $objCartSess->upQuantity($cart_no, $cartKey); Application::alias('eccube.response')->reload($arrQueryString, true); Application::alias('eccube.response')->actionExit(); break; case 'down': //1個減らす $objCartSess->downQuantity($cart_no, $cartKey); Application::alias('eccube.response')->reload($arrQueryString, true); Application::alias('eccube.response')->actionExit(); break; case 'setQuantity': //数量変更 $objCartSess->setQuantity($objFormParam->getValue('quantity'), $cart_no, $cartKey); Application::alias('eccube.response')->reload($arrQueryString, true); Application::alias('eccube.response')->actionExit(); break; case 'delete': //カートから削除 $objCartSess->delProduct($cart_no, $cartKey); Application::alias('eccube.response')->reload($arrQueryString, true); Application::alias('eccube.response')->actionExit(); break; default: break; } $this->arrInfo = Application::alias('eccube.helper.db')->getBasisData(); $totalIncTax = 0; foreach ($this->cartKeys as $key) { // カート集計処理 $this->tpl_message .= $objCartSess->checkProducts($key); $this->tpl_total_inctax[$key] = $objCartSess->getAllProductsTotal($key); $totalIncTax += $this->tpl_total_inctax[$key]; $this->tpl_total_tax[$key] = $objCartSess->getAllProductsTax($key); // ポイント合計 $this->tpl_total_point[$key] = $objCartSess->getAllProductsPoint($key); $this->arrData[$key] = $objCartSess->calculate($key, $objCustomer); // 送料無料チェック $this->arrData[$key]['is_deliv_free'] = $objCartSess->isDelivFree($key); // 送料無料までの金額を計算 $this->tpl_deliv_free[$key] = $this->arrInfo['free_rule'] - $this->tpl_total_inctax[$key]; } //商品の合計金額をセット $this->tpl_all_total_inctax = $totalIncTax; $this->tpl_category_id = $objFormParam4OpenCategoryTree->getValue('category_id'); $this->tpl_product_id = $objFormParam4OpenCategoryTree->getValue('product_id'); // ログイン判定 if ($objCustomer->isLoginSuccess(true)) { $this->tpl_login = true; $this->tpl_user_point = $objCustomer->getValue('point'); $this->tpl_name = $objCustomer->getValue('name01'); } // 前頁のURLを取得 // TODO: CartSession::setPrevURL()利用不可。 $this->lfGetCartPrevUrl($_SESSION, $_SERVER['HTTP_REFERER']); $this->tpl_prev_url = isset($_SESSION['cart_prev_url']) ? $_SESSION['cart_prev_url'] : ''; // 全てのカートの内容を取得する $this->cartItems = $objCartSess->getAllCartList(); }
/** * DOMを用いた変形を実行する * * @param string $mode 実行するメソッドの種類 * @param string $target_key 対象のエレメントの完全なセレクタ * @param string $html_snip HTMLコード * @return boolean */ protected function lfSetTransform($mode, $target_key, $html_snip) { $substitute_tag = sprintf('<!--###%08d###-->', $this->smarty_tags_idx); $this->arrSmartyTagsOrg[$this->smarty_tags_idx] = $html_snip; $this->arrSmartyTagsSub[$this->smarty_tags_idx] = $substitute_tag; $this->smarty_tags_idx++; $this->objDOM->createDocumentFragment(); $objSnip = $this->objDOM->createDocumentFragment(); $objSnip->appendXML($substitute_tag); $objElement = false; if (isset($this->arrElementTree[$target_key]) && $this->arrElementTree[$target_key][0]) { $objElement =& $this->arrElementTree[$target_key][1]; } if (!$objElement) { return false; } try { switch ($mode) { case 'appendFirst': if ($objElement->hasChildNodes()) { $objElement->insertBefore($objSnip, $objElement->firstChild); } else { $objElement->appendChild($objSnip); } break; case 'appendChild': $objElement->appendChild($objSnip); break; case 'insertBefore': if (!is_object($objElement->parentNode)) { return false; } $objElement->parentNode->insertBefore($objSnip, $objElement); break; case 'insertAfter': if ($objElement->nextSibling) { $objElement->parentNode->insertBefore($objSnip, $objElement->nextSibling); } else { $objElement->parentNode->appendChild($objSnip); } break; case 'replaceElement': if (!is_object($objElement->parentNode)) { return false; } $objElement->parentNode->replaceChild($objSnip, $objElement); break; default: break; } $this->snip_count++; } catch (Exception $e) { Utils::sfDispSiteError(FREE_ERROR_MSG, '', true, 'テンプレートの操作に失敗しました。'); } return true; }
public function lfRegistFavoriteProduct($favorite_product_id, $customer_id) { // ログイン中のユーザが商品をお気に入りにいれる処理 if (!Application::alias('eccube.helper.db')->isRecord('dtb_products', 'product_id', $favorite_product_id, 'del_flg = 0 AND status = 1')) { Utils::sfDispSiteError(PRODUCT_NOT_FOUND); return false; } else { /* @var $objQuery Query */ $objQuery = Application::alias('eccube.query'); $exists = $objQuery->exists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($customer_id, $favorite_product_id)); if (!$exists) { $sqlval['customer_id'] = $customer_id; $sqlval['product_id'] = $favorite_product_id; $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; $sqlval['create_date'] = 'CURRENT_TIMESTAMP'; $objQuery->begin(); $objQuery->insert('dtb_customer_favorite_products', $sqlval); $objQuery->commit(); } // お気に入りに登録したことを示すフラグ $this->just_added_favorite = true; return true; } }
/** * Page のプロセス * @return void */ public function action() { //決済処理中ステータスのロールバック /* @var $objPurchase PurchaseHelper */ $objPurchase = Application::alias('eccube.helper.purchase'); $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG); $objFormParam = Application::alias('eccube.form_param'); // PC時は規約ページからの遷移でなければエラー画面へ遷移する if ($this->lfCheckReferer() === false) { Utils::sfDispSiteError(PAGE_ERROR, '', true); } Application::alias('eccube.helper.customer')->sfCustomerEntryParam($objFormParam); $objFormParam->setParam($_POST); // mobile用(戻るボタンでの遷移かどうかを判定) if (!empty($_POST['return'])) { $_REQUEST['mode'] = 'return'; } switch ($this->getMode()) { case 'confirm': if (isset($_POST['submit_address'])) { // 入力エラーチェック $this->arrErr = $this->lfCheckError($_POST); // 入力エラーの場合は終了 if (count($this->arrErr) == 0) { // 郵便番号検索文作成 $zipcode = $_POST['zip01'] . $_POST['zip02']; // 郵便番号検索 $arrAdsList = Utils::sfGetAddress($zipcode); // 郵便番号が発見された場合 if (!empty($arrAdsList)) { $data['pref'] = $arrAdsList[0]['state']; $data['addr01'] = $arrAdsList[0]['city'] . $arrAdsList[0]['town']; $objFormParam->setParam($data); // 該当無し } else { $this->arrErr['zip01'] = '※該当する住所が見つかりませんでした。<br>'; } } break; } //-- 確認 $this->arrErr = Application::alias('eccube.helper.customer')->sfCustomerEntryErrorCheck($objFormParam); // 入力エラーなし if (empty($this->arrErr)) { //パスワード表示 $this->passlen = Utils::sfPassLen(strlen($objFormParam->getValue('password'))); $this->tpl_mainpage = 'entry/confirm.tpl'; $this->tpl_title = '会員登録(確認ページ)'; } break; case 'complete': //-- 会員登録と完了画面 $this->arrErr = Application::alias('eccube.helper.customer')->sfCustomerEntryErrorCheck($objFormParam); if (empty($this->arrErr)) { $uniqid = $this->lfRegistCustomerData($this->lfMakeSqlVal($objFormParam)); $this->lfSendMail($uniqid, $objFormParam->getHashArray()); // 仮会員が無効の場合 if (CUSTOMER_CONFIRM_MAIL == false) { // ログイン状態にする /* @var $objCustomer Customer */ $objCustomer = Application::alias('eccube.customer'); $objCustomer->setLogin($objFormParam->getValue('email')); } // 完了ページに移動させる。 Application::alias('eccube.response')->sendRedirect('complete.php', array('ci' => Application::alias('eccube.helper.customer')->sfGetCustomerId($uniqid))); } break; case 'return': // quiet. break; default: break; } $this->arrForm = $objFormParam->getFormParamList(); }
/** * @param FormParam $objFormParam */ public function lfRegistDataNonMember($objFormParam) { $arrRegistColumn = $objFormParam->getDbArray(); foreach ($arrRegistColumn as $key => $val) { $arrRegist['shipping_' . $key] = $val; } if (count($_SESSION['shipping']) >= DELIV_ADDR_MAX) { Utils::sfDispSiteError(FREE_ERROR_MSG, '', false, '別のお届け先最大登録数に達しています。'); } else { $_SESSION['shipping'][] = $arrRegist; } }
/** * Page のアクション. * * @return void */ public function action() { $objFormParam = Application::alias('eccube.form_param'); $this->arrData = isset($_SESSION['customer']) ? $_SESSION['customer'] : ''; switch ($this->getMode()) { case 'confirm': // エラーチェック $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $objFormParam->toLower('email'); $objFormParam->toLower('email02'); $this->arrErr = $this->lfCheckError($objFormParam); // 入力値の取得 $this->arrForm = $objFormParam->getFormParamList(); if (Utils::isBlank($this->arrErr)) { // エラー無しで完了画面 $this->tpl_mainpage = 'contact/confirm.tpl'; $this->tpl_title = 'お問い合わせ(確認ページ)'; } break; case 'return': $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrForm = $objFormParam->getFormParamList(); break; case 'complete': $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrErr = $objFormParam->checkError(); $this->arrForm = $objFormParam->getFormParamList(); if (Utils::isBlank($this->arrErr)) { $this->lfSendMail($this); // 完了ページへ移動する Application::alias('eccube.response')->sendRedirect('complete.php'); Application::alias('eccube.response')->actionExit(); } else { Utils::sfDispSiteError(CUSTOMER_ERROR); Application::alias('eccube.response')->actionExit(); } break; default: break; } }
/** * 複数配送情報を一時保存する. * * 会員ログインしている場合は, その他のお届け先から住所情報を取得する. * * @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); }
/** * 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'); $this->tpl_uniqid = $objSiteSess->getUniqId(); $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); $this->cartKey = $objCartSess->getKey(); // ログインチェック if (!$objCustomer->isLoginSuccess(true)) { Utils::sfDispSiteError(CUSTOMER_ERROR); } // ダウンロード商品の場合は、支払方法画面に転送 if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) { $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping'); $objPurchase->saveShippingTemp($sqlval); $objPurchase->saveOrderTemp($this->tpl_uniqid, $sqlval, $objCustomer); $objSiteSess->setRegistFlag(); Application::alias('eccube.response')->sendRedirect('confirm.php'); Application::alias('eccube.response')->actionExit(); } $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $arrErr = $objFormParam->checkError(); if (!Utils::isBlank($arrErr)) { Utils::sfDispSiteError(PAGE_ERROR, '', true); Application::alias('eccube.response')->actionExit(); } $arrForm = $objFormParam->getHashArray(); switch ($this->getMode()) { // 削除 case 'delete': if (!$objAddress->deleteAddress($arrForm['other_deliv_id'], $objCustomer->getValue('customer_id'))) { Utils::sfDispSiteError(FREE_ERROR_MSG, '', false, '別のお届け先を削除できませんでした。'); Application::alias('eccube.response')->actionExit(); } break; // 会員登録住所に送る // 会員登録住所に送る case 'customer_addr': $objPurchase->unsetShippingTemp(); $shipping_id = $arrForm['deliv_check'] == -1 ? 0 : $arrForm['deliv_check']; $success = $this->registerDeliv($shipping_id, $this->tpl_uniqid, $objPurchase, $objCustomer, $objAddress); if (!$success) { Utils::sfDispSiteError(PAGE_ERROR, '', true); } $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id); $objSiteSess->setRegistFlag(); Application::alias('eccube.response')->sendRedirect(SHOPPING_CONFIRM_URLPATH); Application::alias('eccube.response')->actionExit(); break; // 前のページに戻る // 前のページに戻る case 'return': // 確認ページへ移動 Application::alias('eccube.response')->sendRedirect('confirm.php'); Application::alias('eccube.response')->actionExit(); break; // お届け先複数指定 // お届け先複数指定 case 'multiple': // 複数配送先指定が無効な場合はエラー if (USE_MULTIPLE_SHIPPING === false) { Utils::sfDispSiteError(PAGE_ERROR, '', true); Application::alias('eccube.response')->actionExit(); } Application::alias('eccube.response')->sendRedirect('multiple.php'); Application::alias('eccube.response')->actionExit(); break; default: // 配送IDの取得 $shippingData = $objPurchase->getShippingTemp(); if (!Utils::isBlank($shippingData)) { $arrShippingId = array_keys($shippingData); } if (isset($arrShippingId[0])) { $this->arrForm['deliv_check']['value'] = $arrShippingId[0] == 0 ? -1 : $arrShippingId[0]; } break; } // 登録済み住所を取得 $addr = array(array('other_deliv_id' => NULL, 'customer_id' => $objCustomer->getValue('customer_id'), 'name01' => $objCustomer->getValue('name01'), 'name02' => $objCustomer->getValue('name02'), 'kana01' => $objCustomer->getValue('kana01'), 'kana02' => $objCustomer->getValue('kana02'), 'company_name' => $objCustomer->getValue('company_name'), 'country_id' => $objCustomer->getValue('country_id'), 'zipcode' => $objCustomer->getValue('zipcode'), 'zip01' => $objCustomer->getValue('zip01'), 'zip02' => $objCustomer->getValue('zip02'), 'pref' => $objCustomer->getValue('pref'), 'addr01' => $objCustomer->getValue('addr01'), 'addr02' => $objCustomer->getValue('addr02'), 'tel01' => $objCustomer->getValue('tel01'), 'tel02' => $objCustomer->getValue('tel02'), 'tel03' => $objCustomer->getValue('tel03'))); $this->arrAddr = array_merge($addr, $objAddress->getList($objCustomer->getValue('customer_id'))); $this->tpl_addrmax = count($this->arrAddr) - 1; // 会員の住所をカウントしない }
/** * 受注.対応状況の更新 * * 必ず呼び出し元でトランザクションブロックを開いておくこと。 * * @param integer $orderId 注文番号 * @param integer|null $newStatus 対応状況 (null=変更無し) * @param integer|null $newAddPoint 加算ポイント (null=変更無し) * @param integer|null $newUsePoint 使用ポイント (null=変更無し) * @param array $sqlval 更新後の値をリファレンスさせるためのパラメーター * @return void */ public function sfUpdateOrderStatus($orderId, $newStatus = null, $newAddPoint = null, $newUsePoint = null, &$sqlval = array()) { $objQuery = Application::alias('eccube.query'); $arrOrderOld = $objQuery->getRow('status, add_point, use_point, customer_id', 'dtb_order', 'order_id = ?', array($orderId)); // 対応状況が変更無しの場合、DB値を引き継ぐ if (is_null($newStatus)) { $newStatus = $arrOrderOld['status']; } // 使用ポイント、DB値を引き継ぐ if (is_null($newUsePoint)) { $newUsePoint = $arrOrderOld['use_point']; } // 加算ポイント、DB値を引き継ぐ if (is_null($newAddPoint)) { $newAddPoint = $arrOrderOld['add_point']; } if (USE_POINT !== false) { // 会員.ポイントの加減値 $addCustomerPoint = 0; // ▼使用ポイント // 変更前の対応状況が利用対象の場合、変更前の使用ポイント分を戻す if ($this->isUsePoint($arrOrderOld['status'])) { $addCustomerPoint += $arrOrderOld['use_point']; } // 変更後の対応状況が利用対象の場合、変更後の使用ポイント分を引く if ($this->isUsePoint($newStatus)) { $addCustomerPoint -= $newUsePoint; } // ▲使用ポイント // ▼加算ポイント // 変更前の対応状況が加算対象の場合、変更前の加算ポイント分を戻す if ($this->isAddPoint($arrOrderOld['status'])) { $addCustomerPoint -= $arrOrderOld['add_point']; } // 変更後の対応状況が加算対象の場合、変更後の加算ポイント分を足す if ($this->isAddPoint($newStatus)) { $addCustomerPoint += $newAddPoint; } // ▲加算ポイント if ($addCustomerPoint != 0) { // ▼会員テーブルの更新 $objQuery->update('dtb_customer', array('update_date' => 'CURRENT_TIMESTAMP'), 'customer_id = ?', array($arrOrderOld['customer_id']), array('point' => 'point + ?'), array($addCustomerPoint)); // ▲会員テーブルの更新 // 会員.ポイントをマイナスした場合、 if ($addCustomerPoint < 0) { $sql = 'SELECT point FROM dtb_customer WHERE customer_id = ?'; $point = $objQuery->getOne($sql, array($arrOrderOld['customer_id'])); // 変更後の会員.ポイントがマイナスの場合、 if ($point < 0) { // ロールバック $objQuery->rollback(); // エラー Utils::sfDispSiteError(LACK_POINT); } } } } // ▼受注テーブルの更新 if (empty($sqlval)) { $sqlval = array(); } if (USE_POINT !== false) { $sqlval['add_point'] = $newAddPoint; $sqlval['use_point'] = $newUsePoint; } // 対応状況が発送済みに変更の場合、発送日を更新 if ($arrOrderOld['status'] != ORDER_DELIV && $newStatus == ORDER_DELIV) { $sqlval['commit_date'] = 'CURRENT_TIMESTAMP'; // 対応状況が入金済みに変更の場合、入金日を更新 } elseif ($arrOrderOld['status'] != ORDER_PRE_END && $newStatus == ORDER_PRE_END) { $sqlval['payment_date'] = 'CURRENT_TIMESTAMP'; } $sqlval['status'] = $newStatus; $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; $dest = $objQuery->extractOnlyColsOf('dtb_order', $sqlval); $objQuery->update('dtb_order', $dest, 'order_id = ?', array($orderId)); // ▲受注テーブルの更新 //会員情報の最終購入日、購入合計を更新 if ($arrOrderOld['customer_id'] > 0 and $arrOrderOld['status'] != $newStatus) { Application::alias('eccube.customer')->updateOrderSummary($arrOrderOld['customer_id']); } }
/** * モバイル端末以外ダウンロード処理 * * @param string $realpath ダウンロードファイルパス * @param string $sdown_filename ダウンロード時の指定ファイル名 */ public function lfDownload($realpath, $sdown_filename) { // 拡張子を取得 $extension = pathinfo($realpath, PATHINFO_EXTENSION); $contentType = $this->defaultContentType; // 拡張ContentType判定(拡張子をキーに拡張ContentType対象か判断) if (isset($this->arrContentType[$extension])) { // 拡張ContentType対象の場合は、ContentTypeを変更 $contentType = $this->arrContentType[$extension]; } header('Content-Type: ' . $contentType); //ファイル名指定 header('Content-Disposition: attachment; filename="' . $sdown_filename . '"'); header('Content-Transfer-Encoding: binary'); //キャッシュ無効化 header('Expires: Mon, 26 Nov 1962 00:00:00 GMT'); header('Last-Modified: ' . gmdate('D,d M Y H:i:s') . ' GMT'); //IE6+SSL環境下は、キャッシュ無しでダウンロードできない header('Cache-Control: private'); header('Pragma: private'); //ファイルサイズ指定 $zv_filesize = filesize($realpath); header('Content-Length: ' . $zv_filesize); //ファイル読み込み $handle = fopen($realpath, 'rb'); if ($handle === false) { Utils::sfDispSiteError(DOWNFILE_NOT_FOUND, '', true); Application::alias('eccube.response')->actionExit(); } while (!feof($handle)) { echo fread($handle, DOWNLOAD_BLOCK * 1024); Utils::sfFlush(); Utils::extendTimeOut(); } fclose($handle); }
/** * Page のAction. * * @return void */ public function action() { /* @var $objFormParam FormParam */ $objFormParam = Application::alias('eccube.form_param'); $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); switch ($this->getMode()) { case 'confirm': $this->arrErr = $this->lfCheckError($objFormParam); //エラーチェック if (empty($this->arrErr)) { $this->tpl_mainpage = 'products/review_confirm.tpl'; } break; case 'return': break; case 'complete': $this->arrErr = $this->lfCheckError($objFormParam); //エラーチェック if (empty($this->arrErr)) { //登録実行 $this->lfRegistRecommendData($objFormParam); //レビュー書き込み完了ページへ Application::alias('eccube.response')->sendRedirect('review_complete.php'); Application::alias('eccube.response')->actionExit(); } break; default: // 最初のproduct_idは、$_GETで渡ってくる。 $objFormParam->setParam($_GET); break; } $this->arrForm = $objFormParam->getHashArray(); //商品名の取得 $this->arrForm['name'] = $this->lfGetProductName($this->arrForm['product_id']); if (empty($this->arrForm['name'])) { Utils::sfDispSiteError(PRODUCT_NOT_FOUND); } $this->setTemplate($this->tpl_mainpage); }
/** * 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; } }
/** * Page のアクション. * * @return void */ public function action() { //決済処理中ステータスのロールバック /* @var $objPurchase PurchaseHelper */ $objPurchase = Application::alias('eccube.helper.purchase'); $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG); // 会員管理クラス /* @var $objCustomer Customer */ $objCustomer = Application::alias('eccube.customer'); // クッキー管理クラス /* @var $objCookie Cookie */ $objCookie = Application::alias('eccube.cookie'); // パラメーター管理クラス $objFormParam = Application::alias('eccube.form_param'); // パラメーター情報の初期化 $this->lfInitParam($objFormParam); // リクエスト値をフォームにセット $objFormParam->setParam($_POST); $url = htmlspecialchars($_POST['url'], ENT_QUOTES); // モードによって分岐 switch ($this->getMode()) { case 'login': // --- ログイン // 入力値のエラーチェック $objFormParam->trimParam(); $objFormParam->toLower('login_email'); $arrErr = $objFormParam->checkError(); // エラーの場合はエラー画面に遷移 if (count($arrErr) > 0) { if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } else { Utils::sfDispSiteError(TEMP_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } } // 入力チェック後の値を取得 $arrForm = $objFormParam->getHashArray(); // クッキー保存判定 if ($arrForm['login_memory'] == '1' && $arrForm['login_email'] != '') { $objCookie->setCookie('login_email', $arrForm['login_email']); } else { $objCookie->setCookie('login_email', ''); } // 遷移先の制御 if (count($arrErr) == 0) { // ログイン処理 if ($objCustomer->doLogin($arrForm['login_email'], $arrForm['login_pass'])) { if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_MOBILE) { // ログインが成功した場合は携帯端末IDを保存する。 $objCustomer->updateMobilePhoneId(); /* * email がモバイルドメインでは無く, * 携帯メールアドレスが登録されていない場合 */ /* @var $objMobile MobileHelper */ $objMobile = Application::alias('eccube.helper.mobile'); if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) { if (!$objCustomer->hasValue('email_mobile')) { Application::alias('eccube.response')->sendRedirectFromUrlPath('entry/email_mobile.php'); Application::alias('eccube.response')->actionExit(); } } } // --- ログインに成功した場合 if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo Utils::jsonEncode(array('success' => $url)); } else { Application::alias('eccube.response')->sendRedirect($url); } Application::alias('eccube.response')->actionExit(); } else { // --- ログインに失敗した場合 // ブルートフォースアタック対策 // ログイン失敗時に遅延させる sleep(LOGIN_RETRY_INTERVAL); $arrForm['login_email'] = strtolower($arrForm['login_email']); $objQuery = Application::alias('eccube.query'); $where = '(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0'; $exists = $objQuery->exists('dtb_customer', $where, array($arrForm['login_email'], $arrForm['login_email'])); // ログインエラー表示 TODO リファクタリング if ($exists) { if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } else { Utils::sfDispSiteError(TEMP_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } } else { if (Application::alias('eccube.display')->detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } else { Utils::sfDispSiteError(SITE_LOGIN_ERROR); Application::alias('eccube.response')->actionExit(); } } } } else { // XXX 到達しない? // 入力エラーの場合、元のアドレスに戻す。 Application::alias('eccube.response')->sendRedirect($url); Application::alias('eccube.response')->actionExit(); } break; case 'logout': // --- ログアウト // ログイン情報の解放 $objCustomer->EndSession(); // 画面遷移の制御 $mypage_url_search = strpos('.' . $url, 'mypage'); if ($mypage_url_search == 2) { // マイページログイン中はログイン画面へ移行 Application::alias('eccube.response')->sendRedirectFromUrlPath('mypage/login.php'); } else { // 上記以外の場合、トップへ遷移 Application::alias('eccube.response')->sendRedirect(TOP_URL); } Application::alias('eccube.response')->actionExit(); break; default: break; } }
/** * POST アクセスの妥当性を検証する. * * 生成されたトランザクショントークンの妥当性を検証し, * 不正な場合はエラー画面へ遷移する. * * この関数は, 基本的に init() 関数で呼び出され, POST アクセスの場合は自動的に * トランザクショントークンを検証する. * ページによって検証タイミングなどを制御する必要がある場合は, この関数を * オーバーライドし, 個別に設定を行うこと. * * @access protected * @param boolean $is_admin 管理画面でエラー表示をする場合 true * @return void */ public function doValidToken($is_admin = false) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!SessionHelper::isValidToken(false)) { if ($is_admin) { Utils::sfDispError(INVALID_MOVE_ERRORR); } else { Utils::sfDispSiteError(PAGE_ERROR, '', true); } $this->app['ecube.response.action_exit']; } } }