Example #1
0
 public function customer()
 {
     $Customer = ShoppOrder()->Customer;
     $updates = array('firstname' => $this->form('firstname'), 'lastname' => $this->form('lastname'), 'company' => $this->form('company'), 'email' => $this->form('email'), 'phone' => $this->form('phone'), 'info' => $this->form('info'), 'marketing' => $this->form('marketing'), 'password' => $this->form('password', true), 'loginname' => $this->form('loginname', true));
     // Remove invalid characters from the phone number
     $updates['phone'] = preg_replace('/[^\\d\\(\\)\\-+\\. (ext|x)]/', '', $updates['phone']);
     if (empty($Customer)) {
         $Customer = new ShoppCustomer();
     } else {
         $Customer->reset();
     }
     $Customer->updates($updates);
     // Keep confirm-password field value when showing checkout validation errors
     $confirmpass = $this->form('confirm-password', true);
     if (!empty($confirmpass)) {
         $Customer->_confirm_password = $confirmpass;
     }
 }