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


PHP Customer::LoadByEmail方法代码示例

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


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

示例1: customValidation

 public function customValidation($attribute, $params)
 {
     if ($this->emailPhone != '' && $this->orderId != '') {
         $intCustomer = null;
         $objCustomer = null;
         $objCart = null;
         $found = 0;
         //Is this a customer email address, or possible an email attached to an SRO
         if (strtolower(substr($this->orderId, 0, 2)) == "s-") {
             $objSro = Sro::model()->findByAttributes(array('customer_email_phone' => $this->emailPhone, 'ls_id' => $this->orderId));
             if (!$objSro instanceof SRO) {
                 $this->addError($this->orderId, Yii::t('yii', 'Order/Email combination not found'));
                 Yii::app()->clientScript->registerScript('orderalert', 'alert("Order/Email combination not found");');
             } else {
                 $this->orderType = CartType::sro;
             }
         } else {
             //Regular Order
             $objCustomer = Customer::LoadByEmail($this->emailPhone);
             if (!$objCustomer instanceof Customer) {
                 $this->addError($this->emailPhone, Yii::t('yii', 'Email address not found'));
                 Yii::app()->clientScript->registerScript('emailalert', 'alert("Email address not found");');
             } else {
                 $objCart = Cart::model()->findByAttributes(array('id_str' => $this->orderId, 'customer_id' => $objCustomer->id));
                 if (!$objCart instanceof Cart) {
                     $this->addError($this->orderId, Yii::t('yii', 'Order/Email combination not found'));
                     Yii::app()->clientScript->registerScript('orderalert', 'alert("Order/Email combination not found");');
                 } else {
                     $this->orderType = CartType::order;
                 }
             }
         }
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:34,代码来源:LookupForm.php

示例2: validAccount

 public function validAccount($attribute, $param)
 {
     $objCustomer = Customer::LoadByEmail($this->email);
     if (!$objCustomer instanceof Customer) {
         $this->addError($attribute, Yii::t('global', 'Email address not found'));
         return;
     }
     $intQty = Yii::app()->db->createCommand("SELECT COUNT(*) from " . Wishlist::model()->tableName() . "\n\t\t\t\t\tWHERE\n\t\t\t\t\tcustomer_id=" . $objCustomer->id . " AND\n\t\t\t\t\tvisibility=" . Wishlist::PUBLICLIST . ";")->queryScalar();
     if ($intQty == 0) {
         $this->addError($attribute, Yii::t('wishlist', 'No publicly searchable wish lists for this email address.'));
         return;
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:13,代码来源:WishlistSearch.php

示例3: run

 public function run()
 {
     $model = new LookupForm();
     if (isset($_POST['LookupForm'])) {
         $model->attributes = $_POST['LookupForm'];
         if ($model->validate()) {
             //Because our validate already checks to see if it's a valid combination, we can trust loading here and just redir
             if ($model->orderType == CartType::order) {
                 $objCustomer = Customer::LoadByEmail($model->emailPhone);
                 $objCart = Cart::model()->findByAttributes(array('id_str' => $model->orderId, 'customer_id' => $objCustomer->id));
                 Yii::app()->controller->redirect($objCart->Link);
             }
             if ($model->orderType == CartType::sro) {
                 $objSro = Sro::model()->findByAttributes(array('customer_email_phone' => $model->emailPhone, 'ls_id' => $model->orderId));
                 Yii::app()->controller->redirect($objSro->Link);
             }
         }
     }
     $this->render('index', array('model' => $model));
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:20,代码来源:wsborderlookup.php

示例4: savePage

 public function savePage($page)
 {
     switch ($page) {
         case 2:
             if (!_xls_get_conf('LIGHTSPEED_CLOUD', 0) > 0) {
                 _xls_set_conf('LSKEY', strtolower(md5($this->LSKEY)));
             }
             _xls_set_conf('TIMEZONE', $this->TIMEZONE);
             Configuration::exportKeys($this->encryptionKey, $this->encryptionSalt);
             //Now that we have encryption keys written, save the account if we have it
             if (!empty($this->loginemail) && !empty($this->loginpassword)) {
                 $objCustomer = Customer::LoadByEmail($this->loginemail);
                 if (!$objCustomer instanceof Customer) {
                     $objCustomer = new Customer();
                     $objCustomer->first_name = "Admin";
                     $objCustomer->last_name = "User";
                     $objCustomer->record_type = 1;
                     $objCustomer->pricing_level = 1;
                     $objCustomer->preferred_language = "en";
                     $objCustomer->currency = "USD";
                     $objCustomer->email = $this->loginemail;
                     $objCustomer->mainphone = _xls_get_conf('STORE_PHONE');
                 }
                 $objCustomer->password = _xls_encrypt($this->loginpassword);
                 $objCustomer->allow_login = 2;
                 $objCustomer->save();
             }
             break;
         case 3:
             _xls_set_conf('STORE_NAME', $this->STORE_NAME);
             _xls_set_conf('EMAIL_FROM', $this->EMAIL_FROM);
             _xls_set_conf('STORE_ADDRESS1', $this->STORE_ADDRESS1);
             _xls_set_conf('STORE_ADDRESS2', $this->STORE_ADDRESS2);
             _xls_set_conf('STORE_CITY', $this->STORE_CITY);
             _xls_set_conf('STORE_STATE', $this->STORE_STATE);
             _xls_set_conf('STORE_COUNTRY', $this->STORE_COUNTRY);
             _xls_set_conf('STORE_ZIP', $this->STORE_ZIP);
             _xls_set_conf('STORE_HOURS', $this->STORE_HOURS);
             _xls_set_conf('STORE_PHONE', $this->STORE_PHONE);
             break;
         case 4:
             if (is_null($this->EMAIL_SMTP_SERVER)) {
                 $this->EMAIL_SMTP_SERVER = '';
             }
             if (is_null($this->EMAIL_SMTP_PORT)) {
                 $this->EMAIL_SMTP_PORT = '';
             }
             if (is_null($this->EMAIL_SMTP_USERNAME)) {
                 $this->EMAIL_SMTP_USERNAME = '';
             }
             if (is_null($this->EMAIL_SMTP_PASSWORD)) {
                 $this->EMAIL_SMTP_PASSWORD = '';
             }
             _xls_set_conf('EMAIL_SMTP_SERVER', $this->EMAIL_SMTP_SERVER);
             _xls_set_conf('EMAIL_SMTP_PORT', $this->EMAIL_SMTP_PORT);
             _xls_set_conf('EMAIL_SMTP_USERNAME', $this->EMAIL_SMTP_USERNAME);
             _xls_set_conf('EMAIL_SMTP_PASSWORD', _xls_encrypt($this->EMAIL_SMTP_PASSWORD));
             _xls_set_conf('EMAIL_SMTP_SECURITY_MODE', $this->EMAIL_SMTP_SECURITY_MODE);
             break;
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:61,代码来源:InstallForm.php

示例5: add_order

 /**
  * Add an order for display
  *
  * @param string $passkey
  * @param string $strId
  * @param int $intDttDate
  * @param int $intDttDue
  * @param string $strPrintedNotes
  * @param string $strStatus
  * @param string $strEmail
  * @param string $strPhone
  * @param string $strZipcode
  * @param int $intTaxcode
  * @param float $fltShippingSell
  * @param float $fltShippingCost
  * @return string
  */
 public function add_order($passkey, $strId, $intDttDate, $intDttDue, $strPrintedNotes, $strStatus, $strEmail, $strPhone, $strZipcode, $intTaxcode, $fltShippingSell, $fltShippingCost)
 {
     if (!$this->check_passkey($passkey)) {
         return self::FAIL_AUTH;
     }
     $objDocument = Document::LoadByIdStr($strId);
     if (!$objDocument instanceof Document) {
         $objDocument = new Document();
     } else {
         // if cart already exists then delete the items
         foreach ($objDocument->documentItems as $item) {
             $item->qty = 0;
             $item->save();
             $item->product->SetAvailableInventory();
             $item->delete();
         }
     }
     $objDocument->order_type = CartType::order;
     $objDocument->order_str = $strId;
     $objDocument->printed_notes = $strPrintedNotes;
     $objDocument->datetime_cre = date("Y-m-d H:i:s", trim($intDttDate));
     $objDocument->datetime_due = date("Y-m-d H:i:s", trim($intDttDue));
     $objDocument->fk_tax_code_id = $intTaxcode ? $intTaxcode : 0;
     $objDocument->status = $strStatus;
     $objCustomer = Customer::LoadByEmail($strEmail);
     if ($objCustomer instanceof Customer) {
         $objDocument->customer_id = $objCustomer->id;
     }
     $objCart = Cart::LoadByIdStr($strId);
     if ($objCart instanceof Cart) {
         $objDocument->cart_id = $objCart->id;
     }
     $objDocument->status = $strStatus;
     if (!$objDocument->save()) {
         Yii::log("SOAP ERROR : add_order " . print_r($objDocument->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return self::UNKNOWN_ERROR;
     }
     if ($objCart instanceof Cart) {
         $objCart->document_id = $objDocument->id;
         $objCart->save();
     }
     if (substr($strId, 0, 3) == "WO-") {
         Configuration::SetHighestWO();
     }
     return self::OK;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:63,代码来源:LegacysoapController.php

示例6: parseListOrders

 /**
  * This function will run parse an order that we get from Amazon MWS.
  * It saves orders of the customers to the DB.
  * @param $response ListOrderItemsResponse Contains the orders from Amazon
  * Marketplace WebService
  * @return void
  */
 public function parseListOrders($response)
 {
     $checkDate = date("Y-m-d", strtotime($this->amazon_check_time));
     $listOrdersResult = $response->getListOrdersResult();
     if ($listOrdersResult->isSetOrders()) {
         $orders = $listOrdersResult->getOrders();
         $orderList = $orders->getOrder();
         foreach ($orderList as $order) {
             if ($order->isSetAmazonOrderId()) {
                 $strOrderId = $order->getAmazonOrderId();
                 Yii::log("Found Amazon Order " . $strOrderId, 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                 $objCart = Cart::LoadByIdStr($strOrderId);
                 if (!$objCart instanceof Cart) {
                     //We ignore orders we've already downloaded
                     $objCart = new Cart();
                     $objCart->id_str = $strOrderId;
                     $objCart->origin = 'amazon';
                     //We mark this as just a cart, not an order, because we download the items next
                     $objCart->cart_type = CartType::cart;
                     $objOrderTotal = $order->getOrderTotal();
                     Yii::log("Order total information " . print_r($objOrderTotal, true), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                     $objCart->total = $objOrderTotal->getAmount();
                     $objCart->currency = $objOrderTotal->getCurrencyCode();
                     $objCart->status = OrderStatus::Requested;
                     $objCart->datetime_cre = $order->getPurchaseDate();
                     $objCart->modified = $order->getLastUpdateDate();
                     if (!$objCart->save()) {
                         Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
                     }
                     //Since email from is Anonymous, we probably will have to create a shell record
                     $objCustomer = Customer::LoadByEmail($order->getBuyerEmail());
                     if (!$objCustomer) {
                         $customerName = $this->_getCustomerName($order->getBuyerName());
                         $objCustomer = new Customer();
                         $objCustomer->email = $order->getBuyerEmail();
                         $objCustomer->first_name = $customerName['first_name'];
                         $objCustomer->last_name = $customerName['last_name'];
                         $objCustomer->record_type = Customer::EXTERNAL_SHELL_ACCOUNT;
                         $objCustomer->allow_login = Customer::UNAPPROVED_USER;
                         $objCustomer->save();
                     }
                     $objCart->customer_id = $objCustomer->id;
                     if (!$objCart->save()) {
                         Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
                     }
                     if ($order->isSetShippingAddress()) {
                         $shippingAddress = $order->getShippingAddress();
                         $countrycode = Country::IdByCode($shippingAddress->getCountryCode());
                         if ($shippingAddress->isSetStateOrRegion()) {
                             $objState = State::LoadByCode($shippingAddress->getStateOrRegion(), $countrycode);
                         }
                         $customerName = $this->_getCustomerName($shippingAddress->getName());
                         $config = array('address_label' => 'amazon', 'customer_id' => $objCustomer->id, 'first_name' => $customerName['first_name'], 'last_name' => $customerName['last_name'], 'address1' => $shippingAddress->getAddressLine1(), 'address2' => trim($shippingAddress->getAddressLine2() . " " . $shippingAddress->getAddressLine3()), 'city' => $shippingAddress->getCity(), 'state_id' => $objState->id, 'postal' => $shippingAddress->getPostalCode(), 'country_id' => $countrycode, 'phone' => $shippingAddress->getPhone());
                         $objCustAddress = CustomerAddress::findOrCreate($config);
                         $objCustomer->default_billing_id = $objCustAddress->id;
                         $objCustomer->default_shipping_id = $objCustAddress->id;
                         $objCustomer->save();
                         $objCart->shipaddress_id = $objCustAddress->id;
                         $objCart->billaddress_id = $objCustAddress->id;
                         //Amazon doesn't provide billing data, just dupe
                         if (!$objCart->save()) {
                             Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
                         }
                         Yii::log("Looking for destination " . $objState->country_code . " " . $objState->code . " " . $shippingAddress->getPostalCode(), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                         $objDestination = Destination::LoadMatching($objState->country_code, $objState->code, $shippingAddress->getPostalCode());
                         if ($objDestination === null) {
                             Yii::log("Did not find destination, using default in Web Store ", 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                             $objDestination = Destination::getAnyAny();
                         }
                         $objCart->tax_code_id = $objDestination->taxcode;
                         $objCart->recalculateAndSave();
                     }
                     if ($order->isSetShipServiceLevel()) {
                         $strShip = $order->getShipServiceLevel();
                         //If we have a shipping object already, update it, otherwise create it
                         if (isset($objCart->shipping)) {
                             $objShipping = $objCart->shipping;
                         } else {
                             //create
                             $objShipping = new CartShipping();
                             if (!$objShipping->save()) {
                                 Yii::log("Error saving shipping info for cart " . print_r($objShipping->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
                             }
                         }
                         if ($order->isSetShipmentServiceLevelCategory()) {
                             $strShip = $order->getShipmentServiceLevelCategory();
                         }
                         $objShipping->shipping_module = get_class($this);
                         $objShipping->shipping_data = $strShip;
                         $objShipping->shipping_method = $this->objModule->getConfig('product');
                         $objShipping->shipping_cost = 0;
                         $objShipping->shipping_sell = 0;
                         $objShipping->save();
//.........这里部分代码省略.........
开发者ID:hjlan,项目名称:webstore,代码行数:101,代码来源:wsamazon.php


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