/**
  * 受注データを取得して, 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']);
     }
 }
 /**
  * 受注データを取得して, 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']);
     }
 }
예제 #3
0
 /**
  * 受注お届け先情報の取得
  *
  * @param SC_Helper_Purchase_Ex $objPurchase object SC_Helper_Purchaseクラス
  * @param $order_id integer 注文番号
  * @param $arrWDAY array 曜日データの配列
  * @return array お届け先情報
  */
 public function lfGetShippingDate(&$objPurchase, $order_id, $arrWDAY)
 {
     $arrShipping = $objPurchase->getShippings($order_id);
     foreach ($arrShipping as $shipping_index => $shippingData) {
         foreach ($shippingData as $key => $val) {
             if ($key == 'shipping_date' && SC_Utils_Ex::isBlank($val) == false) {
                 // お届け日を整形
                 list($y, $m, $d, $w) = explode(' ', date('Y m d w', strtotime($val)));
                 $arrShipping[$shipping_index]['shipping_date'] = sprintf('%04d/%02d/%02d(%s)', $y, $m, $d, $arrWDAY[$w]);
             }
         }
     }
     return $arrShipping;
 }