function lfCheckError($mode, &$objFormParam, $tpl_classcat_find1 = null, $tpl_classcat_find2 = null) { switch ($mode) { case 'add_favorite_sphone': case 'add_favorite': $objCustomer = new SC_Customer_Ex(); $objErr = new SC_CheckError_Ex(); $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] = t('c_* This product has already been added to Favorites.<br />_01'); } break; default: // 入力データを渡す。 $arrRet = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrRet); $objErr->arrErr = $objFormParam->checkError(); // 複数項目チェック if ($tpl_classcat_find1) { $objErr->doFunc(array(t('c_Standard 1_01'), 'classcategory_id1'), array('EXIST_CHECK')); } if ($tpl_classcat_find2) { $objErr->doFunc(array(t('c_Standard 2_01'), 'classcategory_id2'), array('EXIST_CHECK')); } break; } return $objErr->arrErr; }
function lfCheckError($mode, &$objFormParam, $tpl_classcat_find1 = null, $tpl_classcat_find2 = null) { switch ($mode) { case 'add_favorite_sphone': case 'add_favorite': $objCustomer = new SC_Customer_Ex(); $objErr = new SC_CheckError_Ex(); $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 />"; } break; default: // 入力データを渡す。 $arrRet = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrRet); $objErr->arrErr = $objFormParam->checkError(); // 複数項目チェック if ($tpl_classcat_find1) { $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK")); } if ($tpl_classcat_find2) { $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK")); } break; } return $objErr->arrErr; }
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; }
function lfCheckError($mode, &$objFormParam, $tpl_classcat_find1 = null, $tpl_classcat_find2 = null) { switch ($mode) { case 'add_favorite_sphone': case 'add_favorite': $objCustomer = new SC_Customer_Ex(); $objErr = new SC_CheckError_Ex(); $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 />'; } break; default: // 入力データを渡す。 $arrRet = $objFormParam->getHashArray(); $objErr = new SC_CheckError_Ex($arrRet); $objErr->arrErr = $objFormParam->checkError(); break; } $class = $objFormParam->getValue('class'); $class = explode('_', $class); $objFormParam->setParam(array('classcategory_id1' => $class[0], 'classcategory_id2' => $class[1])); return $objErr->arrErr; }
/** * Page のAction. * * @return void */ function action() { // 会員クラス $objCustomer = new SC_Customer_Ex(); // パラメーター管理クラス $this->objFormParam = new SC_FormParam_Ex(); // パラメーター情報の初期化 $this->arrForm = $this->lfInitParam($this->objFormParam); // ファイル管理クラス $this->objUpFile = new SC_UploadFile_Ex(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR); // ファイル情報の初期化 $this->objUpFile = $this->lfInitFile($this->objUpFile); // プロダクトIDの正当性チェック $product_id = $this->lfCheckProductId($this->objFormParam->getValue('admin'), $this->objFormParam->getValue('brand_id')); $this->mode = $this->getMode(); $objProduct = new SC_Product_Ex(); $objProduct->setProductsClassByProductIds(array($product_id)); // 規格1クラス名 $this->tpl_class_name1 = $objProduct->className1[$product_id]; // 規格2クラス名 $this->tpl_class_name2 = $objProduct->className2[$product_id]; // 規格1 $this->arrClassCat1 = $objProduct->classCats1[$product_id]; // 規格1が設定されている $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id]; // 規格2が設定されている $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id]; $this->tpl_stock_find = $objProduct->stock_find[$product_id]; $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_class_id']; $this->tpl_product_type = $objProduct->classCategories[$product_id]['__unselected']['__unselected']['product_type']; // 在庫が無い場合は、OnLoadしない。(javascriptエラー防止) if ($this->tpl_stock_find) { // 規格選択セレクトボックスの作成 $this->js_lnOnload .= $this->lfMakeSelect(); } $this->tpl_javascript .= 'classCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories[$product_id]) . ';'; $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}'; $this->tpl_onload .= 'lnOnLoad();'; // モバイル用 規格選択セレクトボックスの作成 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { $this->lfMakeSelectMobile($this, $product_id, $this->objFormParam->getValue('classcategory_id1')); } // 商品IDをFORM内に保持する $this->tpl_product_id = $product_id; switch ($this->mode) { case 'cart': $this->doCart(); break; case 'add_favorite': $this->doAddFavorite($objCustomer); break; case 'add_favorite_sphone': $this->doAddFavoriteSphone($objCustomer); break; case 'select': case 'select2': case 'selectItem': /** * モバイルの数量指定・規格選択の際に、 * $_SESSION['cart_referer_url'] を上書きさせないために、 * 何もせずbreakする。 */ break; default: $this->doDefault(); break; } // モバイル用 ポストバック処理 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { switch ($this->mode) { case 'select': $this->doMobileSelect(); break; case 'select2': $this->doMobileSelect2(); break; case 'selectItem': $this->doMobileSelectItem(); break; case 'cart': $this->doMobileCart(); break; default: $this->doMobileDefault(); break; } } // 商品詳細を取得 $this->arrProduct = $objProduct->getDetail($product_id); // サブタイトルを取得 $this->tpl_subtitle = $this->arrProduct['name']; // 関連カテゴリを取得 $this->arrRelativeCat = SC_Helper_DB_Ex::sfGetMultiCatTree($product_id); // 商品ステータスを取得 $this->productStatus = $objProduct->getProductStatus($product_id); // 画像ファイル指定がない場合の置換処理 $this->arrProduct['image_path'] = SC_Utils_Ex::sfNoImageMain($this->arrProduct['image_path']); $this->subImageFlag = $this->lfSetFile($this->objUpFile, $this->arrProduct, $this->arrFile); //レビュー情報の取得 $this->arrReview = $this->lfGetReviewData($product_id); //関連商品情報表示 $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id); // ログイン判定 if ($objCustomer->isLoginSuccess() === true) { //お気に入りボタン表示 $this->tpl_login = true; $this->is_favorite = SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($objCustomer->getValue('customer_id'), $product_id)); } }
/** * Page のプロセス. * * @return void */ function process() { // トラックバック機能の稼働状況チェック if (SC_Utils_Ex::sfGetSiteControlFlg(SITE_CONTROL_TRACKBACK) != 1) { // NG $this->IfResponseNg(); exit; } $objQuery = new SC_Query(); $objFormParam = new SC_FormParam(); // パラメータ情報の初期化 $this->lfInitParam($objFormParam); // エンコード設定(サーバ環境によって変更) $beforeEncode = "auto"; $afterEncode = mb_internal_encoding(); if (isset($_POST["charset"])) { $beforeEncode = $_POST["charset"]; } else { if (isset($_GET["charset"])) { $beforeEncode = $_GET["charset"]; } } // POSTデータの取得とエンコード変換 // ブログ名 if (isset($_POST["blog_name"])) { $arrData["blog_name"] = trim(mb_convert_encoding($_POST["blog_name"], $afterEncode, $beforeEncode)); } else { if (isset($_GET["blog_name"])) { $arrData["blog_name"] = trim(mb_convert_encoding($_GET["blog_name"], $afterEncode, $beforeEncode)); } } // ブログ記事URL if (isset($_POST["url"])) { $arrData["url"] = trim(mb_convert_encoding($_POST["url"], $afterEncode, $beforeEncode)); } else { if (isset($_GET["url"])) { $arrData["url"] = trim(mb_convert_encoding($_GET["url"], $afterEncode, $beforeEncode)); } else { /* * RSS目的ではないGETリクエストを制御(livedoor blog) * _rssパラメータでのGETリクエストを制御(Yahoo blog) */ if (isset($_GET["__mode"]) && isset($_GET["pid"])) { if ($_GET["__mode"] == "rss") { $this->IfResponseRss($_GET["pid"]); } } exit; } } // ブログ記事タイトル if (isset($_POST["title"])) { $arrData["title"] = trim(mb_convert_encoding($_POST["title"], $afterEncode, $beforeEncode)); } else { if (isset($_GET["title"])) { $arrData["title"] = trim(mb_convert_encoding($_GET["title"], $afterEncode, $beforeEncode)); } } // ブログ記事内容 if (isset($_POST["excerpt"])) { $arrData["excerpt"] = trim(mb_convert_encoding($_POST["excerpt"], $afterEncode, $beforeEncode)); } else { if (isset($_GET["excerpt"])) { $arrData["excerpt"] = trim(mb_convert_encoding($_GET["excerpt"], $afterEncode, $beforeEncode)); } } $log_path = DATA_PATH . "logs/tb_result.log"; GC_Utils_Ex::gfPrintLog("request data start -----", $log_path); foreach ($arrData as $key => $val) { GC_Utils_Ex::gfPrintLog("\t" . $key . " => " . $val, $log_path); } GC_Utils_Ex::gfPrintLog("request data end -----", $log_path); $objFormParam->setParam($arrData); // 入力文字の変換 $objFormParam->convParam(); $arrData = $objFormParam->getHashArray(); // エラーチェック(トラックバックが成り立たないので、URL以外も必須とする) $this->arrErr = $this->lfCheckError($objFormParam); // エラーがない場合はデータを更新 if (count($this->arrErr) == 0) { // 商品コードの取得(GET) if (isset($_GET["pid"])) { $product_id = $_GET["pid"]; // 商品データの存在確認 $table = "dtb_products"; $where = "product_id = ?"; $objDb = new SC_Helper_DB_Ex(); // 商品データが存在する場合はトラックバックデータの更新 if ($objDb->sfDataExists($table, $where, array($product_id))) { $arrData["product_id"] = $product_id; // データの更新 if ($this->lfEntryTrackBack($arrData, $objQuery) == 1) { $this->IfResponseOk(); } } else { GC_Utils_Ex::gfPrintLog("--- PRODUCT NOT EXISTS : " . $product_id, $log_path); } } } foreach ($this->arrErr as $key => $val) { GC_Utils_Ex::gfPrintLog("\t" . $key . " => " . $val, $log_path); } // NG $this->IfResponseNg(); exit; }