Example #1
0
 /**
  * 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;
         }
     }
 }
Example #2
0
 protected function sendConfirmationMail(OnlineShop_Framework_ICart $cart, OnlineShop_Framework_AbstractOrder $order)
 {
     $params = array();
     $params["cart"] = $cart;
     $params["order"] = $order;
     $params["ordernumber"] = $order->getOrdernumber();
     if ($order->getCustomer()) {
         $params["customer"] = $order->getCustomer();
         $email = $order->getCustomer()->getEmail();
     } else {
         $tmpCustomer = new Object_Customer();
         $tmpCustomer->setEmail($order->getGuestEmail());
         $tmpCustomer->setFirstname($order->getDeliveryAddressLine1());
         $tmpCustomer->setLastname($order->getDeliveryAddressLine2());
         $params["customer"] = $tmpCustomer;
         $email = $order->getGuestEmail();
     }
     $mail = new Pimcore_Mail(array("document" => $this->confirmationMail, "params" => $params));
     $mail->addTo($email);
     $mail->send();
 }