public function ajaxCitiesAction() { if ($this->_isXmlHttpRequest) { $this->getHelper('viewRenderer')->setNoRender(); $stateId = $this->_getParam('stateId'); $filter = $this->_getParam('filter'); $cities = new CitiesObject(); /* * if $filter = true(1) then only display cities having * retailers else list all the cities for registration for * example. */ if ($filter) { $cities->setFilter(true); } $citiesData = $cities->getCitiesDataByStates($stateId); foreach ($citiesData as $id => $data) { $citiesData[$id]['C_Name'] = $data['C_Name']; } echo json_encode($citiesData); } }
public function ajaxAction() { $action = $this->_getParam('actionAjax'); switch ($action) { case 'citiesList': $this->disableView(); $value = $this->_getParam('q'); $limit = $this->_getParam('limit'); $oCity = new CitiesObject(); if (!empty($value)) { $data = $oCity->autocompleteSearch($value, $this->getCurrentInterfaceLanguage(), $limit); } foreach ($data as $value) { echo $value['C_Name'] . "\n"; } break; default: break; } }
public function ajaxAction() { $this->getHelper('viewRenderer')->setNoRender(); $action = $this->_getParam('actionAjax'); if ($action == 'lostPassword') { $email = $this->_getParam('email'); if (empty($email)) { echo json_encode(array('result' => 'fail', 'message' => 'email missing')); return; } $profile = new MemberProfile(); $user = $profile->findMember(array('email' => $email)); if ($user) { $password = Cible_FunctionsGeneral::generatePassword(); $profile->updateMember($user['member_id'], array('password' => md5($password), 'hash' => '')); $data = array('PASSWORD' => $password); $options = array('send' => true, 'isHtml' => true, 'to' => $email, 'event' => 'newPassword', 'type' => 'email', 'recipient' => 'client', 'data' => $data); $oNotification = new Cible_Notifications_Email($options); } else { echo json_encode(array('result' => 'fail', 'message' => utf8_encode($this->view->getClientText('lost_password_email_not_found')))); return; } echo json_encode(array('result' => 'success', 'message' => utf8_encode($this->view->getClientText('lost_password_sent')))); } elseif ($action == 'citiesList') { $this->disableView(); $value = $this->_getParam('q'); $limit = $this->_getParam('limit'); $oCity = new CitiesObject(); if (!empty($value)) { $data = $oCity->autocompleteSearch($value, $this->getCurrentInterfaceLanguage(), $limit); } foreach ($data as $value) { echo $value['C_Name'] . "\n"; } exit; } elseif ($action == 'updateSessionVar') { $quoteRequestOrderVar['shippingShipperName'] = $this->_getParam('shippingShipperName'); $quoteRequestOrderVar['shippingMethod'] = $this->_getParam('shippingMethod'); $quoteRequestOrderVar['shippingAccountNumber'] = $this->_getParam('shippingAccountNumber'); $quoteRequestOrderVar['shippingComment'] = $this->_getParam('shippingComment'); $quoteRequestOrderVar['shippingShipToADifferentAddress'] = $this->_getParam('shippingShipToADifferentAddress'); $quoteRequestOrderVar['lastName'] = $this->_getParam('lastName'); $quoteRequestOrderVar['firstName'] = $this->_getParam('firstName'); $quoteRequestOrderVar['company'] = $this->_getParam('company'); $quoteRequestOrderVar['address'] = $this->_getParam('address'); $quoteRequestOrderVar['city'] = $this->_getParam('city'); $quoteRequestOrderVar['state'] = $this->_getParam('state'); $quoteRequestOrderVar['country'] = $this->_getParam('country'); $quoteRequestOrderVar['zipCode'] = $this->_getParam('zipCode'); $quoteRequestOrderVar['phone'] = $this->_getParam('phone'); $quoteRequestOrderVar['poNumber'] = $this->_getParam('poNumber'); $quoteRequestOrderVar['projectName'] = $this->_getParam('projectName'); $quoteRequestOrderVar['contactMe'] = $this->_getParam('contactMe'); $quoteRequestOrderVar['newsletterSubscription'] = $this->_getParam('newsletterSubscription'); $quoteRequestOrderVar['termsAgreement'] = $this->_getParam('termsAgreement'); //echo(utf8_decode($quoteRequestOrderVar['lastName'])); $quoteRequestOrder = new Zend_Session_Namespace('quoteRequestOrderVar'); foreach ($quoteRequestOrderVar as $key => $value) { $quoteRequestOrder->{$key} = utf8_decode($value); } echo json_encode(array('result' => '')); } }