public function checkdomainAction() { try { $session = new Zend_Session_Namespace('Default'); // Get all the params sent by the customer $params = $this->getRequest()->getParams(); // redirect the customer to the contact form if (!empty($params['mode']) && $params['mode'] == "nothing") { $this->_helper->redirector('contacts'); return true; } if (empty($params['domain']) || empty($params['tlds'])) { $this->_helper->redirector('domain', 'cart', 'default', array('mex' => 'The domain is a mandatory field. Choose a domain name.', 'status' => 'danger')); } // Get the product (tld) selected by the customer $tldInfo = DomainsTlds::getAllInfo($params['tlds']); // Check if the parameter exists in our database if (isset($tldInfo['tld_id'])) { // If the owner of the domain wants to transfer the domain ... if (!empty($params['mode']) && $params['mode'] == "link") { if (!empty($tldInfo)) { // create the domain name $domain = trim(strtolower($params['domain'])) . "." . $tldInfo['DomainsTldsData'][0]['name']; // get the hosting item added in the cart $hostingItem = $session->cart->getHostingItem(); // attach the domain name to the hosting plan if ($hostingItem) { $session->cart->attachDomain($hostingItem, $domain, $tldInfo['tld_id'], "transferDomain"); } // redirect the customer to the contact form $this->_helper->redirector('contacts'); } } else { // If the domain is still free and the customer needs to register it then ... $strDomain = $params['domain'] . "." . $tldInfo['DomainsTldsData'][0]['name']; // Check if the domain is still free $result = Domains::isAvailable($params['domain'] . "." . $tldInfo['DomainsTldsData'][0]['name']); if ($result) { // If it is free // create the domain name $domain = trim(strtolower($params['domain'])) . "." . $tldInfo['DomainsTldsData'][0]['name']; // get the hosting item added in the cart $hostingItem = $session->cart->getHostingItem(); // attach the domain name to the hosting plan if ($hostingItem) { $session->cart->attachDomain($hostingItem, $domain, $tldInfo['tld_id'], "registerDomain"); } // Redirect the user to the $this->_helper->redirector('contacts', 'cart', 'default', array('mex' => 'The domain is available for registration', 'status' => 'success')); } else { // If not redirect the customer to choose another name $this->_helper->redirector('domain', 'cart', 'default', array('mex' => 'The domain is not available for registration. Choose another domain name.', 'status' => 'danger')); } } } $this->_helper->redirector('domain', 'cart', 'default', array('mex' => 'The domain is available for registration', 'status' => 'success')); } catch (Exception $e) { $this->_helper->redirector('index', 'index', 'default', array('mex' => $e->getMessage())); } }