本文整理汇总了PHP中Mage_Customer_Model_Customer::loadByEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Customer_Model_Customer::loadByEmail方法的具体用法?PHP Mage_Customer_Model_Customer::loadByEmail怎么用?PHP Mage_Customer_Model_Customer::loadByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Customer_Model_Customer
的用法示例。
在下文中一共展示了Mage_Customer_Model_Customer::loadByEmail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadByEmail
public function loadByEmail($customerEmail)
{
if ('forgotpasswordpost' == Mage::app()->getRequest()->getActionName()) {
// Forgot Password
if (!Mage::getStoreConfig('amcustomerattr/forgot/disable_email') || !Mage::getStoreConfig('amcustomerattr/forgot/forgot_field')) {
parent::loadByEmail($customerEmail);
if ($this->getId()) {
// customer found by e-mail, no need to load by attribute
return $this;
}
}
if (Mage::getStoreConfig('amcustomerattr/forgot/forgot_field')) {
// will try to load by attribute
$attribute = Mage::getModel('customer/attribute')->load(Mage::getStoreConfig('amcustomerattr/forgot/forgot_field'), 'attribute_code');
if ($attribute->getId()) {
$this->_getResource()->loadByAttribute($this, $customerEmail, $attribute);
}
}
} else {
// Login
$logged = false;
if (!Mage::getStoreConfig('amcustomerattr/login/disable_email') || !Mage::getStoreConfig('amcustomerattr/login/login_field')) {
parent::loadByEmail($customerEmail);
if ($this->getId()) {
// customer found by e-mail, no need to load by attribute
$logged = true;
}
}
if (Mage::getStoreConfig('amcustomerattr/login/login_field') && !$logged) {
// will try to load by attribute
$attribute = Mage::getModel('customer/attribute')->load(Mage::getStoreConfig('amcustomerattr/login/login_field'), 'attribute_code');
if ($attribute->getId()) {
$this->_getResource()->loadByAttribute($this, $customerEmail, $attribute);
}
}
/*
* check if activated user logged in or not
*/
$activated = Mage::getModel('customer/customer')->load($this->getId())->getAmIsActivated();
$activated = $activated === null ? 0 : $activated;
// just created user without any activation mark
$activationRequired = Mage::getStoreConfig('amcustomerattr/activation/activation_required', $this->getStoreId());
$loginForm = Mage::app()->getRequest()->getPost('login');
if (($activated == self::ACTIVATION_STATUS_PENDING && $activationRequired || $activated == self::ACTIVATION_STATUS_DEACTIVATED) && $loginForm) {
// user tries to log in (otherwise we're logged in already and we've changed user via admin panel or etc)
Mage::getSingleton('customer/session')->addError(Mage::helper('amcustomerattr')->__('Account is not active yet.'));
$this->setIsLoggedIn(true);
Mage::getSingleton('core/session')->logout();
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'));
return $this;
}
}
return $this;
}
示例2: getNextId
public function getNextId()
{
//Payment method codes using Order Id Creation
$cod = 'C';
// Cash On Delivery
$chod = 'H';
// Cheque On Delivery
$credit = 'F';
// Credit Normal
$payu = 'P';
//PayU Payment Method
$neft = 'N';
// Bank Transfer
$corporate = 'X';
// Corporate Companies
if (strpos($last, $this->getPrefix()) === 0) {
$last = (int) substr($last, strlen($this->getPrefix()));
} else {
$last = (int) $last;
}
$date = date("ymd", Mage::app()->getLocale()->storeTimeStamp(1));
// Get Current date
if (Mage::app()->getStore()->isAdmin()) {
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
if ($quote->getId()) {
$paymentcode = $quote->getPayment()->getMethodInstance()->getCode();
// Get Payment method from Quote
} else {
//Admin Invoice and Shipment Id generation
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$result = $write->query("SELECT temp.rnd FROM sales_flat_order c,(SELECT FLOOR((RAND()*999999999)) AS rnd FROM sales_flat_order LIMIT 0,25) AS temp\n\t\t\t\t\t\t\t WHERE c.increment_id NOT IN (temp.rnd) LIMIT 1");
$random = $result->fetch();
$next = $random['rnd'];
return $this->format($next);
}
} else {
$quote = Mage::getSingleton('checkout/session')->getQuote();
Mage::Log("Numeric.php : quote in session is " . $quote->getId());
if ($quote->getId()) {
$paymentcode = $quote->getPayment()->getMethodInstance()->getCode();
// Get Payment method from Quote
} else {
//PayU Orders
$customer = Mage::getSingleton('customer/session')->getCustomer();
if ($customer->getId()) {
$cust = new Mage_Customer_Model_Customer();
//$cust->setEmail($customer->getEmail())->save();
$cust->loadByEmail($customer->getEmail())->save();
return;
} else {
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$result = $write->query("SELECT temp.rnd FROM sales_flat_order c,(SELECT FLOOR((RAND()*999999999)) AS rnd FROM sales_flat_order LIMIT 0,25) AS temp\n\t\t\t\t\t\t\t WHERE c.increment_id NOT IN (temp.rnd) LIMIT 1");
$random = $result->fetch();
$next = $random['rnd'];
return $this->format($next);
}
}
}
if ($paymentcode == 'cashondelivery') {
$payCode = $cod;
} elseif ($paymentcode == 'checkmo') {
$payCode = $chod;
} elseif ($paymentcode == 'payucheckout_shared') {
$payCode = $payu;
} elseif ($paymentcode == 'rcredit') {
$payCode = $credit;
} elseif ($paymentcode == 'bankpayment') {
$payCode = $neft;
}
$orderIdVal = $date . $payCode . "-";
//$next = $last+1;
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
//$result= $write->query("SELECT temp.rnd FROM sales_flat_order c,(SELECT CONCAT('".$orderIdVal."',FLOOR((RAND()*99999))) AS rnd FROM sales_flat_order LIMIT 0,25) AS temp
//WHERE c.increment_id NOT IN (temp.rnd) LIMIT 1");
$result = $write->query("SELECT temp.rnd FROM sales_flat_order c,(SELECT CONCAT('" . $orderIdVal . "',FLOOR((RAND()*(99999-10000)+10000))) AS rnd FROM sales_flat_order LIMIT 0,25) AS temp\n \t\t WHERE c.increment_id NOT IN (temp.rnd) LIMIT 1");
$random = $result->fetch();
$next = $random['rnd'];
return $this->format($next);
}
示例3: getNextId
public function getNextId()
{
$cod = 'C';
// Cash On Delivery
$chod = 'H';
// Cheque On Delivery
$credit = 'F';
// Credit Normal
$zcredit = 'Z';
// Credit Normal
$payu = 'P';
//PayU Payment Method
$neft = 'N';
// Bank Transfer
$corporate = 'X';
// Corporate Companies
$mobikwik = 'M';
// Mobikwik
$free = 'A';
// Zero Checkout
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$date = date("ymd", Mage::app()->getLocale()->storeTimeStamp(1));
// Get Current date
if (Mage::app()->getStore()->isAdmin()) {
$quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
if ($quote->getId()) {
$paymentcode = $quote->getPayment()->getMethodInstance()->getCode();
// Get Payment method from Quote
}
} else {
$quote = Mage::getSingleton('checkout/session')->getQuote();
if ($quote->getId()) {
//$paymentcode = $quote->getPayment()->getMethodInstance()->getCode(); // Get Payment method from Quote
if (Mage::getSingleton('checkout/session')->getPayRandomVal() == 0) {
$paymentcode = $quote->getPayment()->getMethodInstance()->getCode();
// Get Payment method from Quote
Mage::getSingleton('checkout/session')->setPayPaymentVal($paymentcode);
} else {
$paymentcode = Mage::getSingleton('checkout/session')->getPayPaymentVal();
Mage::getSingleton('checkout/session')->unsPayPaymentVal();
}
} else {
$customer = Mage::getSingleton('customer/session')->getCustomer();
if ($customer->getId()) {
$cust = new Mage_Customer_Model_Customer();
//$cust->setEmail($customer->getEmail())->save();
$cust->loadByEmail($customer->getEmail())->save();
return;
}
}
}
if ($paymentcode == 'cashondelivery') {
$payCode = $cod;
} elseif ($paymentcode == 'checkmo') {
$payCode = $chod;
} elseif ($paymentcode == 'payucheckout_shared') {
$payCode = $payu;
} elseif ($paymentcode == 'payumoney_shared') {
$payCode = $payu;
} elseif ($paymentcode == 'rcredit') {
$payCode = $credit;
} elseif ($paymentcode == 'zcredit') {
$payCode = $zcredit;
} elseif ($paymentcode == 'bankpayment') {
$payCode = $neft;
} elseif ($paymentcode == 'wallet') {
$payCode = $mobikwik;
} elseif ($paymentcode == 'free') {
$payCode = $free;
}
$orderIdVal = $date . $payCode . "-";
$last = $this->getLastId();
if (strpos($last, '-') !== false) {
$result = $write->query("SELECT order_id FROM sales_order_randid ORDER BY randorder_id DESC LIMIT 1");
$orderID = $result->fetch();
if ($orderID['order_id'] == '') {
$rand = rand(1000, 9999);
$query = "INSERT INTO sales_order_randid (order_id) VALUES ('" . $rand . "')";
$write->query($query);
$next = $orderIdVal . $rand . "01";
return $this->format($next);
} else {
$randorderId = $orderID['order_id'];
$splitdash = substr($last, -6);
$splitlast2digit = substr($splitdash, -2);
$splitdash3digit = substr($last, -6, 4);
if ($randorderId == $splitdash3digit) {
if ($splitlast2digit < 19) {
//$last = (int)$last;
$lastOrderId = explode('-', $last);
$last1 = (int) $lastOrderId[1];
$last = $last1 + 1;
$next = $orderIdVal . $last;
return $this->format($next);
} else {
for ($i = 0; $i < 5; $i++) {
$rand = rand(1000, 9999);
$result = $write->query("SELECT order_id FROM sales_order_randid WHERE order_id = '" . $rand . "'");
$orderID = $result->fetch();
if ($orderID['order_id'] == '') {
//.........这里部分代码省略.........
示例4: loadByEmail
public function loadByEmail($customerEmail)
{
if ('forgotpasswordpost' == Mage::app()->getRequest()->getActionName()) {
return parent::loadByEmail($customerEmail);
}
if (!Mage::getStoreConfig('amcustomerattr/login/disable_email') || !Mage::getStoreConfig('amcustomerattr/login/login_field')) {
parent::loadByEmail($customerEmail);
if ($this->getId()) {
// customer found by e-mail, no need to load by attribute
return $this;
}
}
if (Mage::getStoreConfig('amcustomerattr/login/login_field')) {
// will try to load by attribute
$attribute = Mage::getModel('customer/attribute')->load(Mage::getStoreConfig('amcustomerattr/login/login_field'), 'attribute_code');
if ($attribute->getId()) {
$this->_getResource()->loadByAttribute($this, $customerEmail, $attribute);
}
}
return $this;
}