/** * Create a new order on the fly */ public function createorderAction() { $session = new Zend_Session_Namespace('Default'); if (!empty($session->customer)) { $profile = $session->customer; // Destroy the redirect option unset($session->goto); if (empty($session->cart)) { $session->cart = new Cart(); } // Get the temporary domains $domains = DomainsBulk::findbySession(Zend_Session::getId()); if (!empty($domains)) { // Create the base order document // $theOrder = Orders::create($profile['customer_id']); foreach ($domains as $domain) { $Thedomain = $domain['domain'] . "." . $domain['DomainsTlds']['DomainsTldsData'][0]['name']; $action = $domain['isavailable'] ? "registerDomain" : "transferDomain"; $price = $domain['price']; $cost = $domain['cost']; $authcode = !empty($domain['authinfo']) ? $domain['authinfo'] : null; $session->cart->addDomain($Thedomain, $domain['tld_id'], $action, $authcode); } // Clear the temporary list before adding the new one DomainsBulk::clear(Zend_Session::getId()); // Redirect the user to the order detail page $this->_helper->redirector('summary', 'cart', 'default', array('mex' => 'Order created successfully', 'status' => 'success')); } } else { // Create the redirection $session->goto = array('action' => 'createorder', 'controller' => 'domainschk', 'module' => 'default', 'options' => array()); $this->_helper->redirector('signup', 'customer', 'default', array('mex' => 'You have to login or create a new account profile to go on.', 'status' => 'success')); } }
/** * bulkdomainsorderAction * Check the availability for each domain. */ public function bulkdomainsorderAction() { $form = new Default_Form_BulkdomainsorderForm(array('action' => '/common/createbulkorder', 'method' => 'post')); $session = new Zend_Session_Namespace('Default'); if ($session->customer) { $domains = DomainsBulk::findbyCustomerID($session->customer['customer_id']); } else { $domains = DomainsBulk::findbySession(Zend_Session::getId()); } $this->view->domains = $domains; $this->view->form = $form; $this->getHelper('layout')->setLayout('1column'); }