/** * 受注を完了する. * * 下記のフローで受注を完了する. * * 1. トランザクションを開始する * 2. カートの内容を検証する. * 3. 受注一時テーブルから受注データを読み込む * 4. ユーザーがログインしている場合はその他の発送先へ登録する * 5. 受注データを受注テーブルへ登録する * 6. トランザクションをコミットする * * 実行中に, 何らかのエラーが発生した場合, 処理を中止しエラーページへ遷移する * * 決済モジュールを使用する場合は対応状況を「決済処理中」に設定し, * 決済完了後「新規受付」に変更すること * * @param integer $orderStatus 受注処理を完了する際に設定する対応状況 * @return void */ function completeOrder($orderStatus = ORDER_NEW) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $objSiteSession = new SC_SiteSession_Ex(); $objCartSession = new SC_CartSession_Ex(); $objCustomer = new SC_Customer_Ex(); $customerId = $objCustomer->getValue('customer_id'); $objQuery->begin(); if (!$objSiteSession->isPrePage()) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSession); } $uniqId = $objSiteSession->getUniqId(); $this->verifyChangeCart($uniqId, $objCartSession); $orderTemp = $this->getOrderTemp($uniqId); $orderTemp['status'] = $orderStatus; $cartkey = $objCartSession->getKey(); $orderId = $this->registerOrderComplete($orderTemp, $objCartSession, $cartkey); $isMultiple = SC_Helper_Purchase::isMultiple(); $shippingTemp =& $this->getShippingTemp($isMultiple); foreach ($shippingTemp as $shippingId => $val) { $this->registerShipmentItem($orderId, $shippingId, $val['shipment_item']); } $this->registerShipping($orderId, $shippingTemp); $objQuery->commit(); //会員情報の最終購入日、購入合計を更新 if ($customerId > 0) { SC_Customer_Ex::updateOrderSummary($customerId); } $this->cleanupSession($orderId, $objCartSession, $objCustomer, $cartkey); GC_Utils_Ex::gfFrontLog("order complete. customerId=" . $customerId); }
/** * ログ出力を行う. * * ログイン中の顧客IDを含めてログ出力します. * * @access protected * @param string $mess ログメッセージ * @param string $log_level ログレベル("Info" or "Debug") * @return void */ function log($mess, $log_level) { $mess = $mess . " user=" . $_SESSION['customer']['customer_id']; GC_Utils_Ex::gfFrontLog($mess, $log_level); }