/** * 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'); // パラメーター管理クラス $this->objFormParam = Application::alias('eccube.form_param'); // パラメーター情報の初期化 $this->arrForm = $this->lfInitParam($this->objFormParam); // ファイル管理クラス $this->objUpFile = new UploadFile(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR); // ファイル情報の初期化 $this->objUpFile = $this->lfInitFile($this->objUpFile); $this->mode = $this->getMode(); /* @var $objProduct Product */ $objProduct = Application::alias('eccube.product'); // プロダクトIDの正当性チェック $product_id = $this->lfCheckProductId($this->objFormParam->getValue('admin'), $this->objFormParam->getValue('product_id'), $objProduct); $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 .= 'eccube.classCategories = ' . Utils::jsonEncode($objProduct->classCategories[$product_id]) . ';'; $this->tpl_javascript .= 'function lnOnLoad() {' . $this->js_lnOnload . '}'; $this->tpl_onload .= 'lnOnLoad();'; // モバイル用 規格選択セレクトボックスの作成 if (Application::alias('eccube.display')->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 (Application::alias('eccube.display')->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']; // 関連カテゴリを取得 $arrCategory_id = $objProduct->getCategoryIds($product_id); /* @var $objCategory CategoryHelper */ $objCategory = Application::alias('eccube.helper.category'); $this->arrRelativeCat = array(); foreach ($arrCategory_id as $category_id) { $this->arrRelativeCat[] = $objCategory->getTreeTrail($category_id, false); } // 商品ステータスを取得 $this->productStatus = $objProduct->getProductStatus($product_id); // 画像ファイル指定がない場合の置換処理 $this->arrProduct['main_image'] = Utils::sfNoImageMain($this->arrProduct['main_image']); $this->subImageFlag = $this->lfSetFile($this->objUpFile, $this->arrProduct, $this->arrFile); //関連商品情報表示 $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id); // ログイン判定 if ($objCustomer->isLoginSuccess() === true) { //お気に入りボタン表示 $this->tpl_login = true; $this->is_favorite = Application::alias('eccube.helper.db')->dataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($objCustomer->getValue('customer_id'), $product_id)); } }