public function orderConfirmationAction() { $this->enableLayout(); $this->setLayout('email'); $this->view->user = $this->getParam('customer'); $this->view->cart = $this->getParam('cart'); $this->view->order = $this->getParam('order'); // preview if ($this->getParam('pimcore_preview') === "true") { $this->view->user = Object_Customer::getById(10980); $this->view->cart = $this->getCart(); $this->view->order = Object_OnlineShopOrder::getById(11063); # 11061 } }
protected function checkForUser() { $environment = OnlineShop_Framework_Factory::getInstance()->getEnvironment(); $userId = Zend_Auth::getInstance()->getIdentity(); $user = Object_Customer::getById($userId); if ($user) { $this->currentUser = $user; $this->view->currentUser = $user; $environment->setUseGuestCart(false); $environment->setCurrentUserId($user->getId()); $environment->save(); } else { $environment->setUseGuestCart(true); $environment->save(); } }
public function editAction() { $valid = true; $id_customer = $_POST['id_customer']; $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']; $getRaceObj = Object_Abstract::getById($race); $getNationalityObj = Object_Abstract::getById($nationality); $return_array = array(); $data; $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; } else { if ($id_customer == "") { $return_array['status'] = 'failed'; $return_array['message'] = 'ID Customer is required'; $return_array['data'] = ''; $valid = false; } else { 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) { $customer = Object_Customer::getById($id_customer); $customer->setusername($username); $customer->setpassword($password); $customer->setname($name); $customer->setaddress($address); $customer->setemailAddress($email); $customer->setdeliveryAddress($delivery_address); $customer->setmailingAddress($mailing_address); $customer->setrace($getRaceObj); $customer->setnationality($getNationalityObj); $customer->save(); $return_array['status'] = 'success'; $return_array['message'] = 'Success'; $return_array['data'] = $customer; } $json_customer = $this->_helper->json($return_array); Website_P1GlobalFunction::sendResponse($json_customer); $this->sendResponse($json_customer); }