private function getImportResultsResponse() { $response = NULL; try { $importId = $this->importProducts(); // The import was successful. Redirect to the status page. $response = new \Nohex\Eix\Core\Responses\Http\Redirection($this->getRequest()); $response->setNextUrl("/reports/{$importId}"); } catch (\Exception $exception) { // The import failed. $response = new \Nohex\Eix\Core\Responses\Http\Html($this->getRequest()); $response->setTemplateId('products/import'); // Set the error details. $response->addErrorMessage($exception->getMessage()); } return $response; }
private function getEndCheckoutResponse() { $customer = Customers::getCurrent(); try { // Validate additional fields. $this->updateCustomerData(); // Generate order $order = new Order(array('basket' => $customer->getBasket(), 'customer' => $customer, 'comments' => $this->getRequest()->getParameter('comments'))); // Save the new order. $order->store(); // Send a confirmation request e-mail. $order->sendConfirmationRequestMessage(); // Get rid of the customer data. $customer->destroy(); // View the order that has just been created. $response = new \Nohex\Eix\Core\Responses\Http\Redirection($this->getRequest()); $response->setNextUrl("/comandes/{$order->id}"); } catch (ValidationException $exception) { $response = $this->getHtmlResponse(); $response->setTemplateId('basket/checkout'); $response->addErrorMessage(array('validation' => $exception->getValidationStatus())); } // Add the customer data to the response. $response->addData('customer', $customer->getFieldsData()); return $response; }