public function addAction() { $valid = true; $username = $_POST['username']; $password = $_POST['password']; $name = $_POST['name']; $address = $_POST['address']; $email = $_POST['email']; $delivery_address = $_POST['delivery_address']; $mailing_address = $_POST['mailing_address']; $race = $_POST['race']; $nationality = $_POST['nationality']; $passport = $_POST['passport']; $postcode = $_POST['postcode']; $city = $_POST['city']; $state = $_POST['state']; $country = $_POST['country']; $mobile = $_POST['mobile']; $gender = $_POST['gender']; $dob = $_POST['dob']; $dateofbirth = strtotime($dob); $date_ob = new Pimcore_Date($dateofbirth); $namekey = str_replace(' ', '_', $name) . "_" . strtotime(date("YmdHis")); $getRaceObj = Object_Abstract::getById($race); $getNationalityObj = Object_Abstract::getById($nationality); $getCountryObj = Object_Abstract::getById($country); $return_array = array(); // $cekuser = new Object\Customer\Listing(); // $cekuser->setCondition("username = '******'"); // if($cekuser->Count() >= 1 ) // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'username is already used'; // $return_array['data'] = ''; // $valid = false; // } // if($username == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Username is required'; // $return_array['data'] = ''; // $valid = false; // } // else if($password == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Password is required'; // $return_array['data'] = ''; // $valid = false; // } // else if($name == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Name is required'; // $return_array['data'] = ''; // $valid = false; // } // else if($address == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Address is required'; // $return_array['data'] = ''; // $valid = false; // } // else if($email == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Email is required'; // $return_array['data'] = ''; // $valid = false; // } // else if($delivery_address == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Delivery Address is required'; // $return_array['data'] = ''; // $valid = false; // } // else if($mailing_address == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Mailing Address is required'; // $return_array['data'] = ''; // $valid = false; // } // else if($race == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Race is required'; // $return_array['data'] = ''; // $valid = false; // } // else if($nationality == "") // { // $return_array['status'] = 'failed'; // $return_array['message'] = 'Nationality is required'; // $return_array['data'] = ''; // $valid = false; // } if ($valid) { $addregister = array(); $addregister = new Object_Customer(); $addregister->setUsername($username); $addregister->setPassword($password); $addregister->setName($name); $addregister->setAddress($address); $addregister->setEmailAddress($email); $addregister->setDeliveryAddress($delivery_address); $addregister->setMailingAddress($mailing_address); $addregister->setRace($getRaceObj); $addregister->setNationality($getNationalityObj); $addregister->setPassportNo($passport); $addregister->setPostcode($postcode); $addregister->setCity($city); $addregister->setState($state); $addregister->setCountry($getCountryObj); $addregister->setMobileNo($mobile); $addregister->setGender($gender); $addregister->setDob($date_ob); $getPath = Object_Abstract::getByPath('/customers'); $addregister->setKey(strtolower($namekey)); $addregister->setO_parentId($getPath->o_id); $addregister->setIndex(0); $addregister->setPublished(1); $addregister->save(); $return_array['status'] = 'success'; $return_array['message'] = 'Thank you for your registration'; $return_array['data'] = $addregister; } $json_customer = $this->_helper->json($return_array); Website_P1GlobalFunction::sendResponse($json_customer); $this->sendResponse($json_customer); }