/** * register a new user */ public function registerAction() { // init $status = array('success' => false, 'message' => 'register failed'); // check data $list = new Object_Customer_List(); $list->setCondition('email = ?', $this->getParam('email')); if ($list->count() === 1) { // email already exsits $status['message'] = 'Email already exists'; } else { if ($this->getParam('password') != $this->getParam('confirm_password')) { // user input errors... $status['message'] = 'user input error...'; } else { // create new user $user = new Object_Customer(); $user->setFirstname($this->getParam('firstname')); $user->setLastname($this->getParam('lastname')); $user->setEmail($this->getParam('email')); $user->setPassword($this->getParam('password')); // set sys params $user->setParentId(10979); $user->setKey(Pimcore_File::getValidFilename($this->getParam('email'))); $user->setPublished(true); // done $user->save(); $status['success'] = true; $this->loginCustomer($user); } } // send output if ($this->getRequest()->isXmlHttpRequest()) { $this->_helper->viewRenderer->setNoRender(true); $this->getResponse()->setHeader('Content-Type', 'application/json'); echo Zend_Json::encode($status); } else { if ($status['success']) { $this->redirect('/en/shop'); } else { $this->enableLayout(); $this->view->status = $status; } } }