Ejemplo n.º 1
0
 /**
  * カートの中身を選択する.
  * @param $params
  * @throws Exception
  */
 public function showCartContent($id)
 {
     $this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")");
     $cartContent = array();
     $db = Common::getMaster();
     $mCart = new TCart($db);
     $select = $mCart->select();
     $select->where("customerID = ?", $id);
     $items = $mCart->fetchAll($select)->toArray();
     if (count($items) == 0) {
         $this->_log->debug("カートの中身が存在しませんでした.");
         return $cartContent;
     }
     foreach ($items as $value) {
         $mItem = new MItemStock($db);
         $itemInfo = $mItem->itemInfo($value['itemID']);
         $itemInfo['numItem'] = $value['numItem'];
         $cartContent[] = $itemInfo;
     }
     return $cartContent;
 }
Ejemplo n.º 2
0
 /**
  * 配達リクエスト情報を返す
  * @param $requestID
  * @throws Exception
  */
 public function selectRequestInfo($requestID)
 {
     $this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")");
     $db = Common::getMaster();
     $this->_begin($db);
     try {
         $mRequest = new TRequest($db);
         $requestInfo = $mRequest->findRecord($requestID);
         // 購入合計金額を計算
         $price = 0;
         $mCart = new TCart($db);
         $select = $mCart->select();
         $select->where('customerID = ?', $requestInfo['recipientID']);
         $itemInCartInfo = $mCart->fetchAll($select)->toArray();
         foreach ($itemInCartInfo as $value) {
             $mItem = new MItemStock($db);
             $itemInfo = $mItem->itemInfo($value['itemID']);
             $itemNum = (int) $value['numItem'];
             $itemPrice = (int) $itemInfo['price'];
             $price += $itemNum * $itemPrice;
         }
         $requestInfo['price'] = $price;
     } catch (Exception $e) {
         $this->_rollBack();
         throw $e;
     }
     return $requestInfo;
 }