public function mergeAction()
 {
     if ($this->getRequest()->isPost()) {
         $fromTable = $this->params()->fromPost('fromTable');
         $toOrderId = $this->params()->fromPost('toTable');
         $orderDetailModel = $this->modelOrderDetail->findBy(array('orderId' => $fromTable));
         if (!empty($orderDetailModel) && $fromTable != $toOrderId) {
             foreach ($orderDetailModel as $orderDetail) {
                 $orderDetail->setOrderId($toOrderId);
                 $this->modelOrderDetail->edit($orderDetail);
             }
             $orderFrom = $this->modelOrder->findOneBy(array('id' => $fromTable));
             $totalCostFrom = $orderFrom->getTotalCost();
             $totalRealCostFrom = $orderFrom->getTotalRealCost();
             $orderTo = $this->modelOrder->findOneBy(array('id' => $toOrderId));
             $finalTotalRealCost = $orderTo->getTotalCost() + $totalCostFrom;
             $orderTo->setTotalCost($finalTotalRealCost);
             $finalTotalRealCost = Utility::getPriceUseCoupon($finalTotalRealCost, $orderTo->getCouponId());
             $finalTotalRealCost = Utility::getPriceUseSurtax($finalTotalRealCost, $orderTo->getSurtaxId());
             $orderTo->setTotalRealCost($finalTotalRealCost);
             $this->modelOrder->edit($orderTo);
             $this->modelOrder->delete(array('id' => $fromTable));
             $this->flashMessenger()->addSuccessMessage('Merge order success!');
             return $this->redirect()->toRoute('frontend/child', array('controller' => 'order', 'action' => 'add'));
         } else {
             $this->flashMessenger()->addErrorMessage('Opp! Something Wrong, pls try again...');
             return $this->redirect()->toRoute('frontend/child', array('controller' => 'order', 'action' => 'add'));
         }
     }
 }