/**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objCart = new SC_CartSession_Ex();
     $this->isMultiple = $objCart->isMultiple();
     $this->hasDownload = $objCart->hasProductType(PRODUCT_TYPE_DOWNLOAD);
     $this->arrCartList = $this->lfGetCartData($objCart);
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     $objCart = new SC_CartSession_Ex();
     $this->isMultiple = $objCart->isMultiple();
     $this->hasDownload = $objCart->hasProductType(PRODUCT_TYPE_DOWNLOAD);
     // 旧仕様との互換のため、不自然なセットとなっている
     $this->arrCartList = array(0 => $this->lfGetCartData($objCart));
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 public function action()
 {
     parent::action();
     //ヘッダーナビのカート情報を取得
     $objCart = new SC_CartSession_Ex();
     $cartKeys = $objCart->getKeys();
     $arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
     $this->freeRule = $arrInfo['free_rule'];
     $this->arrCartList = $this->lfGetCartData($objCart, $arrInfo, $cartKeys);
 }
Esempio n. 4
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $this->tpl_title = '';
     $objCustomer = new SC_Customer_Ex();
     $this->isLogin = $objCustomer->isLoginSuccess(true);
     $objCart = new SC_CartSession_Ex();
     $this->isMultiple = $objCart->isMultiple();
     $this->hasDownload = $objCart->hasProductType(PRODUCT_TYPE_DOWNLOAD);
     // 旧仕様との互換のため、不自然なセットとなっている
     $this->arrCartList = array(0 => $this->lfGetCartData($objCart));
 }
Esempio n. 5
0
 function SC_SiteView($setPrevURL = true)
 {
     parent::SC_View();
     $this->_smarty->template_dir = TEMPLATE_REALDIR;
     $this->_smarty->compile_dir = COMPILE_REALDIR;
     $this->assignTemplatePath(DEVICE_TYPE_PC);
     $this->initpath();
     if ($setPrevURL) {
         $objCartSess = new SC_CartSession_Ex();
         $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     // カートが空かどうかを確認する。
     $objCartSess = new SC_CartSession_Ex();
     $arrCartKeys = $objCartSess->getKeys();
     $this->tpl_cart_empty = true;
     foreach ($arrCartKeys as $cart_key) {
         if (count($objCartSess->getCartList($cart_key)) > 0) {
             $this->tpl_cart_empty = false;
             break;
         }
     }
     // メインテンプレートを設定
     if (CUSTOMER_CONFIRM_MAIL == true) {
         // 仮会員登録完了
         $this->tpl_mainpage = 'entry/complete.tpl';
     } else {
         // 本会員登録完了
         SC_Response_Ex::sendRedirectFromUrlPath('regist/complete.php');
     }
 }
 public function checkSessionPendingOrder()
 {
     if (!SC_Utils_Ex::isBlank($_SESSION['order_id'])) {
         $order_id = $_SESSION['order_id'];
         unset($_SESSION['order_id']);
         $objQuery =& SC_Query_Ex::getSingletonInstance();
         $objQuery->begin();
         $arrOrder = SC_Helper_Purchase_Ex::getOrder($order_id);
         if ($arrOrder['status'] == ORDER_PENDING) {
             $objCartSess = new SC_CartSession_Ex();
             $cartKeys = $objCartSess->getKeys();
             if (SC_Utils_Ex::isBlank($cartKeys)) {
                 SC_Helper_Purchase_Ex::rollbackOrder($order_id, ORDER_CANCEL, true);
                 GC_Utils_Ex::gfPrintLog('order rollback.(session pending) order_id=' . $order_id);
             } else {
                 SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true);
                 GC_Utils_Ex::gfPrintLog('order rollback.(session pending and set card) order_id=' . $order_id);
             }
         }
         $objQuery->commit();
     }
 }
 /**
  * Add product(s) into the cart.
  * 
  * @return void 
  */
 function doCart()
 {
     $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
     if (count($this->arrErr) == 0) {
         $objCartSess = new SC_CartSession_Ex();
         $product_class_id = $this->objFormParam->getValue('product_class_id');
         $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'));
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
 }
 /**
  * 入力チェックを行う.
  *
  * @param  SC_FormParam $objFormParam SC_FormParam インスタンス
  * @return array        エラー情報の配列
  */
 public function lfCheckError(&$objFormParam)
 {
     $objCartSess = new SC_CartSession_Ex();
     $objFormParam->convParam();
     // 数量未入力は0に置換
     $objFormParam->setValue('quantity', $objFormParam->getValue('quantity', 0));
     $arrErr = $objFormParam->checkError();
     $arrParams = $objFormParam->getSwapArray();
     if (empty($arrErr)) {
         foreach ($arrParams as $index => $arrParam) {
             // 数量0で、お届け先を選択している場合
             if ($arrParam['quantity'] == 0 && !SC_Utils_Ex::isBlank($arrParam['shipping'])) {
                 $arrErr['shipping'][$index] = '※ 数量が0の場合、お届け先を入力できません。<br />';
             }
             // 数量の入力があり、お届け先を選択していない場合
             if ($arrParam['quantity'] > 0 && SC_Utils_Ex::isBlank($arrParam['shipping'])) {
                 $arrErr['shipping'][$index] = '※ お届け先が入力されていません。<br />';
             }
         }
     }
     // 入力エラーが無い場合、カゴの中身との数量の整合を確認
     if (empty($arrErr)) {
         $arrQuantity = array();
         // 入力内容を集計
         foreach ($arrParams as $arrParam) {
             $product_class_id = $arrParam['product_class_id'];
             $arrQuantity[$product_class_id] += $arrParam['quantity'];
         }
         // カゴの中身と突き合わせ
         $cartLists =& $objCartSess->getCartList($objCartSess->getKey());
         foreach ($cartLists as $arrCartRow) {
             $product_class_id = $arrCartRow['id'];
             // 差異がある場合、エラーを記録
             if ($arrCartRow['quantity'] != $arrQuantity[$product_class_id]) {
                 foreach ($arrParams as $index => $arrParam) {
                     if ($arrParam['product_class_id'] == $product_class_id) {
                         $arrErr['quantity'][$index] = '※ 数量合計を「' . $arrCartRow['quantity'] . '」にしてください。<br />';
                     }
                 }
             }
         }
     }
     return $arrErr;
 }
Esempio n. 10
0
 function setPrevURL()
 {
     // TODO SC_SiteSession で実装した方が良さげ
     $objCartSess = new SC_CartSession_Ex();
     $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
 }
Esempio n. 11
0
 /**
  * カートに商品を追加
  *
  * @return void
  */
 public function lfAddCart($arrForm)
 {
     $objCartSess = new SC_CartSession_Ex();
     $product_class_id = $arrForm['product_class_id'];
     $objCartSess->addProduct($product_class_id, $arrForm['quantity']);
 }
Esempio n. 12
0
 /**
  * カートを購入モードに設定
  *
  * @param SC_SiteSession_Ex $objSiteSess
  * @param SC_CartSession_Ex $objCartSess
  * @return void
  */
 public function lfSetCurrentCart(&$objSiteSess, &$objCartSess, $cartKey)
 {
     // 正常に登録されたことを記録しておく
     $objSiteSess->setRegistFlag();
     $pre_uniqid = $objSiteSess->getUniqId();
     // 注文一時IDの発行
     $objSiteSess->setUniqId();
     $uniqid = $objSiteSess->getUniqId();
     // エラーリトライなどで既にuniqidが存在する場合は、設定を引き継ぐ
     if ($pre_uniqid != '') {
         $this->lfUpdateOrderTempid($pre_uniqid, $uniqid);
     }
     // カートを購入モードに設定
     $objCartSess->registerKey($cartKey);
     $objCartSess->saveCurrentCart($uniqid, $cartKey);
 }
 /**
  * Add product(s) into the cart.
  *
  * @return void
  */
 public function doCart()
 {
     $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
     if (count($this->arrErr) == 0) {
         $objCartSess = new SC_CartSession_Ex();
         $product_class_id = $this->objFormParam->getValue('product_class_id');
         $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'));
         // 開いているカテゴリーツリーを維持するためのパラメーター
         $arrQueryString = array('product_id' => $this->objFormParam->getValue('product_id'));
         SC_Response_Ex::sendRedirect(CART_URL, $arrQueryString);
         SC_Response_Ex::actionExit();
     }
 }
Esempio n. 14
0
 /**
  * 単一配送指定用に配送商品を設定する
  *
  * @param SC_CartSession $objCartSession カート情報のインスタンス
  * @param integer $shipping_id 配送先ID
  * @return void
  */
 function setShipmentItemTempForSole(&$objCartSession, $shipping_id = 0)
 {
     $objCartSess = new SC_CartSession_Ex();
     $this->clearShipmentItemTemp();
     $arrCartList =& $objCartSession->getCartList($objCartSess->getKey());
     foreach ($arrCartList as $arrCartRow) {
         if ($arrCartRow['quantity'] == 0) {
             continue;
         }
         $this->setShipmentItemTemp($shipping_id, $arrCartRow['id'], $arrCartRow['quantity']);
     }
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objSiteSess = new SC_SiteSession_Ex();
     $objCartSess = new SC_CartSession_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objFormParam = new SC_FormParam_Ex();
     $this->is_multiple = $objPurchase->isMultiple();
     // カートの情報を取得
     $this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple);
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $cart_key = $objCartSess->getKey();
     $this->cartKey = $cart_key;
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     // 配送業者を取得
     $this->arrDeliv = $objPurchase->getDeliv($cart_key);
     $this->is_single_deliv = $this->isSingleDeliv($this->arrDeliv);
     // 会員情報の取得
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = '******';
         $this->tpl_user_point = $objCustomer->getValue('point');
         $this->name01 = $objCustomer->getValue('name01');
         $this->name02 = $objCustomer->getValue('name02');
     }
     // 戻り URL の設定
     // @deprecated 2.12.0 テンプレート直書きに戻した
     $this->tpl_back_url = '?mode=return';
     $arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid);
     // 正常に受注情報が格納されていない場合はカート画面へ戻す
     if (SC_Utils_Ex::isBlank($arrOrderTemp)) {
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
     // カート内商品の妥当性チェック
     $this->tpl_message = $objCartSess->checkProducts($cart_key);
     if (strlen($this->tpl_message) >= 1) {
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
     /*
      * 購入金額の取得
      * ここでは送料を加算しない
      */
     $this->arrPrices = $objCartSess->calculate($cart_key, $objCustomer);
     // お届け日一覧の取得
     $this->arrDelivDate = $objPurchase->getDelivDate($objCartSess, $cart_key);
     switch ($this->getMode()) {
         /*
          * 配送業者選択時のアクション
          * モバイル端末以外の場合は, JSON 形式のデータを出力し, ajax で取得する.
          */
         case 'select_deliv':
             $this->setFormParams($objFormParam, $arrOrderTemp, true, $this->arrShipping);
             $objFormParam->setParam($_POST);
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $deliv_id = $objFormParam->getValue('deliv_id');
                 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
                 $arrSelectedDeliv['error'] = false;
             } else {
                 $arrSelectedDeliv = array('error' => true);
                 $this->tpl_mainpage = 'shopping/select_deliv.tpl';
                 // モバイル用
             }
             if (SC_Display_Ex::detectDevice() != DEVICE_TYPE_MOBILE) {
                 echo SC_Utils_Ex::jsonEncode($arrSelectedDeliv);
                 SC_Response_Ex::actionExit();
             } else {
                 $this->arrPayment = $arrSelectedDeliv['arrPayment'];
                 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
             }
             break;
             // 登録処理
         // 登録処理
         case 'confirm':
             // パラメーター情報の初期化
             $this->setFormParams($objFormParam, $_POST, false, $this->arrShipping);
             $deliv_id = $objFormParam->getValue('deliv_id');
             $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
             $this->arrPayment = $arrSelectedDeliv['arrPayment'];
             $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
             $this->img_show = $arrSelectedDeliv['img_show'];
             $this->arrErr = $this->lfCheckError($objFormParam, $this->arrPrices['subtotal'], $this->tpl_user_point);
             if (empty($this->arrErr)) {
                 $this->saveShippings($objFormParam, $this->arrDelivTime);
                 $this->lfRegistData($this->tpl_uniqid, $objFormParam->getDbArray(), $objPurchase, $this->arrPayment);
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
                 // 確認ページへ移動
                 SC_Response_Ex::sendRedirect(SHOPPING_CONFIRM_URLPATH);
                 SC_Response_Ex::actionExit();
             }
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 正常な推移であることを記録しておく
             $objSiteSess->setRegistFlag();
             $url = null;
             if ($this->is_multiple) {
                 $url = MULTIPLE_URLPATH . '?from=multiple';
             } elseif ($objCustomer->isLoginSuccess(true)) {
                 if ($product_type_id == PRODUCT_TYPE_DOWNLOAD) {
                     $url = CART_URLPATH;
                 } else {
                     $url = DELIV_URLPATH;
                 }
             } else {
                 $url = SHOPPING_URL . '?from=nonmember';
             }
             SC_Response_Ex::sendRedirect($url);
             SC_Response_Ex::actionExit();
             break;
         default:
             // FIXME 前のページから戻ってきた場合は別パラメーター(mode)で処理分岐する必要があるのかもしれない
             $this->setFormParams($objFormParam, $arrOrderTemp, false, $this->arrShipping);
             if (!$this->is_single_deliv) {
                 $deliv_id = $objFormParam->getValue('deliv_id');
             } else {
                 $deliv_id = $this->arrDeliv[0]['deliv_id'];
             }
             if (!SC_Utils_Ex::isBlank($deliv_id)) {
                 $objFormParam->setValue('deliv_id', $deliv_id);
                 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id);
                 $this->arrPayment = $arrSelectedDeliv['arrPayment'];
                 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime'];
                 $this->img_show = $arrSelectedDeliv['img_show'];
             }
             break;
     }
     // モバイル用 ポストバック処理
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && SC_Utils_Ex::isBlank($this->arrErr)) {
         $this->tpl_mainpage = $this->getMobileMainpage($this->is_single_deliv, $this->getMode());
     }
     $this->arrForm = $objFormParam->getFormParamList();
 }
 function lfAddCartProducts($arrOrderDetail)
 {
     $objCartSess = new SC_CartSession_Ex();
     foreach ($arrOrderDetail as $order_row) {
         $objCartSess->addProduct($order_row['product_class_id'], $order_row['quantity']);
     }
 }
Esempio n. 17
0
 function setPrevURL()
 {
     $objCartSess = new SC_CartSession_Ex();
     $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
 }
 /**
  * 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('product_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->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
             if (count($this->arrErr) == 0) {
                 $objCartSess = new SC_CartSession_Ex();
                 $product_class_id = $this->objFormParam->getValue('product_class_id');
                 $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'));
                 SC_Response_Ex::sendRedirect(CART_URLPATH);
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'add_favorite':
             // ログイン中のユーザが商品をお気に入りにいれる処理
             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', array($this));
                         SC_Response_Ex::actionExit();
                     }
                 }
             }
             break;
         case 'add_favorite_sphone':
             // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用)
             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();
             }
             break;
         case 'select':
         case 'select2':
         case 'selectItem':
             /**
              * モバイルの数量指定・規格選択の際に、
              * $_SESSION['cart_referer_url'] を上書きさせないために、
              * 何もせずbreakする。
              */
             break;
         default:
             // カート「戻るボタン」用に保持
             $netURL = new Net_URL();
             $_SESSION['cart_referer_url'] = $netURL->getURL();
             break;
     }
     // モバイル用 ポストバック処理
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         switch ($this->mode) {
             case 'select':
                 // 規格1が設定されている場合
                 if ($this->tpl_classcat_find1) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find1.tpl';
                     break;
                 }
                 // 数量の入力を行う
                 $this->tpl_mainpage = 'products/select_item.tpl';
                 break;
             case 'select2':
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
                 // 規格1が設定されていて、エラーを検出した場合
                 if ($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find1.tpl';
                     break;
                 }
                 // 規格2が設定されている場合
                 if ($this->tpl_classcat_find2) {
                     $this->arrErr = array();
                     $this->tpl_mainpage = 'products/select_find2.tpl';
                     break;
                 }
             case 'selectItem':
                 $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam, $this->tpl_classcat_find1, $this->tpl_classcat_find2);
                 // 規格2が設定されていて、エラーを検出した場合
                 if ($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) {
                     // templateの変更
                     $this->tpl_mainpage = 'products/select_find2.tpl';
                     break;
                 }
                 $value1 = $this->objFormParam->getValue('classcategory_id1');
                 // 規格2が設定されている場合.
                 if (SC_Utils_Ex::isBlank($this->objFormParam->getValue('classcategory_id2')) == false) {
                     $value2 = '#' . $this->objFormParam->getValue('classcategory_id2');
                 } else {
                     $value2 = '#0';
                 }
                 if (strlen($value1) === 0) {
                     $value1 = '__unselected';
                 }
                 $this->tpl_product_class_id = $objProduct->classCategories[$product_id][$value1][$value2]['product_class_id'];
                 // この段階では、数量の入力チェックエラーを出させない。
                 unset($this->arrErr['quantity']);
                 // 数量の入力を行う
                 $this->tpl_mainpage = 'products/select_item.tpl';
                 break;
             case 'cart':
                 // この段階でエラーが出る場合は、数量の入力エラーのはず
                 if (count($this->arrErr)) {
                     // 数量の入力を行う
                     $this->tpl_mainpage = 'products/select_item.tpl';
                 }
                 break;
             default:
                 $this->tpl_mainpage = 'products/detail.tpl';
                 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['main_image'] = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']);
     $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 action()
 {
     $objCartSess = new SC_CartSession_Ex();
     $objSiteSess = new SC_SiteSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objFormParam = $this->lfInitParam($_POST);
     $this->mode = $this->getMode();
     // モバイル対応
     if (SC_Display_Ex::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)) {
         SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND);
         SC_Response_Ex::actionExit();
     }
     switch ($this->mode) {
         case 'confirm':
             // カート内情報の取得
             $cartList = $objCartSess->getCartList($cartKey);
             // カート商品が1件以上存在する場合
             if (count($cartList) > 0) {
                 // カートを購入モードに設定
                 $this->lfSetCurrentCart($objSiteSess, $objCartSess, $cartKey);
                 // 購入ページへ
                 SC_Response_Ex::sendRedirect(SHOPPING_URL);
                 SC_Response_Ex::actionExit();
             }
             break;
         case 'up':
             //1個追加
             $objCartSess->upQuantity($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'down':
             //1個減らす
             $objCartSess->downQuantity($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'setQuantity':
             //数量変更
             $objCartSess->setQuantity($objFormParam->getValue('quantity'), $cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         case 'delete':
             //カートから削除
             $objCartSess->delProduct($cart_no, $cartKey);
             SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true);
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
     $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
     $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 = $objFormParam->getValue('category_id');
     // ログイン判定
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = true;
         $this->tpl_user_point = $objCustomer->getValue('point');
         $this->tpl_name = $objCustomer->getValue('name01');
     }
     // 前頁のURLを取得
     // TODO: SC_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();
 }
 /**
  * 入力チェックを行う.
  *
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @return array エラー情報の配列
  */
 function lfCheckError(&$objFormParam)
 {
     $objCartSess = new SC_CartSession_Ex();
     $objFormParam->convParam();
     // 数量未入力は0に置換
     $objFormParam->setValue('quantity', $objFormParam->getValue('quantity', 0));
     $arrErr = $objFormParam->checkError();
     $arrParams = $objFormParam->getSwapArray();
     if (empty($arrErr)) {
         foreach ($arrParams as $index => $arrParam) {
             // 数量0で、お届け先を選択している場合
             if ($arrParam['quantity'] == 0 && !SC_Utils_Ex::isBlank($arrParam['shipping'])) {
                 $arrErr['shipping'][$index] = t('c_* When the quantity is 0, it is not possible to enter a shipping destination.<br />_01');
             }
             // 数量の入力があり、お届け先を選択していない場合
             if ($arrParam['quantity'] > 0 && SC_Utils_Ex::isBlank($arrParam['shipping'])) {
                 $arrErr['shipping'][$index] = t('c_* The shipping destination has not been entered.<br />_01');
             }
         }
     }
     // 入力エラーが無い場合、カゴの中身との数量の整合を確認
     if (empty($arrErr)) {
         $arrQuantity = array();
         // 入力内容を集計
         foreach ($arrParams as $arrParam) {
             $product_class_id = $arrParam['product_class_id'];
             $arrQuantity[$product_class_id] += $arrParam['quantity'];
         }
         // カゴの中身と突き合わせ
         $cartLists =& $objCartSess->getCartList($objCartSess->getKey());
         foreach ($cartLists as $arrCartRow) {
             $product_class_id = $arrCartRow['id'];
             // 差異がある場合、エラーを記録
             if ($arrCartRow['quantity'] != $arrQuantity[$product_class_id]) {
                 foreach ($arrParams as $index => $arrParam) {
                     if ($arrParam['product_class_id'] == $product_class_id) {
                         $arrErr['quantity'][$index] = t('c_* Use T_ARG1 for the total quantity.<br />_01', array('T_ARG1' => $arrCartRow['quantity']));
                     }
                 }
             }
         }
     }
     return $arrErr;
 }