当前位置: 首页>>代码示例>>PHP>>正文


PHP Customer::getByEmail方法代码示例

本文整理汇总了PHP中Customer::getByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::getByEmail方法的具体用法?PHP Customer::getByEmail怎么用?PHP Customer::getByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Customer的用法示例。


在下文中一共展示了Customer::getByEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initContent

    /**
     * @see FrontController::initContent()
     */
    public function initContent()
    {
        parent::initContent();
        if ($this->context->customer->isLogged()) {
            Tools::redirect('index.php?controller=my-account');
        }
        $fb_connect_appid = Configuration::get('FB_CONNECT_APPID');
        $fb_connect_appkey = Configuration::get('FB_CONNECT_APPKEY');
        $this->redirect_uri = $this->context->link->getModuleLink('fbconnect_psb', 'registration', array('done' => 1), TRUE, $this->context->language->id);
        require_once _PS_ROOT_DIR_ . '/modules/fbconnect_psb/fb_sdk/facebook.php';
        $facebook = new Facebook(array('appId' => $fb_connect_appid, 'secret' => $fb_connect_appkey));
        // Get User ID
        $user = $facebook->getUser();
        // We may or may not have this data based on whether the user is logged in.
        //
        // If we have a $user id here, it means we know the user is logged into
        // Facebook, but we don't know if the access token is valid. An access
        // token is invalid if the user logged out of Facebook.
        if ($user) {
            try {
                // Proceed knowing you have a logged in user who's authenticated.
                $fb_user_profile = $facebook->api('/me');
            } catch (FacebookApiException $e) {
                //die('Error: '.$e);
                error_log($e);
                $user = null;
            }
        } else {
            // Get new Access tokens
            Tools::redirect($facebook->getLoginUrl(array('scope' => 'email')));
        }
        // if user's FB account is linked than log the user in
        if (isset($fb_user_profile['id'])) {
            $sql = 'SELECT `id_customer`
				FROM `' . _DB_PREFIX_ . 'customer_profile_connect`
				WHERE `facebook_id` = \'' . (int) $fb_user_profile['id'] . '\'' . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER);
            if (Db::getInstance()->getValue($sql)) {
                Tools::redirect($this->context->link->getModuleLink('fbconnect_psb', 'login', array(), TRUE, $this->context->language->id));
            }
        }
        if (Tools::getValue('done')) {
            $response = $facebook->getSignedRequest($_REQUEST['signed_request']);
            $reg_metadata_fields = '[{"name":"name"},{"name":"first_name"},{"name":"last_name"},{"name":"email"},{"name":"password"},{"name":"birthday"},{"name":"gender"}]';
            $reg_metadata_fields_clean = preg_replace('/\\s+/', '', $reg_metadata_fields);
            $response_metadata_fields_clean = preg_replace('/\\s+/', '', $response['registration_metadata']['fields']);
            if (strcmp($reg_metadata_fields_clean, $response_metadata_fields_clean) != 0) {
                $this->errors[] = Tools::displayError('registration metadata fields not valid');
            }
            $response_email = trim($response['registration']['email']);
            if (empty($response_email)) {
                $this->errors[] = Tools::displayError('An email address required.');
            } else {
                if (!Validate::isEmail($response_email)) {
                    $this->errors[] = Tools::displayError('Invalid email address.');
                } else {
                    if (Customer::customerExists($response_email)) {
                        // Need to clean up the code here most of it is from
                        // IDFBCon_v.0.2 (Chandra R. Atmaja <chandra.r.atmaja@gmail.com>)
                        // Someone has already registered with this e-mail address
                        // This will link the 1st existing email/account on site with Facebook
                        // and log the user in to the account. Is this safe?
                        $customer = new Customer();
                        $authentication = $customer->getByEmail($response['registration']['email']);
                        // This is done to see if a existing users try's to re-registrar
                        $sql = 'SELECT `facebook_id`
					FROM `' . _DB_PREFIX_ . 'customer_profile_connect`
					WHERE `id_customer` = \'' . (int) $customer->id . '\' ' . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER);
                        $customer_fb_id = Db::getInstance()->getValue($sql);
                        if ($customer_fb_id) {
                            if ($customer_fb_id == (int) $response['user_id']) {
                                Tools::redirect($this->context->link->getModuleLink('fbconnect_psb', 'login', array(), false, $this->context->language->id));
                            } else {
                                $this->errors[] = Tools::displayError('An error occurred while linking your Facebook account.');
                            }
                        } else {
                            if (Db::getInstance()->insert('customer_profile_connect', array('id_customer' => (int) $customer->id, 'facebook_id' => (int) $response['user_id']))) {
                                $this->errors[] = Tools::displayError('an error occurred while linking your Facebook account.');
                            }
                            $customer->active = 1;
                            $customer->deleted = 0;
                            $this->context->cookie->id_customer = intval($customer->id);
                            $this->context->cookie->customer_lastname = $customer->lastname;
                            $this->context->cookie->customer_firstname = $customer->firstname;
                            $this->context->cookie->logged = 1;
                            $this->context->cookie->passwd = $customer->passwd;
                            $this->context->cookie->email = $customer->email;
                            if (Configuration::get('PS_CART_FOLLOWING') and (empty($this->context->cookie->id_cart) or Cart::getNbProducts($this->context->cookie->id_cart) == 0)) {
                                $this->context->cookie->id_cart = intval(Cart::lastNoneOrderedCart(intval($customer->id)));
                            }
                            Module::hookExec('authentication');
                            if ($back = Tools::getValue('back')) {
                                Tools::redirect($back);
                            }
                            Tools::redirect('index.php?controller=my-account');
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:codingang,项目名称:PrestaShop-modules-fbConnect_psb,代码行数:101,代码来源:registration.php

示例2: changePassword

 protected function changePassword()
 {
     $token = Tools::getValue('token');
     $id_customer = (int) Tools::getValue('id_customer');
     if ($email = Db::getInstance()->getValue('SELECT `email` FROM ' . _DB_PREFIX_ . 'customer c WHERE c.`secure_key` = \'' . pSQL($token) . '\' AND c.id_customer = ' . $id_customer)) {
         $customer = new Customer();
         $customer->getByEmail($email);
         if (!Validate::isLoadedObject($customer)) {
             $this->errors[] = $this->trans('Customer account not found', array(), 'Shop.Notifications.Error');
         } elseif (!$customer->active) {
             $this->errors[] = $this->trans('You cannot regenerate the password for this account.', array(), 'Shop.Notifications.Error');
         }
         // Case if both password params not posted or different, then "change password" form is not POSTED, show it.
         if (!Tools::isSubmit('passwd') || !Tools::isSubmit('confirmation') || ($passwd = Tools::getValue('passwd')) !== ($confirmation = Tools::getValue('confirmation')) || !Validate::isPasswd($passwd) || !Validate::isPasswd($confirmation)) {
             // Check if passwords are here anyway, BUT does not match the password validation format
             if (Tools::isSubmit('passwd') || Tools::isSubmit('confirmation')) {
                 $this->errors[] = $this->trans('The password and its confirmation do not match.', array(), 'Shop.Notifications.Error');
             }
             $this->context->smarty->assign(['customer_email' => $customer->email, 'customer_token' => $token, 'id_customer' => $id_customer, 'reset_token' => Tools::getValue('reset_token')]);
             $this->setTemplate('customer/password-new');
         } else {
             // Both password fields posted. Check if all is right and store new password properly.
             if (!Tools::getValue('reset_token') || strtotime($customer->last_passwd_gen . '+' . (int) Configuration::get('PS_PASSWD_TIME_FRONT') . ' minutes') - time() > 0) {
                 Tools::redirect('index.php?controller=authentication&error_regen_pwd');
             } else {
                 // To update password, we must have the temporary reset token that matches.
                 if ($customer->getValidResetPasswordToken() !== Tools::getValue('reset_token')) {
                     $this->errors[] = $this->trans('The password change request expired. You should ask for a new one.', array(), 'Shop.Notifications.Error');
                 } else {
                     try {
                         $crypto = new Hashing();
                     } catch (\PrestaShop\PrestaShop\Adapter\CoreException $e) {
                         $this->errors[] = $this->trans('An error occurred with your account, which prevents us from updating the new password. Please report this issue using the contact form.', array(), 'Shop.Notifications.Error');
                         return false;
                     }
                     $customer->passwd = $crypto->encrypt($password = Tools::getValue('passwd'), _COOKIE_KEY_);
                     $customer->last_passwd_gen = date('Y-m-d H:i:s', time());
                     if ($customer->update()) {
                         Hook::exec('actionPasswordRenew', array('customer' => $customer, 'password' => $password));
                         $customer->removeResetPasswordToken();
                         $customer->update();
                         $mail_params = ['{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname];
                         if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                             $this->context->smarty->assign(['customer_email' => $customer->email]);
                             $this->success[] = $this->trans('Your password has been successfully reset and a confirmation has been sent to your email address: %s', array($customer->email), 'Shop.Notifications.Success');
                             $this->context->updateCustomer($customer);
                             $this->redirectWithNotifications('index.php?controller=my-account');
                         } else {
                             $this->errors[] = $this->trans('An error occurred while sending the email.', array(), 'Shop.Notifications.Error');
                         }
                     } else {
                         $this->errors[] = $this->trans('An error occurred with your account, which prevents us from updating the new password. Please report this issue using the contact form.', array(), 'Shop.Notifications.Error');
                     }
                 }
             }
         }
     } else {
         $this->errors[] = $this->trans('We cannot regenerate your password with the data you\'ve submitted', array(), 'Shop.Notifications.Error');
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:60,代码来源:PasswordController.php

示例3: init

 public function init()
 {
     parent::init();
     /*
      * Piqué dans le AuthController. J'aurais bien aimé utiliser le AuthController, mais le premier contrôle dans son init()
      * c'est pour vérifier si l'utilisateur est loggé ou non, ce qui mettait à plat ma stratégie.
      *
      * Je me suis posé la question 'Faut il que ca marche pour des admin ?', j'ai supposé que non,
      * mais s'il avait fallu, il suffisait de tester un 'Employee' en plus d'un 'Customer'
      */
     $passwd = trim(Tools::getValue('passwd'));
     $_POST['passwd'] = null;
     $email = trim(Tools::getValue('email'));
     if (!empty($email) && Validate::isEmail($email) && !empty($passwd) && Validate::isPasswd($passwd)) {
         $customer = new Customer();
         $authentication = $customer->getByEmail(trim($email), trim($passwd));
         if (isset($authentication->active) && $authentication->active && $customer->id) {
             Tools::redirect(Configuration::get("ADMIN_TAB_MODULE_URLBACK"));
         }
     }
     /*
      * Ici, je ne suis vraiment pas satisfait de la méthode employée, je trouve ça plutôt crade
      * de transmettre des infos sur les erreurs via un param en GET, mais dans l'immédiat je n'ai pas trouvé mieux
      */
     Tools::redirect("index.php?urlback_haserror=1");
 }
开发者ID:ArnaudBenassy,项目名称:abenassyurlback,代码行数:26,代码来源:URLBack.php

示例4: getCustomerIdByEmailAndPassword

 /**
  * @param $email
  * @param $password
  * @return int
  */
 public function getCustomerIdByEmailAndPassword($email, $password)
 {
     /** @var CustomerCore $customer */
     $customer = new Customer();
     /** @var CustomerCore $authentication */
     $authentication = $customer->getByEmail(trim($email), trim($password));
     return $authentication->id;
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:13,代码来源:Customer.php

示例5: unsubscribe

 /**
  * 
  * @param array $event
  */
 public function unsubscribe(array $event)
 {
     if (!array_key_exists('email', $event)) {
         return false;
     }
     if (!$event['email']) {
         return false;
     }
     $customerClass = new Customer();
     $customer = $customerClass->getByEmail($event['email']);
     if ($customer) {
         $customer->newsletter = 0;
         $customer->update();
     }
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:19,代码来源:Events.php

示例6: submit

 public function submit()
 {
     if ($this->validate()) {
         Hook::exec('actionAuthenticationBefore');
         $customer = new Customer();
         $authentication = $customer->getByEmail($this->getValue('email'), $this->getValue('password'));
         if (isset($authentication->active) && !$authentication->active) {
             $this->errors[''][] = $this->translator->trans('Your account isn\'t available at this time, please contact us', [], 'Shop.Notifications.Error');
         } elseif (!$authentication || !$customer->id || $customer->is_guest) {
             $this->errors[''][] = $this->translator->trans('Authentication failed.', [], 'Shop.Notifications.Error');
         } else {
             $this->context->updateCustomer($customer);
             Hook::exec('actionAuthentication', ['customer' => $this->context->customer]);
             // Login information have changed, so we check if the cart rules still apply
             CartRule::autoRemoveFromCart($this->context);
             CartRule::autoAddToCart($this->context);
         }
     }
     return !$this->hasErrors();
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:20,代码来源:CustomerLoginForm.php

示例7: runPage

 protected function runPage()
 {
     if (WebRequest::wasPosted()) {
         if (!($email = WebRequest::postString("lgEmail"))) {
             // no email address specified
             $this->redirect("noemail");
             return;
         }
         if (!($password = WebRequest::postString("lgPasswd"))) {
             // no password specified
             $this->redirect("nopass");
             return;
         }
         $cust = Customer::getByEmail($email);
         if ($cust == null) {
             // customer doesn't exist. offer to signup or retry?
             $this->redirect("invalid");
             return;
         }
         if (!$cust->isMailConfirmed()) {
             // customer hasn't confirmed their email
             $this->redirect("noconfirm");
             return;
         }
         if (!$cust->authenticate($password)) {
             // not a valid password
             $this->redirect("invalid");
             return;
         }
         // seems to be ok.
         // set up the session
         Session::setLoggedInCustomer($cust->getId());
         // redirect back to the main page.
         $this->redirect();
     } else {
         // urm, something's not quite right here...
         // redirect back to the main page.
         $this->mHeaders[] = "HTTP/1.1 303 See Other";
         $this->mHeaders[] = "Location: " . $cWebPath . "/index.php";
     }
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:41,代码来源:PageLogin.php

示例8: postProcess

 public function postProcess()
 {
     global $currentIndex;
     if (Tools::getValue('submitAdd' . $this->table)) {
         /* Checking fields validity */
         $this->validateRules();
         if (!sizeof($this->_errors)) {
             $id = intval(Tools::getValue('id_' . $this->table));
             if (isset($id) and !empty($id)) {
                 if ($this->tabAccess['edit'] !== '1') {
                     $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
                 } else {
                     $object = new $this->className($id);
                     if (Validate::isLoadedObject($object)) {
                         $customer_email = strval(Tools::getValue('email'));
                         // check if e-mail already used
                         if ($customer_email != $object->email) {
                             $customer = new Customer();
                             $customer->getByEmail($customer_email);
                             if ($customer->id) {
                                 $this->_errors[] = Tools::displayError('an account already exists for this e-mail address:') . ' ' . $customer_email;
                             }
                         }
                         // Updating customer's group
                         if (!sizeof($this->_errors)) {
                             $groupList = Tools::getValue('groupBox');
                             $object->cleanGroups();
                             if (is_array($groupList) and sizeof($groupList) > 0) {
                                 $object->addGroups($groupList);
                             }
                         }
                     } else {
                         $this->_errors[] = Tools::displayError('an error occurred while loading object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
                     }
                 }
             }
         }
     }
     return parent::postProcess();
 }
开发者ID:redb,项目名称:prestashop,代码行数:40,代码来源:AdminCustomers.php

示例9: registerCustomer

 /**
  * @param $user
  * @param $pass
  * @param ShopgateCustomer $customer
  * @throws ShopgateLibraryException
  */
 public function registerCustomer($user, $pass, ShopgateCustomer $customer)
 {
     if (!Validate::isEmail($user)) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_REGISTER_CUSTOMER_ERROR, 'E-mail Address validation error', true);
     }
     if ($pass && !Validate::isPasswd($pass)) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_REGISTER_CUSTOMER_ERROR, 'Password validation error', true);
     }
     /** @var CustomerCore | Customer $customerModel */
     $customerModel = new Customer();
     if ($customerModel->getByEmail($user)) {
         throw new ShopgateLibraryException(ShopgateLibraryException::REGISTER_USER_ALREADY_EXISTS);
     }
     $customerModel->active = 1;
     $customerModel->lastname = $customer->getLastName();
     $customerModel->firstname = $customer->getFirstName();
     $customerModel->email = $user;
     $customerModel->passwd = Tools::encrypt($pass);
     $customerModel->id_gender = $this->mapGender($customer->getGender());
     $customerModel->birthday = $customer->getBirthday();
     $customerModel->newsletter = $customer->getNewsletterSubscription();
     $shopgateCustomFieldsHelper = new ShopgateCustomFieldsHelper();
     $shopgateCustomFieldsHelper->saveCustomFields($customerModel, $customer->getCustomFields());
     $validateMessage = $customerModel->validateFields(false, true);
     if ($validateMessage !== true) {
         throw new ShopgateLibraryException(ShopgateLibraryException::REGISTER_FAILED_TO_ADD_USER, $validateMessage, true);
     }
     $customerModel->save();
     /**
      * addresses
      */
     foreach ($customer->getAddresses() as $address) {
         $this->createAddress($address, $customerModel);
     }
     return $customerModel->id;
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:42,代码来源:Json.php

示例10: sendTest

 private function sendTest($recipient)
 {
     if (!empty($this->session_api->account_id) && $this->session_api->account_id > 0) {
         $last_tester = new Customer();
         // 1 - On ajoute le destinataire du test dans la liste du mailing en cours
         // -----------------------------------------------------------------------
         if ($last_tester->getByEmail((string) $recipient)) {
             $response_array = array();
             $parameters = array('account_id' => $this->session_api->account_id, 'list_id' => $this->campaign_infos['campaign_api_list_id'], 'recipients' => array(array('target' => $last_tester->email, 'lastname' => $last_tester->lastname, 'firstname' => $last_tester->firstname)));
             $this->session_api->call('email', 'recipients', 'add', $parameters, $response_array);
         }
         // 2 - On envoi un test au destinataire
         /// -----------------------------------
         $response_array = array();
         $parameters = array('account_id' => $this->session_api->account_id, 'campaign_id' => $this->campaign_infos['campaign_api_message_id'], 'list_id' => $this->campaign_infos['campaign_api_list_id'], 'recipient' => $recipient);
         if ($this->session_api->call('email', 'campaign', 'send_test', $parameters, $response_array)) {
             $this->confirmations[] = sprintf($this->module->l('An email as been sent to : %s', 'adminmarketingestep7'), $recipient);
             return true;
         }
     }
     $this->errors[] = sprintf($this->module->l('Error during communication with Express-Mailing API : %s', 'adminmarketingestep7'), $this->session_api->getError());
     return false;
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:23,代码来源:adminmarketingestep7.php

示例11: _expressCheckout

 /**
  * When the customer is back from PayPal after filling his/her credit card info or credentials, this function is preparing the order
  * PayPal is providing us with the customer info (E-mail address, billing address) and we are trying to find a matching customer in the Shop database.
  * If no customer is found, we create a new one and we simulate a logged customer session.
  * Eventually it will redirect the customer to the "Shipping" step/page of the order process
  */
 private function _expressCheckout()
 {
     /* We need to double-check that the token provided by PayPal is the one expected */
     $result = $this->paypal_usa->postToPayPal('GetExpressCheckoutDetails', '&TOKEN=' . urlencode(Tools::getValue('token')));
     if ((strtoupper($result['ACK']) == 'SUCCESS' || strtoupper($result['ACK']) == 'SUCCESSWITHWARNING') && $result['TOKEN'] == Tools::getValue('token') && $result['PAYERID'] == Tools::getValue('PayerID')) {
         /* Checks if a customer already exists for this e-mail address */
         if (Validate::isEmail($result['EMAIL'])) {
             $customer = new Customer();
             $customer->getByEmail($result['EMAIL']);
         }
         /* If the customer does not exist yet, create a new one */
         if (!Validate::isLoadedObject($customer)) {
             $customer = new Customer();
             $customer->email = $result['EMAIL'];
             $customer->firstname = $result['FIRSTNAME'];
             $customer->lastname = $result['LASTNAME'];
             $customer->passwd = Tools::encrypt(Tools::passwdGen());
             $customer->add();
         }
         /* Look for an existing PayPal address for this customer */
         $addresses = $customer->getAddresses((int) Configuration::get('PS_LANG_DEFAULT'));
         foreach ($addresses as $address) {
             if ($address['alias'] == 'PayPal') {
                 $id_address = (int) $address['id_address'];
                 break;
             }
         }
         /* Create or update a PayPal address for this customer */
         $address = new Address(isset($id_address) ? (int) $id_address : 0);
         $address->id_customer = (int) $customer->id;
         $address->id_country = (int) Country::getByIso($result['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE']);
         $address->id_state = (int) State::getIdByIso($result['PAYMENTREQUEST_0_SHIPTOSTATE'], (int) $address->id_country);
         $address->alias = 'PayPal';
         $address->lastname = substr($result['PAYMENTREQUEST_0_SHIPTONAME'], 0, strpos($result['PAYMENTREQUEST_0_SHIPTONAME'], ' '));
         $address->firstname = substr($result['PAYMENTREQUEST_0_SHIPTONAME'], strpos($result['PAYMENTREQUEST_0_SHIPTONAME'], ' '), strlen($result['PAYMENTREQUEST_0_SHIPTONAME']) - strlen($address->lastname));
         $address->address1 = $result['PAYMENTREQUEST_0_SHIPTOSTREET'];
         if ($result['PAYMENTREQUEST_0_SHIPTOSTREET2'] != '') {
             $address->address2 = $result['PAYMENTREQUEST_0_SHIPTOSTREET2'];
         }
         $address->city = $result['PAYMENTREQUEST_0_SHIPTOCITY'];
         $address->postcode = $result['PAYMENTREQUEST_0_SHIPTOZIP'];
         $address->save();
         /* Update the cart billing and delivery addresses */
         $this->context->cart->id_address_delivery = (int) $address->id;
         $this->context->cart->id_address_invoice = (int) $address->id;
         $this->context->cart->update();
         /* Update the customer cookie to simulate a logged-in session */
         $this->context->cookie->id_customer = (int) $customer->id;
         $this->context->cookie->customer_lastname = $customer->lastname;
         $this->context->cookie->customer_firstname = $customer->firstname;
         $this->context->cookie->passwd = $customer->passwd;
         $this->context->cookie->email = $customer->email;
         $this->context->cookie->is_guest = $customer->isGuest();
         $this->context->cookie->logged = 1;
         /* Save the Payer ID and Checkout token for later use (during the payment step/page) */
         $this->context->cookie->paypal_express_checkout_token = $result['TOKEN'];
         $this->context->cookie->paypal_express_checkout_payer_id = $result['PAYERID'];
         if (_PS_VERSION_ < '1.5') {
             Module::hookExec('authentication');
         } else {
             Hook::exec('authentication');
         }
         /* Redirect the use to the "Shipping" step/page of the order process */
         Tools::redirectLink($this->context->link->getPageLink('order.php', false, null, array('step' => '3')));
         exit;
     } else {
         foreach ($result as $key => $val) {
             $result[$key] = urldecode($val);
         }
         $this->context->smarty->assign('paypal_usa_errors', $result);
         $this->setTemplate('express-checkout-messages.tpl');
     }
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:79,代码来源:expresscheckout.php

示例12: getCustomerByEmail

 protected function getCustomerByEmail($email, $register = false, $lastName = null, $firstName = null, $emailAddress = null)
 {
     $customer = new Customer();
     $customer->getByEmail($email);
     if (!Validate::isLoadedObject($customer) && $register) {
         if (PowaTagAPI::apiLog()) {
             PowaTagLogs::initAPILog('Create customer', PowaTagLogs::IN_PROGRESS, 'Customer : ' . $lastName . ' ' . $firstName);
         }
         $customer->lastname = $lastName;
         $customer->firstname = $firstName;
         $customer->email = $emailAddress;
         $customer->setWsPasswd(Tools::substr($customer->lastname, 0, 1) . $firstName);
         if (!$customer->save()) {
             $this->addError($this->module->l('Impossible to save customer'), PowaTagErrorType::$INTERNAL_ERROR);
             if (PowaTagAPI::apiLog()) {
                 PowaTagLogs::initAPILog('Create customer', PowaTagLogs::ERROR, $this->error['message']);
             }
             return false;
         }
         if (PowaTagAPI::apiLog()) {
             PowaTagLogs::initAPILog('Create customer', PowaTagLogs::SUCCESS, 'Customer ID : ' . $customer->id);
         }
     }
     return $customer;
 }
开发者ID:powa,项目名称:prestashop-extension,代码行数:25,代码来源:PowaTagAbstract.php

示例13: processUpdate

    public function processUpdate()
    {
        if (Validate::isLoadedObject($this->object)) {
            $customer_email = strval(Tools::getValue('email'));
            // check if e-mail already used
            if ($customer_email != $this->object->email) {
                $customer = new Customer();
                if (Validate::isEmail($customer_email)) {
                    $customer->getByEmail($customer_email);
                }
                if ($customer->id && $customer->id != (int) $this->object->id) {
                    $this->errors[] = Tools::displayError('An account already exists for this email address:') . ' ' . $customer_email;
                }
            }
            return parent::processUpdate();
        } else {
            $this->errors[] = Tools::displayError('An error occurred while loading the object.') . '
				<b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
        }
    }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:20,代码来源:AdminCustomersController.php

示例14: runPage

 protected function runPage()
 {
     if (WebRequest::wasPosted()) {
         if (!WebRequest::postInt("calroom")) {
             $this->showCal();
             return;
         }
         $startdate = new DateTime(WebRequest::post("qbCheckin"));
         $enddate = new DateTime(WebRequest::post("qbCheckout"));
         $room = Room::getById(WebRequest::postInt("calroom"));
         for ($date = $startdate; $date < $enddate; $date->modify("+1 day")) {
             if (!$room->isAvailable($date)) {
                 $this->error("room-not-available");
                 $this->showCal();
                 return;
             }
         }
         // search for customer
         if (!($customer = Customer::getByEmail(WebRequest::post("qbEmail")))) {
             $customer = new Customer();
             $suTitle = WebRequest::post("qbTitle");
             $suFirstname = WebRequest::post("qbFirstname");
             $suLastname = WebRequest::post("qbLastname");
             $suAddress = WebRequest::post("qbAddress");
             $suCity = WebRequest::post("qbCity");
             $suPostcode = WebRequest::post("qbPostcode");
             $suCountry = WebRequest::post("qbCountry");
             $suEmail = WebRequest::post("qbEmail");
             $customer->setPassword($suEmail);
             // set values
             $customer->setTitle($suTitle);
             $customer->setFirstname($suFirstname);
             $customer->setSurname($suLastname);
             $address = new Address();
             $address->setLine1($suAddress);
             $address->setCity($suCity);
             $address->setPostCode($suPostcode);
             $address->setCountry($suCountry);
             $address->save();
             $customer->setAddress($address);
             $customer->setEmail($suEmail);
             // save it
             $customer->save();
             $customer->sendMailConfirm();
             // save it again
             $customer->save();
         }
         $booking = new Booking();
         $booking->setStartDate(WebRequest::post("qbCheckin"));
         $booking->setEndDate(WebRequest::post("qbCheckout"));
         $booking->setAdults(WebRequest::post("qbAdults"));
         $booking->setChildren(WebRequest::post("qbChildren"));
         $booking->setPromocode(WebRequest::post("qbPromoCode"));
         $booking->setRoom($room->getId());
         $booking->setCustomer($customer->getId());
         $booking->save();
         $msg = Message::getMessage("booking-confirmation");
         $msg = str_replace("\$1", $booking->getStartDate(), $msg);
         $msg = str_replace("\$2", $booking->getEndDate(), $msg);
         $msg = str_replace("\$3", $booking->getAdults(), $msg);
         $msg = str_replace("\$4", $booking->getChildren(), $msg);
         $msg = str_replace("\$5", $booking->getRoom()->getName(), $msg);
         Mail::send($customer->getEmail(), Message::getMessage("booking-confimation-subject"), $msg);
         $this->mSmarty->assign("content", $msg);
         return;
     }
     throw new YouShouldntBeDoingThatException();
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:68,代码来源:PageCalendar.php

示例15: array

     $xml = $webService->get(array('url' => PS_SHOP_PATH . 'api/customers?schema=blank'));
     $resources = $xml->children()->children();
     $resources->id_default_group = 3;
     $resources->passwd = $customer->passwd;
     $resources->lastname = $customer->lastname;
     $resources->firstname = $customer->firstname;
     $resources->email = $customer->email;
     $resources->is_guest = 0;
     $resources->active = 1;
     $resources->associations->groups->group->id = 3;
     //$xml = $webService->add($opt);
     $opt = array('resource' => 'customers');
     $opt['postXml'] = $xml->asXML();
     $xml = $webService->add($opt);
     $cookieCustomer = new Customer();
     $cookieCustomer->getByEmail($customer->email);
     $cookie->id_customer = intval($cookieCustomer->id);
     $cookie->customer_lastname = $cookieCustomer->lastname;
     $cookie->customer_firstname = $cookieCustomer->firstname;
     $cookie->logged = 1;
     $cookie->passwd = $cookieCustomer->passwd;
     $cookie->email = $cookieCustomer->email;
     if (Configuration::get('PS_CART_FOLLOWING') and (empty($cookie->id_cart) or Cart::getNbProducts($cookie->id_cart) == 0)) {
         $cookie->id_cart = intval(Cart::lastNoneOrderedCart(intval($customer->id)));
     }
 } catch (PrestaShopWebserviceException $e) {
     // Here we are dealing with errors
     $trace = $e->getTrace();
     if ($trace[0]['args'][0] == 404) {
         echo 'Bad ID';
     } else {
开发者ID:addshoppers,项目名称:PrestaShop,代码行数:31,代码来源:create.php


注:本文中的Customer::getByEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。