private function updateOrder($cart, $method, $orderId)
 {
     $tblOrder = new Kutu_Core_Orm_Table_Order();
     //$row=$tblOrder->fetchNew();
     $row = array();
     $orderId = $orderId;
     $row['invoiceNumber'] = '';
     //empty invoice for first initialisation
     $row['userId'] = $this->_userInfo->userId;
     //get value from post var (store/checkout.phtml)
     if ($this->getRequest()->getPost()) {
         $value = $this->getRequest()->getPost();
         // get posted value
         $row['taxNumber'] = $value['taxNumber'];
         $row['taxCompany'] = $value['taxCompany'];
         $row['taxAddress'] = $value['taxAddress'];
         $row['taxCity'] = $value['taxCity'];
         $row['taxZip'] = $value['taxZip'];
         $row['taxProvince'] = $value['taxProvince'];
         $row['taxCountryId'] = $value['taxCountry'];
         $row['paymentMethod'] = $method;
     }
     $row['datePurchased'] = date('YmdHis');
     $row['orderStatus'] = 1;
     //pending
     $row['currency'] = $this->_defaultCurrency;
     $row['currencyValue'] = $this->_currencyValue;
     $row['orderTotal'] = $cart['grandTotal'];
     $row['orderTax'] = $cart['taxAmount'];
     $row['ipAddress'] = $this->getRealIpAddress();
     /*echo '<pre>';
     		//print_r($row);
     		echo '</pre>';*/
     $tblOrder->update($row, 'orderId = ' . $orderId);
     /*$_SESSION['_orderIdNumber'] = $orderId;
       $this->_orderIdNumber = $orderId;*/
     $tblOrderDetail = new Kutu_Core_Orm_Table_OrderDetail();
     $tblOrderDetail->delete('orderId = ' . $orderId);
     for ($iCart = 0; $iCart < count($cart['items']); $iCart++) {
         $rowDetail = $tblOrderDetail->fetchNew();
         $itemId = $cart['items'][$iCart]['itemId'];
         $rowDetail->orderId = $orderId;
         $rowDetail->itemId = $itemId;
         $rowDetail->documentName = $cart['items'][$iCart]['item_name'];
         $rowDetail->price = $cart['items'][$iCart]['itemPrice'];
         $itemPrice = $rowDetail->price;
         @($rowDetail->tax = ($cart['grandTotal'] - $cart['subTotal']) / $cart['subTotal'] * 100);
         $rowDetail->qty = $cart['items'][$iCart]['qty'];
         $rowDetail->finalPrice = $itemPrice + $itemPrice * $this->_paymentVars['taxRate'] / 100;
         $rowDetail->save();
     }
     return $orderId;
 }