/**
  * 受注IDをキーにして, 決済モジュールのパスを取得する.
  *
  * 決済モジュールが取得できた場合は, require 可能な決済モジュールのパスを返す.
  * 受注IDが無効な場合, 取得したパスにファイルが存在しない場合は false
  *
  * @param  integer        $order_id 受注ID
  * @return string|boolean 成功した場合は決済モジュールのパス;
  *                        失敗した場合 false
  */
 public function getModulePath($order_id)
 {
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objPayment = new SC_Helper_Payment_Ex();
     $order = $objPurchase->getOrder($order_id);
     $payment = $objPayment->get($order['payment_id']);
     $module_path = $payment['module_path'];
     /*
      * 2.12.x までは dtb_payment.module_path がフルパスとなっていた.
      * 2.13.x より, MODULE_REALDIR からのパスでも対応できるよう修正
      * http://svn.ec-cube.net/open_trac/ticket/2292
      */
     if (realpath($module_path) !== false) {
         $module_path = str_replace('\\', '/', realpath($module_path));
     } else {
         $module_path = str_replace('\\', '/', $module_path);
     }
     $module_realdir = str_replace('\\', '/', realpath(MODULE_REALDIR) . '/');
     if (strpos($module_path, $module_realdir) !== false) {
         $module_path = str_replace($module_realdir, '', $module_path);
     }
     $module_path = $module_realdir . $module_path;
     if (file_exists($module_path)) {
         return $module_path;
     }
     return false;
 }
 /**
  * Page のAction.
  *
  * @return void
  */
 function action()
 {
     $objCustomer = new SC_Customer_Ex();
     $objDb = new SC_Helper_DB_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     if (!SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $order_id = $_GET['order_id'];
     //受注データの取得
     $this->tpl_arrOrderData = $objPurchase->getOrder($order_id, $objCustomer->getValue('customer_id'));
     if (empty($this->tpl_arrOrderData)) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $this->arrShipping = $this->lfGetShippingDate($objPurchase, $order_id, $this->arrWDAY);
     $this->isMultiple = count($this->arrShipping) > 1;
     // 支払い方法の取得
     $this->arrPayment = $objDb->sfGetIDValueList('dtb_payment', 'payment_id', 'payment_method');
     // 受注商品明細の取得
     $this->tpl_arrOrderDetail = $objPurchase->getOrderDetail($order_id);
     $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);
 }
示例#3
0
 /**
  * Page のAction.
  *
  * @return void
  */
 public function action()
 {
     //決済処理中ステータスのロールバック
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
     $objCustomer = new SC_Customer_Ex();
     $objProduct = new SC_Product();
     if (!SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
         SC_Utils_Ex::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)) {
         SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
     }
     $this->arrShipping = $this->lfGetShippingDate($objPurchase, $order_id, $this->arrWDAY);
     $this->isMultiple = count($this->arrShipping) > 1;
     // 支払い方法の取得
     $this->arrPayment = SC_Helper_Payment_Ex::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'] + SC_Helper_TaxRule_Ex::calcTax($this->tpl_arrOrderDetail[$product_index]['price'], $this->tpl_arrOrderDetail[$product_index]['tax_rate'], $this->tpl_arrOrderDetail[$product_index]['tax_rule']);
         $arrTempProductDetail['price02_inctax'] = SC_Helper_TaxRule_Ex::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);
 }
 /**
  * 受注データを取得して, SC_FormParam へ設定する.
  *
  * @param SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param integer $order_id 取得元の受注ID
  * @return void
  */
 function setOrderToFormParam(&$objFormParam, $order_id)
 {
     $objPurchase = new SC_Helper_Purchase_Ex();
     // 受注詳細を設定
     $arrOrderDetail = $objPurchase->getOrderDetail($order_id, false);
     $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrOrderDetail));
     $arrShippingsTmp = $objPurchase->getShippings($order_id);
     $arrShippings = array();
     foreach ($arrShippingsTmp as $row) {
         // お届け日の処理
         if (!SC_Utils_Ex::isBlank($row['shipping_date'])) {
             $ts = strtotime($row['shipping_date']);
             $row['shipping_date_year'] = date('Y', $ts);
             $row['shipping_date_month'] = date('n', $ts);
             $row['shipping_date_day'] = date('j', $ts);
         }
         $arrShippings[$row['shipping_id']] = $row;
     }
     $objFormParam->setValue('shipping_quantity', count($arrShippings));
     $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrShippings));
     /*
      * 配送商品を設定
      *
      * $arrShipmentItem['shipment_(key)'][$shipping_id][$item_index] = 値
      * $arrProductQuantity[$shipping_id] = 配送先ごとの配送商品数量
      */
     $arrProductQuantity = array();
     $arrShipmentItem = array();
     foreach ($arrShippings as $shipping_id => $arrShipping) {
         $arrProductQuantity[$shipping_id] = count($arrShipping['shipment_item']);
         foreach ($arrShipping['shipment_item'] as $item_index => $arrItem) {
             foreach ($arrItem as $item_key => $item_val) {
                 $arrShipmentItem['shipment_' . $item_key][$shipping_id][$item_index] = $item_val;
             }
         }
     }
     $objFormParam->setValue('shipping_product_quantity', $arrProductQuantity);
     $objFormParam->setParam($arrShipmentItem);
     /*
      * 受注情報を設定
      * $arrOrderDetail と項目が重複しており, $arrOrderDetail は連想配列の値
      * が渡ってくるため, $arrOrder で上書きする.
      */
     $arrOrder = $objPurchase->getOrder($order_id);
     $objFormParam->setParam($arrOrder);
     // ポイントを設定
     list($db_point, $rollback_point) = SC_Helper_DB_Ex::sfGetRollbackPoint($order_id, $arrOrder['use_point'], $arrOrder['add_point'], $arrOrder['status']);
     $objFormParam->setValue('total_point', $db_point);
     $objFormParam->setValue('point', $rollback_point);
     if (!SC_Utils_Ex::isBlank($objFormParam->getValue('customer_id'))) {
         $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($objFormParam->getValue('customer_id'));
         $objFormParam->setValue('customer_point', $arrCustomer['point']);
     }
 }
 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();
     }
 }
 /**
  * 受注データを取得して, SC_FormParam へ設定する.
  *
  * @param  SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param  integer      $order_id     取得元の受注ID
  * @return void
  */
 public function setOrderToFormParam(&$objFormParam, $order_id)
 {
     $objPurchase = new SC_Helper_Purchase_Ex();
     // 受注詳細を設定
     $arrOrderDetail = $objPurchase->getOrderDetail($order_id, false);
     $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrOrderDetail));
     $arrShippingsTmp = $objPurchase->getShippings($order_id);
     $arrShippings = array();
     if ($arrShippingsTmp) {
         foreach ($arrShippingsTmp as $row) {
             // お届け日の処理
             if (!SC_Utils_Ex::isBlank($row['shipping_date'])) {
                 $ts = strtotime($row['shipping_date']);
                 $row['shipping_date_year'] = date('Y', $ts);
                 $row['shipping_date_month'] = date('n', $ts);
                 $row['shipping_date_day'] = date('j', $ts);
             }
             $arrShippings[$row['shipping_id']] = $row;
         }
     } else {
         // ダウンロード商品の場合はお届け先情報がないので受注詳細から必要なデータを挿入する
         foreach ($this->arrShippingKeys as $keys) {
             $arrShippings[0][$keys] = '';
         }
         foreach ($arrOrderDetail as $key => $value) {
             $arrShippings[0]['shipment_item'][$key]['shipping_id'] = $key;
             $arrShippings[0]['shipment_item'][$key]['product_class_id'] = $value['product_class_id'];
             $arrShippings[0]['shipment_item'][$key]['quantity'] = $value['quantity'];
         }
     }
     $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrShippings));
     /*
      * 配送商品を設定
      *
      * $arrShipmentItem['shipment_(key)'][$shipping_id][$item_index] = 値
      * $arrProductQuantity[$shipping_id] = お届け先ごとの配送商品数量
      */
     $arrShipmentItem = array();
     foreach ($arrShippings as $shipping_id => $arrShipping) {
         foreach ($arrShipping['shipment_item'] as $item_index => $arrItem) {
             foreach ($arrItem as $item_key => $item_val) {
                 $arrShipmentItem['shipment_' . $item_key][$shipping_id][$item_index] = $item_val;
             }
         }
     }
     $objFormParam->setParam($arrShipmentItem);
     /*
      * 受注情報を設定
      * $arrOrderDetail と項目が重複しており, $arrOrderDetail は連想配列の値
      * が渡ってくるため, $arrOrder で上書きする.
      */
     $arrOrder = $objPurchase->getOrder($order_id);
     // 生年月日の処理
     if (!SC_Utils_Ex::isBlank($arrOrder['order_birth'])) {
         $order_birth = substr($arrOrder['order_birth'], 0, 10);
         $arrOrderBirth = explode("-", $order_birth);
         $arrOrder['order_birth_year'] = intval($arrOrderBirth[0]);
         $arrOrder['order_birth_month'] = intval($arrOrderBirth[1]);
         $arrOrder['order_birth_day'] = intval($arrOrderBirth[2]);
     }
     $objFormParam->setParam($arrOrder);
     // ポイントを設定
     if (USE_POINT !== false) {
         list($db_point, $rollback_point) = SC_Helper_DB_Ex::sfGetRollbackPoint($order_id, $arrOrder['use_point'], $arrOrder['add_point'], $arrOrder['status']);
         $objFormParam->setValue('total_point', $db_point);
         $objFormParam->setValue('point', $rollback_point);
     } else {
         $objFormParam->setValue('total_point', 0);
         $objFormParam->setValue('point', 0);
     }
     if (!SC_Utils_Ex::isBlank($objFormParam->getValue('customer_id'))) {
         $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($objFormParam->getValue('customer_id'));
         $objFormParam->setValue('customer_point', $arrCustomer['point']);
     }
 }
 private function lfGetOrderData($order_id)
 {
     if (SC_Utils_Ex::sfIsInt($order_id)) {
         // DBから受注情報を読み込む
         $objPurchase = new SC_Helper_Purchase_Ex();
         $this->arrDisp = $objPurchase->getOrder($order_id);
         list($point) = SC_Helper_Customer_Ex::sfGetCustomerPoint($order_id, $this->arrDisp['use_point'], $this->arrDisp['add_point']);
         $this->arrDisp['point'] = $point;
         // 受注詳細データの取得
         $arrRet = $objPurchase->getOrderDetail($order_id);
         $arrRet = SC_Utils_Ex::sfSwapArray($arrRet);
         $this->arrDisp = array_merge($this->arrDisp, $arrRet);
         // その他支払い情報を表示
         if ($this->arrDisp['memo02'] != '') {
             $this->arrDisp['payment_info'] = unserialize($this->arrDisp['memo02']);
         }
         $this->arrDisp['payment_type'] = 'お支払い';
     }
 }
 public function __construct($order_id)
 {
     $objPurchase = new SC_Helper_Purchase_Ex();
     $this->arrOrder = $objPurchase->getOrder($order_id);
 }