/** * Page のプロセス. * * @return void */ function process() { $objCustomer = new SC_Customer(); // クッキー管理クラス $objCookie = new SC_Cookie(COOKIE_EXPIRE); // ログイン判定 if ($objCustomer->isLoginSuccess()) { $this->tpl_login = true; $this->tpl_user_point = $objCustomer->getValue('point'); $this->tpl_name1 = $objCustomer->getValue('name01'); $this->tpl_name2 = $objCustomer->getValue('name02'); } else { // クッキー判定 $this->tpl_login_email = $objCookie->getCookie('login_email'); if ($this->tpl_login_email != "") { $this->tpl_login_memory = "1"; } // POSTされてきたIDがある場合は優先する。 if ($_POST['login_email'] != "") { $this->tpl_login_email = $_POST['login_email']; } } $this->tpl_disable_logout = $this->lfCheckDisableLogout(); $objSubView = new SC_SiteView(); $this->transactionid = $this->getToken(); $objSubView->assignobj($this); $objSubView->display($this->tpl_mainpage); }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objQuery = new SC_Query(); $objCustomer = new SC_Customer(); $objDb = new SC_Helper_DB_Ex(); //不正アクセス判定 $from = "dtb_order"; $where = "del_flg = 0 AND customer_id = ? AND order_id = ? "; $arrval = array($objCustomer->getValue('customer_id'), $_POST['order_id']); //DBに情報があるか判定 $cnt = $objQuery->count($from, $where, $arrval); //ログインしていない、またはDBに情報が無い場合 if (!$objCustomer->isLoginSuccess(true) or $cnt == 0) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); } else { //受注詳細データの取得 $this->arrDisp = $this->lfGetOrderData($_POST['order_id']); // 支払い方法の取得 $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); // 配送時間の取得 $arrRet = $objDb->sfGetDelivTime($this->arrDisp['payment_id']); $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time'); //マイページトップ顧客情報表示用 $this->CustomerName1 = $objCustomer->getvalue('name01'); $this->CustomerName2 = $objCustomer->getvalue('name02'); $this->CustomerPoint = $objCustomer->getvalue('point'); } $objView->assignobj($this); $objView->display(SITE_FRAME); }
/** * Page のアクション. * * @return void */ function action() { $objCustomer = new SC_Customer(); $objFormParam = new SC_FormParam_Ex(); $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->arrErr = $this->lfCheckError($objFormParam); if (empty($this->arrErr)) { $email_mobile = $this->lfRegistEmailMobile(strtolower($objFormParam->getValue('email_mobile')), $objCustomer->getValue('customer_id')); $objCustomer->setValue('email_mobile', $email_mobile); $this->tpl_mainpage = 'entry/email_mobile_complete.tpl'; $this->tpl_title = '携帯メール登録完了'; } } $this->tpl_name = $objCustomer->getValue('name01'); $this->arrForm = $objFormParam->getFormParamList(); }
/** * Page のプロセス. * * @return void */ function process() { $objView = new SC_SiteView(); $objCustomer = new SC_Customer(); //ログイン判定 if (!$objCustomer->isLoginSuccess()) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } else { //マイページトップ顧客情報表示用 $this->CustomerName1 = $objCustomer->getvalue('name01'); $this->CustomerName2 = $objCustomer->getvalue('name02'); $this->CustomerPoint = $objCustomer->getvalue('point'); } // レイアウトデザインを取得 $objLayout = new SC_Helper_PageLayout_Ex(); $objLayout->sfGetPageLayout($this, false, "mypage/index.php"); $mode = isset($_POST['mode']) ? $_POST['mode'] : ''; $customerId = $objCustomer->getValue('customer_id'); switch ($mode) { // お届け先の削除 case 'delete': $objForm = $this->initParam(); if ($objForm->checkError()) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); exit; } $this->deleteOtherDeliv($customerId, $objForm->getValue('other_deliv_id')); break; // お届け先の表示 // お届け先の表示 default: break; } //別のお届け先情報 $this->arrOtherDeliv = $this->getOtherDeliv($customerId); //お届け先登録数 $this->tpl_linemax = count($this->arrOtherDeliv); $objView->assignobj($this); $objView->display(SITE_FRAME); }
/** * Page のプロセス. * * @return void */ function process() { $objView = new SC_SiteView(); $objQuery = new SC_Query(); $objCustomer = new SC_Customer(); $objDb = new SC_Helper_DB_Ex(); // レイアウトデザインを取得 $objLayout = new SC_Helper_PageLayout_Ex(); $objLayout->sfGetPageLayout($this, false, "mypage/index.php"); //不正アクセス判定 $from = "dtb_order"; $where = "del_flg = 0 AND customer_id = ? AND order_id = ? "; $arrval = array($objCustomer->getValue('customer_id'), $_POST['order_id']); //DBに情報があるか判定 $cnt = $objQuery->count($from, $where, $arrval); //ログインしていない、またはDBに情報が無い場合 if (!$objCustomer->isLoginSuccess() || $cnt == 0) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } else { //受注詳細データの取得 $this->arrDisp = $this->lfGetOrderData($_POST['order_id']); // 支払い方法の取得 $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); // 配送時間の取得 $arrRet = $objDb->sfGetDelivTime($this->arrDisp['payment_id']); $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time'); //マイページトップ顧客情報表示用 $this->CustomerName1 = $objCustomer->getvalue('name01'); $this->CustomerName2 = $objCustomer->getvalue('name02'); $this->CustomerPoint = $objCustomer->getvalue('point'); } $masterData = new SC_DB_MasterData_Ex(); $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank")); $objView->assignobj($this); $objView->display(SITE_FRAME); }
/** * 配送住所のプルダウン用連想配列を取得する. * * 会員ログイン済みの場合は, 会員登録住所及び追加登録住所を取得する. * 非会員の場合は, 「お届け先の指定」画面で入力した住所を取得する. * * @param SC_Customer $objCustomer SC_Customer インスタンス * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス * @param integer $uniqid 受注一時テーブルのユニークID * @return array 配送住所のプルダウン用連想配列 */ function getDelivAddrs(&$objCustomer, &$objPurchase, $uniqid) { $masterData = new SC_DB_MasterData(); $arrPref = $masterData->getMasterData('mtb_pref'); $arrResults = array('' => '選択してください'); // 会員ログイン時 if ($objCustomer->isLoginSuccess(true)) { $arrAddrs = $objCustomer->getCustomerAddress($objCustomer->getValue('customer_id')); foreach ($arrAddrs as $val) { $other_deliv_id = SC_Utils_Ex::isBlank($val['other_deliv_id']) ? 0 : $val['other_deliv_id']; $arrResults[$other_deliv_id] = $val['name01'] . $val['name02'] . " " . $arrPref[$val['pref']] . $val['addr01'] . $val['addr02']; } } else { $arrShippings = $objPurchase->getShippingTemp(); foreach ($arrShippings as $shipping_id => $val) { $arrResults[$shipping_id] = $val['shipping_name01'] . $val['shipping_name02'] . " " . $arrPref[$val['shipping_pref']] . $val['shipping_addr01'] . $val['shipping_addr02']; } } return $arrResults; }
/** * 複数配送情報を一時保存する. * * 会員ログインしている場合は, その他のお届け先から住所情報を取得する. * * @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); }
/** * 配送住所のプルダウン用連想配列を取得する. * * 会員ログイン済みの場合は, 会員登録住所及び追加登録住所を取得する. * 非会員の場合は, 「お届け先の指定」画面で入力した住所を取得する. * * @param SC_Customer $objCustomer SC_Customer インスタンス * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス * @param integer $uniqid 受注一時テーブルのユニークID * @return array 配送住所のプルダウン用連想配列 */ function getDelivAddrs(&$objCustomer, &$objPurchase, &$objAddress, $uniqid) { $masterData = new SC_DB_MasterData_Ex(); $arrPref = $masterData->getMasterData('mtb_pref'); $arrResults = array('' => '選択してください'); // 会員ログイン時 if ($objCustomer->isLoginSuccess(true)) { $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'), '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'))); $arrAddrs = array_merge($addr, $objAddress->getList($objCustomer->getValue('customer_id'))); foreach ($arrAddrs as $val) { $other_deliv_id = SC_Utils_Ex::isBlank($val['other_deliv_id']) ? 0 : $val['other_deliv_id']; $arrResults[$other_deliv_id] = $val['name01'] . $val['name02'] . ' ' . $arrPref[$val['pref']] . $val['addr01'] . $val['addr02']; } } else { $arrShippings = $objPurchase->getShippingTemp(); foreach ($arrShippings as $shipping_id => $val) { $arrResults[$shipping_id] = $val['shipping_name01'] . $val['shipping_name02'] . ' ' . $arrPref[$val['shipping_pref']] . $val['shipping_addr01'] . $val['shipping_addr02']; } } return $arrResults; }
/** * 決済確定 * * @param array $config * @param SC_Customer $objCustomer * @param bool $auth_and_sold */ function doAuthorySold($config, SC_Customer $objCustomer, $auth_and_sold = true, $add_point = true) { if (!$objCustomer->isLoginSuccess()) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } $objQuery = SC_Query_Ex::getSingletonInstance(); $customer_id = $objCustomer->getValue("customer_id"); $open_id = $objCustomer->getValue("au_open_id"); $transactionId = $_GET["transactionId"]; $ammount = $_GET["ammount"]; $ammount_in_tax = $_GET["ammount_in_tax"]; // $result_code = $_GET ["X-ResultCd"]; // $paymtd = $_GET ["paymtd"]; $curl = $this->curl_init(); if ($auth_and_sold) { // FIXME オーソリ+確定 $post = $this->getPost("AuthorySold", $config, compact("transactionId")); $name = "都度課金/%s円(税込み)"; } else { // FIXME 継続課金 登録 $post = $this->getPost("ContBill", $config, compact("transactionId")); $name = "月額課金/%s円(税込み) コース"; } $name = sprintf($name, number_format($ammount_in_tax)); $post_history = array(); $post_history[] = $post; curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); $result = $this->curl_result($curl); $result["body"]["transactionId"] = $transactionId; $result["post_history"] = $post_history; $this->check_result($result, false); $memberManageNo = $result["body"]["memberManageNo"]; if (strlen($memberManageNo) && $objQuery->exists("cp_dtb_customer_transaction", "\n customer_id = ?\n AND member_manage_no = ?\n ", array($customer_id, $memberManageNo))) { $add_point = false; } $arrData = array("id" => $objQuery->nextVal("cp_dtb_customer_transaction_id"), "customer_id" => $customer_id, "au_open_id" => $open_id, "continue_account_id" => $result["body"]["continueAccountId"], "pay_info_no" => $result["body"]["payInfoNo"], "member_manage_no" => $memberManageNo, "process_day" => $result["body"]["processDay"], "process_time" => $result["body"]["processTime"], "transaction_id" => $transactionId, "transaction_status" => "40", "pay_status" => "20", "ammount" => $ammount, "ammount_in_tax" => $ammount_in_tax); $objQuery->insert("cp_dtb_customer_transaction", $arrData); $this->doConditionInquiryForPayTranStat($config, $arrData, false); if ($add_point) { $lost_point = 0; $updatePoint = array("point" => min($this->tpl_point + $ammount, AU_MAXPOINT)); if ($updatePoint["point"] == AU_MAXPOINT) { $lost_point = max($this->tpl_point + $ammount, AU_MAXPOINT) - AU_MAXPOINT; } SC_Helper_Customer_Ex::sfEditCustomerData($updatePoint, $this->tpl_customer_id); $objQuery->insert("cp_dtb_point_history", array("id" => $objQuery->nextVal("cp_dtb_point_history_id"), "customer_id" => $customer_id, "add_point" => $ammount, "use_point" => 0, "lost_point" => $lost_point, "order_id" => 0, "name" => $name, "create_date" => "NOW()", "update_date" => "NOW()")); } header("Location: " . $_SESSION[$_SESSION["return_to_key"]]); SC_Response_Ex::actionExit(); }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objCustomer = new SC_Customer(); $objQuery = new SC_Query(); //ログイン判定 if (!$objCustomer->isLoginSuccess(true)) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); } else { //マイページトップ顧客情報表示用 $this->CustomerName1 = $objCustomer->getvalue('name01'); $this->CustomerName2 = $objCustomer->getvalue('name02'); $this->CustomerPoint = $objCustomer->getvalue('point'); } if (isset($_POST['no'])) { $this->sendRedirect($this->getLocation("./index.php"), true); exit; } elseif (isset($_POST['complete'])) { //会員削除 $objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id'))); $where = "email = ?"; $objCustomer->EndSession(); //完了ページへ $this->sendRedirect($this->getLocation("./refusal_complete.php"), true); exit; } $objView->assignobj($this); $objView->display(SITE_FRAME); }
function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true) { $objPage = new LC_Page(); $objSiteInfo = new SC_SiteInfo(); $arrInfo = $objSiteInfo->data; $objPage->arrInfo = $arrInfo; $objQuery = new SC_Query(); if ($subject == "" && $header == "" && $footer == "") { // メールテンプレート情報の取得 $where = "template_id = ?"; $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id)); $objPage->tpl_header = $arrRet[0]['header']; $objPage->tpl_footer = $arrRet[0]['footer']; $tmp_subject = $arrRet[0]['subject']; } else { $objPage->tpl_header = $header; $objPage->tpl_footer = $footer; $tmp_subject = $subject; } // 受注情報の取得 $where = "order_id = ?"; $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id)); $arrOrder = $arrRet[0]; $arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id)); $objPage->Message_tmp = $arrOrder['message']; // 顧客情報の取得 $customer_id = $arrOrder['customer_id']; $arrRet = $objQuery->select("point", "dtb_customer", "customer_id = ?", array($customer_id)); $arrCustomer = isset($arrRet[0]) ? $arrRet[0] : ""; $objPage->arrCustomer = $arrCustomer; $objPage->arrOrder = $arrOrder; //その他決済情報 if ($arrOrder['memo02'] != "") { $arrOther = unserialize($arrOrder['memo02']); foreach ($arrOther as $other_key => $other_val) { if (SC_Utils_Ex::sfTrim($other_val["value"]) == "") { $arrOther[$other_key]["value"] = ""; } } $objPage->arrOther = $arrOther; } // 都道府県変換 $objPage->arrOrder['deliv_pref'] = $this->arrPref[$objPage->arrOrder['deliv_pref']]; $objPage->arrOrderDetail = $arrOrderDetail; $objCustomer = new SC_Customer(); $objPage->tpl_user_point = $objCustomer->getValue('point'); $objMailView = new SC_SiteView(); // メール本文の取得 $objMailView->assignobj($objPage); $body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]); // メール送信処理 $objSendMail = new SC_SendMail_Ex(); $bcc = $arrInfo['email01']; $from = $arrInfo['email03']; $error = $arrInfo['email04']; $tosubject = $this->sfMakeSubject($objQuery, $objMailView, $objPage, $tmp_subject); $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); $objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " " . $arrOrder["order_name02"] . " 様"); // 送信フラグ:trueの場合は、送信する。 if ($send) { if ($objSendMail->sendMail()) { $this->sfSaveMailHistory($order_id, $template_id, $tosubject, $body); } } return $objSendMail; }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objQuery = new SC_Query(); $objCustomer = new SC_Customer(); // クッキー管理クラス $objCookie = new SC_Cookie(COOKIE_EXPIRE); // パラメータ管理クラス $objFormParam = new SC_FormParam(); // パラメータ情報の初期化 $this->lfInitParam($objFormParam); // POST値の取得 $objFormParam->setParam($_POST); // 携帯端末IDが一致する会員が存在するかどうかをチェックする。 $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId(); if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } // ログイン処理 if ($_POST['mode'] == 'login') { $objFormParam->toLower('login_email'); $arrErr = $objFormParam->checkError(); $arrForm = $objFormParam->getHashArray(); // クッキー保存判定 if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") { $objCookie->setCookie('login_email', $_POST['login_email']); } else { $objCookie->setCookie('login_email', ''); } if (count($arrErr) == 0) { if ($objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) || $objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) { // ログインが成功した場合は携帯端末IDを保存する。 $objCustomer->updateMobilePhoneId(); /* * email がモバイルドメインでは無く, * 携帯メールアドレスが登録されていない場合 */ $objMobile = new SC_Helper_Mobile_Ex(); if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) { if (!$objCustomer->hasValue('email_mobile')) { $this->sendRedirect($this->getLocation("../entry/email_mobile.php"), true); exit; } } } else { $objQuery = new SC_Query(); $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0"; $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email'])); if ($ret > 0) { SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true); } else { SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true); } } } } /* * ログインチェック * 携帯メールの登録を必須にする場合は isLoginSuccess(false) にする */ if (!$objCustomer->isLoginSuccess(true)) { $this->tpl_mainpage = 'mypage/login.tpl'; $objView->assignArray($objFormParam->getHashArray()); if (empty($arrErr)) { $arrErr = array(); } $objView->assignArray(array("arrErr" => $arrErr)); } else { //マイページトップ顧客情報表示用 $this->CustomerName1 = $objCustomer->getvalue('name01'); $this->CustomerName2 = $objCustomer->getvalue('name02'); } $objView->assignobj($this); //$objpage内の全てのテンプレート変数をsmartyに格納 $objView->display(SITE_FRAME); //パスとテンプレート変数の呼び出し、実行 }
/** * Page のプロセス. * * @return void */ function process() { $objView = new SC_SiteView(false); $objQuery = new SC_Query(); $objCustomer = new SC_Customer(); $ParentPage = MYPAGE_DELIVADDR_URL; // GETでページを指定されている場合には指定ページに戻す if (isset($_GET['page'])) { $ParentPage = htmlspecialchars($_GET['page'], ENT_QUOTES); } else { if (isset($_POST['ParentPage'])) { $ParentPage = htmlspecialchars($_POST['ParentPage'], ENT_QUOTES); } } $this->ParentPage = $ParentPage; //ログイン判定 if (!$objCustomer->isLoginSuccess()) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } if (!isset($_GET['other_deliv_id'])) { $_GET['other_deliv_id'] = ""; } if ($_POST['mode'] == "") { $_SESSION['other_deliv_id'] = $_GET['other_deliv_id']; } if ($_GET['other_deliv_id'] != "") { //不正アクセス判定 $flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id'])); if (!$objCustomer->isLoginSuccess() || $flag == 0) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } } //別のお届け先DB登録用カラム配列 $arrRegistColumn = array(array("column" => "name01", "convert" => "aKV"), array("column" => "name02", "convert" => "aKV"), array("column" => "kana01", "convert" => "CKV"), array("column" => "kana02", "convert" => "CKV"), array("column" => "zip01", "convert" => "n"), array("column" => "zip02", "convert" => "n"), array("column" => "pref", "convert" => "n"), array("column" => "addr01", "convert" => "aKV"), array("column" => "addr02", "convert" => "aKV"), array("column" => "tel01", "convert" => "n"), array("column" => "tel02", "convert" => "n"), array("column" => "tel03", "convert" => "n")); if ($_GET['other_deliv_id'] != "") { //別のお届け先情報取得 $arrOtherDeliv = $objQuery->select("*", "dtb_other_deliv", "other_deliv_id=? ", array($_SESSION['other_deliv_id'])); $this->arrForm = $arrOtherDeliv[0]; } switch ($_POST['mode']) { case 'edit': $_POST = $this->lfConvertParam($_POST, $arrRegistColumn); $this->arrErr = $this->lfErrorCheck($_POST); if ($this->arrErr) { foreach ($_POST as $key => $val) { if ($val != "") { $this->arrForm[$key] = $val; } } } else { //別のお届け先登録数の取得 $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id'))); if ($deliv_count < DELIV_ADDR_MAX or isset($_POST['other_deliv_id'])) { if (strlen($_POST['other_deliv_id'] != 0)) { $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=? and other_deliv_id = ?", array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id'])); if ($deliv_count == 0) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } else { $this->lfRegistData($_POST, $arrRegistColumn, $objCustomer); } } else { $this->lfRegistData($_POST, $arrRegistColumn, $objCustomer); } } if ($_POST['ParentPage'] == MYPAGE_DELIVADDR_URL || $_POST['ParentPage'] == URL_DELIV_TOP) { $this->tpl_onload = "fnUpdateParent('" . $this->getLocation($_POST['ParentPage']) . "'); window.close();"; } else { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } } break; } $objView->assignobj($this); $objView->display($this->tpl_mainpage); }
/** * Add product to authenticated user's favorites. (for Smart phone) * * @param SC_Customer $objCustomer * @return void */ public function doAddFavoriteSphone(SC_Customer $objCustomer) { // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用) if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) { $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam); if (count($this->arrErr) == 0) { if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) { $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg); $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this)); print 'true'; SC_Response_Ex::actionExit(); } } print 'error'; SC_Response_Ex::actionExit(); } }
function lfCheckError() { if ($_POST['mode'] == "add_favorite") { $objCustomer = new SC_Customer(); $objErr = new SC_CheckError(); $customer_id = $objCustomer->getValue('customer_id'); if (SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($customer_id, $favorite_product_id))) { $objErr->arrErr['add_favorite' . $favorite_product_id] = "※ この商品は既にお気に入りに追加されています。<br />"; } } else { // 入力データを渡す。 $arrRet = $this->objFormParam->getHashArray(); $objErr = new SC_CheckError($arrRet); $objErr->arrErr = $this->objFormParam->checkError(); // 複数項目チェック if ($this->tpl_classcat_find1) { $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK")); } if ($this->tpl_classcat_find2) { $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK")); } } return $objErr->arrErr; }
/** * 会員情報から SQL文の値を生成する. * * @param string $uniqid ユニークID * @param array $sqlval SQL の値の配列 * @return array 会員情報を含んだ SQL の値の配列 */ function sfGetCustomerSqlVal($uniqid, $sqlval) { $objCustomer = new SC_Customer(); // 会員情報登録処理 if ($objCustomer->isLoginSuccess(true)) { // 登録データの作成 $sqlval['order_temp_id'] = $uniqid; $sqlval['update_date'] = 'Now()'; $sqlval['customer_id'] = $objCustomer->getValue('customer_id'); $sqlval['order_name01'] = $objCustomer->getValue('name01'); $sqlval['order_name02'] = $objCustomer->getValue('name02'); $sqlval['order_kana01'] = $objCustomer->getValue('kana01'); $sqlval['order_kana02'] = $objCustomer->getValue('kana02'); $sqlval['order_sex'] = $objCustomer->getValue('sex'); $sqlval['order_zip01'] = $objCustomer->getValue('zip01'); $sqlval['order_zip02'] = $objCustomer->getValue('zip02'); $sqlval['order_pref'] = $objCustomer->getValue('pref'); $sqlval['order_addr01'] = $objCustomer->getValue('addr01'); $sqlval['order_addr02'] = $objCustomer->getValue('addr02'); $sqlval['order_tel01'] = $objCustomer->getValue('tel01'); $sqlval['order_tel02'] = $objCustomer->getValue('tel02'); $sqlval['order_tel03'] = $objCustomer->getValue('tel03'); if (defined('MOBILE_SITE')) { $email_mobile = $objCustomer->getValue('email_mobile'); if (empty($email_mobile)) { $sqlval['order_email'] = $objCustomer->getValue('email'); } else { $sqlval['order_email'] = $email_mobile; } } else { $sqlval['order_email'] = $objCustomer->getValue('email'); } $sqlval['order_job'] = $objCustomer->getValue('job'); $sqlval['order_birth'] = $objCustomer->getValue('birth'); } return $sqlval; }
/** * Page のプロセス. * * @return void */ function process() { global $objCampaignSess; $objView = new SC_SiteView(false); $objQuery = new SC_Query(); $objCustomer = new SC_Customer(); $objCampaignSess = new SC_CampaignSession(); // クッキー管理クラス $objCookie = new SC_Cookie(COOKIE_EXPIRE); $objLoginFormParam = new SC_FormParam(); // ログインフォーム用 $this->lfInitLoginFormParam($objLoginFormParam); // 初期設定 $objLoginFormParam->setParam($_POST); // POST値の取得 // ディレクトリ名を取得 $dir_name = dirname($_SERVER['PHP_SELF']); $arrDir = split('/', $dir_name); $dir_name = $arrDir[count($arrDir) - 1]; /* セッションにキャンペーンデータを書き込む */ // キャンペーンからの遷移という情報を保持 $objCampaignSess->setIsCampaign(); // キャンペーンIDを保持 $campaign_id = $objQuery->get("dtb_campaign", "campaign_id", "directory_name = ? AND del_flg = 0", array($dir_name)); $objCampaignSess->setCampaignId($campaign_id); // キャンペーンディレクトリ名を保持 $objCampaignSess->setCampaignDir($dir_name); // キャンペーンが開催中かをチェック if ($this->lfCheckActive($dir_name, $objQuery)) { $status = CAMPAIGN_TEMPLATE_ACTIVE; $this->is_active = true; } else { $status = CAMPAIGN_TEMPLATE_END; $this->is_active = false; } switch ($_POST['mode']) { // ログインチェック case 'login': $objLoginFormParam->toLower('login_email'); $this->arrErr = $objLoginFormParam->checkError(); $arrForm = $objLoginFormParam->getHashArray(); // クッキー保存判定 if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") { $objCookie->setCookie('login_email', $_POST['login_email']); } else { $objCookie->setCookie('login_email', ''); } if (count($this->arrErr) == 0) { // ログイン判定 if (!$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'])) { // 仮登録の判定 $where = "email = ? AND status = 1 AND del_flg = 0"; $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'])); if ($ret > 0) { SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); } else { SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); } } else { // 重複申込チェック $orverlapping_flg = $objQuery->get("dtb_campaign", "orverlapping_flg", "campaign_id = ?", array($objCampaignSess->getCampaignId())); if ($orverlapping_flg) { if ($this->lfOverlappingCheck($objCustomer->getValue('customer_id'), $objQuery)) { $this->arrErr['login_email'] = "※ 複数回ご応募することは出来ません。"; } } if (count($this->arrErr) == 0) { // 申込情報を登録 $this->lfRegistCampaignOrder($objCustomer->getValue('customer_id'), $objQuery); // 完了ページへリダイレクト $this->sendRedirect($this->getLocation(CAMPAIGN_URL . "{$dir_name}/complete.php")); exit; } } } break; default: break; } // 入力情報を渡す $this->arrForm = $_POST; $this->dir_name = $dir_name; $this->tpl_dir_name = CAMPAIGN_TEMPLATE_PATH . $dir_name . "/" . $status; //---- ページ表示 $objView->assignobj($this); $objView->display($this->tpl_mainpage); }
/** * 会員情報を受注情報にコピーする. * * ユーザーがログインしていない場合は何もしない. * 会員情報を $dest の order_* へコピーする. * customer_id は強制的にコピーされる. * * @param array $dest コピー先の配列 * @param SC_Customer $objCustomer SC_Customer インスタンス * @param string $prefix コピー先の接頭辞. デフォルト order * @param array $keys コピー対象のキー * @return void */ function copyFromCustomer(&$dest, &$objCustomer, $prefix = 'order', $keys = array('name01', 'name02', 'kana01', 'kana02', 'sex', 'zip01', 'zip02', 'pref', 'addr01', 'addr02', 'tel01', 'tel02', 'tel03', 'job', 'birth', 'email')) { if ($objCustomer->isLoginSuccess(true)) { foreach ($keys as $key) { if (in_array($key, $keys)) { $dest[$prefix . '_' . $key] = $objCustomer->getValue($key); } } if (Net_UserAgent_Mobile::isMobile() && in_array('email', $keys)) { $email_mobile = $objCustomer->getValue('email_mobile'); if (empty($email_mobile)) { $dest[$prefix . '_email'] = $objCustomer->getValue('email'); } else { $dest[$prefix . '_email'] = $email_mobile; } } $dest['customer_id'] = $objCustomer->getValue('customer_id'); $dest['update_date'] = 'CURRENT_TIMESTAMP'; } }
function lfGetOrderDetail($order_id) { $objQuery = new SC_Query(); $objCustomer = new SC_Customer(); //customer_idを検証 $customer_id = $objCustomer->getValue("customer_id"); $order_count = $objQuery->count("dtb_order", "order_id = ? and customer_id = ?", array($order_id, $customer_id)); if ($order_count != 1) { return array(); } $col = "product_id, classcategory_id1, classcategory_id2, quantity"; $where = "order_id = ?"; $objQuery->setorder("classcategory_id1, classcategory_id2"); $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id)); return $arrRet; }
/** * 会員情報を受注情報にコピーする. * * ユーザーがログインしていない場合は何もしない. * 会員情報を $dest の order_* へコピーする. * customer_id は強制的にコピーされる. * * @param array $dest コピー先の配列 * @param SC_Customer $objCustomer SC_Customer インスタンス * @param string $prefix コピー先の接頭辞. デフォルト order * @param array $keys コピー対象のキー * @return void */ public function copyFromCustomer(&$dest, &$objCustomer, $prefix = 'order', $keys = array('name01', 'name02', 'kana01', 'kana02', 'company_name', 'sex', 'zip01', 'zip02', 'country_id', 'zipcode', 'pref', 'addr01', 'addr02', 'tel01', 'tel02', 'tel03', 'fax01', 'fax02', 'fax03', 'job', 'birth', 'email')) { if ($objCustomer->isLoginSuccess(true)) { foreach ($keys as $key) { if (in_array($key, $keys)) { $dest[$prefix . '_' . $key] = $objCustomer->getValue($key); } } if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && in_array('email', $keys)) { $email_mobile = $objCustomer->getValue('email_mobile'); if (empty($email_mobile)) { $dest[$prefix . '_email'] = $objCustomer->getValue('email'); } else { $dest[$prefix . '_email'] = $email_mobile; } } $dest['customer_id'] = $objCustomer->getValue('customer_id'); $dest['update_date'] = 'CURRENT_TIMESTAMP'; } }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objSiteSess = new SC_SiteSession(); $objCartSess = new SC_CartSession(); $objCustomer = new SC_Customer(); // クッキー管理クラス $objCookie = new SC_Cookie(COOKIE_EXPIRE); // パラメータ管理クラス $this->objFormParam = new SC_FormParam(); // パラメータ情報の初期化 $this->lfInitParam(); // POST値の取得 $this->lfConvertEmail($_POST["login_email"]); $this->lfConvertLoginPass($_POST["login_pass"]); $this->objFormParam->setParam($_POST); $this->objLoginFormParam = new SC_FormParam(); // ログインフォーム用 $this->lfInitLoginFormParam(); // 初期設定 $this->objLoginFormParam->setParam($_POST); // POST値の取得 // ユーザユニークIDの取得と購入状態の正当性をチェック $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); $this->tpl_uniqid = $uniqid; if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } // ログインチェック if ($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess(true)) { // 不正アクセスとみなす SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); } switch ($_POST['mode']) { case 'login': $this->objLoginFormParam->toLower('login_email'); $this->arrErr = $this->objLoginFormParam->checkError(); $arrForm = $this->objLoginFormParam->getHashArray(); // クッキー保存判定 if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") { $objCookie->setCookie('login_email', $_POST['login_email']); } else { $objCookie->setCookie('login_email', ''); } if (count($this->arrErr) == 0) { // ログイン判定 if (!$objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) && !$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) { // 仮登録の判定 $objQuery = new SC_Query(); $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0"; $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email'])); if ($ret > 0) { SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true); } else { SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true); } } } else { // ログインページに戻る $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_TOP), true); exit; } // ログインが成功した場合は携帯端末IDを保存する。 $objCustomer->updateMobilePhoneId(); /* * 携帯メールアドレスが登録されていない場合は, * 携帯メールアドレス登録画面へ遷移 */ $objMobile = new SC_Helper_Mobile_Ex(); if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) { if (!$objCustomer->hasValue('email_mobile')) { $this->sendRedirect($this->getLocation("../entry/email_mobile.php"), true); exit; } } break; // 削除 // 削除 case 'delete': if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) { $objQuery = new SC_Query(); $where = "other_deliv_id = ?"; $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id'])); $this->objFormParam->setValue('select_addr_id', ''); } break; // 会員登録住所に送る // 会員登録住所に送る case 'customer_addr': // お届け先がチェックされている場合には更新処理を行う if ($_POST['deli'] != "") { // 会員情報の住所を受注一時テーブルに書き込む $this->lfRegistDelivData($uniqid, $objCustomer); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // お支払い方法選択ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; } else { // エラーを返す $arrErr['deli'] = '※ お届け先を選択してください。'; } break; // 登録済みの別のお届け先に送る // 登録済みの別のお届け先に送る case 'other_addr': // お届け先がチェックされている場合には更新処理を行う if ($_POST['deli'] != "") { if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) { $objQuery = new SC_Query(); $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=? and other_deliv_id = ?", array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id'])); if ($deliv_count != 1) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } // 登録済みの別のお届け先を受注一時テーブルに書き込む $this->lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['other_deliv_id']); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // お支払い方法選択ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; } } else { // エラーを返す $arrErr['deli'] = '※ お届け先を選択してください。'; } break; // 前のページに戻る // 前のページに戻る case 'return': // 確認ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP), true); exit; break; default: $objQuery = new SC_Query(); $where = "order_temp_id = ?"; $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid)); $this->objFormParam->setParam($arrRet[0]); break; } /** 表示処理 **/ // 会員登録住所の取得 $col = "name01, name02, pref, addr01, addr02, zip01, zip02"; $where = "customer_id = ?"; $objQuery = new SC_Query(); $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id'])); // 別のお届け先住所の取得 $col = "other_deliv_id, name01, name02, pref, addr01, addr02, zip01, zip02"; $objQuery->setorder("other_deliv_id DESC"); $objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id'])); $this->arrAddr = $arrCustomerAddr; $cnt = 1; foreach ($objOtherAddr as $val) { $this->arrAddr[$cnt] = $val; $cnt++; } // 入力値の取得 if (!isset($arrErr)) { $arrErr = array(); } $this->arrForm = $this->objFormParam->getFormParamList(); $this->arrErr = $arrErr; $objView->assignobj($this); $objView->display(SITE_FRAME); }