本文整理汇总了PHP中Mage_Customer_Model_Customer::getEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Customer_Model_Customer::getEmail方法的具体用法?PHP Mage_Customer_Model_Customer::getEmail怎么用?PHP Mage_Customer_Model_Customer::getEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Customer_Model_Customer
的用法示例。
在下文中一共展示了Mage_Customer_Model_Customer::getEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrl
public function getUrl(Mage_Customer_Model_Customer $customer)
{
switch (Mage::helper('rewardsref')->getReferralUrlStyle()) {
case TBT_RewardsReferral_Helper_Data::REWARDSREF_URL_STYLE_EMAIL:
$url_data = array('email' => urlencode($customer->getEmail()));
break;
case TBT_RewardsReferral_Helper_Data::REWARDSREF_URL_STYLE_CODE:
$url_data = array('code' => urlencode(Mage::helper('rewardsref/code')->getCode($customer->getEmail())));
break;
default:
$url_data = array('id' => $customer->getId());
}
$url = Mage::getUrl('rewardsref/index/refer', $url_data);
return $url;
}
示例2: triggerEvent
/**
* Referral Signup trigger
*
* @param Mage_Customer_Model_Customer $customer
* @return TBT_RewardsReferral_Model_Referral_Abstract
*/
public function triggerEvent(Mage_Customer_Model_Customer $customer)
{
$this->loadByEmail($customer->getEmail());
if (!$this->getReferralParentId()) {
Mage::helper('rewardsref')->initateSessionReferral($customer);
$this->loadByEmail($customer->getEmail());
if (!$this->getReferralParentId()) {
return $this;
}
}
// update referral status
$this->setReferralChildId($customer->getId());
$this->setReferralStatus($this->getReferralStatusId());
$this->save();
$points = $this->getTotalReferralPoints();
if ($points->isEmpty()) {
return $this;
}
try {
foreach ($points->getPoints() as $currencyId => $points_amount) {
$transfer = Mage::getModel('rewardsref/transfer');
$transferStatus = Mage::getStoreConfig('rewards/InitialTransferStatus/ReferralSignup');
$transfer->create($points_amount, $currencyId, $this->getReferralParentId(), $customer->getId(), $this->getReferralTransferMessage($customer), $this->getTransferReasonId(), $transferStatus);
}
// send affiliate an email of the transaction
$affiliate = $this->getParentCustomer();
if ($affiliate->getRewardsrefNotifyOnReferral()) {
$msg = $this->getReferralTransferMessage($customer);
$this->sendConfirmation($affiliate, $customer->getEmail(), $customer->getName(), $msg, (string) $points);
}
} catch (Exception $e) {
Mage::logException($e);
}
return $this;
}
示例3: createFromCustomer
public static function createFromCustomer(Mage_Customer_Model_Customer $customer)
{
/** @var Mage_Log_Model_Customer $logCustomer */
$logCustomer = Mage::getModel('log/customer')->loadByCustomer($customer->getId());
switch ($customer->getGender()) {
case '1':
$gender = 1;
break;
case '2':
$gender = 2;
break;
default:
$gender = 0;
}
$aCustomer = new self();
$aCustomer->email = $customer->getEmail();
$aCustomer->type = 'e';
$aCustomer->gender = $gender;
$aCustomer->id = $customer->getId();
$aCustomer->first_name = $customer->getFirstname();
$aCustomer->last_name = $customer->getLastname();
if (($birthday = $customer->getDob()) !== null) {
$aCustomer->birthday = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime($birthday));
}
if (($document_id = $customer->getTaxvat()) !== null) {
$aCustomer->document_id = $document_id;
}
$aCustomer->date_joined = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime('@' . $customer->getCreatedAtTimestamp()));
if (($lastLogin = $logCustomer->getLoginAtTimestamp()) != null) {
$aCustomer->last_login = Aplazame_Sdk_Serializer_Date::fromDateTime(new DateTime('@' . $lastLogin));
}
return $aCustomer;
}
示例4: sendSubscription
public function sendSubscription(Mage_Customer_Model_Customer $parent, $destination, $destination_name)
{
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
//$template = Mage::getStoreConfig(self::XML_PATH_SUBSCRIPTION_EMAIL_TEMPLATE, $this->getStoreId());
$email = Mage::getModel('core/email_template');
/* @var $email Mage_Core_Model_Email_Template */
//$email->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()));
$template = Mage::getStoreConfig(self::XML_PATH_SUBSCRIPTION_EMAIL_TEMPLATE, Mage::app()->getStore()->getId());
$recipient = array('email' => $destination, 'name' => $destination_name);
if (Mage::helper('core')->isModuleEnabled('Aschroder_SMTPPro')) {
$sender = Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_EMAIL_IDENTITY);
} else {
$sender = array('name' => strip_tags($parent->getFirstname() . ' ' . $parent->getLastname()), 'email' => strip_tags($parent->getEmail()));
}
/* $sender = array(
'name' => strip_tags($parent->getFirstname().' '.$parent->getLastname()),
'email' => strip_tags($parent->getEmail())
);
*/
$real_url = Mage::getUrl('rewardpoints/index/goReferral', array("referrer" => $parent->getId()));
$used_url = Mage::getUrl('', array("referral-program" => str_replace('/', '-', base64_encode($parent->getId() . 'j2t'))));
$email->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId()))->sendTransactional($template, $sender, $recipient['email'], $recipient['name'], array('parent' => $parent, 'referral' => $this, 'store_name' => Mage::getModel('core/store')->load(Mage::app()->getStore()->getCode())->getName(), 'referral_url' => $used_url));
$translate->setTranslateInline(true);
return $email->getSentSuccess();
}
示例5: systemLog
/**
*
* @param Mage_Customer_Model_Customer $customer
* @param string $pointsString
* @param type $date
*/
public function systemLog($customer, $pointsString, $date)
{
$storeId = $customer->getStoreId();
if ($this->_getHelper()->isLogBirthdayEnabled($storeId)) {
$name = $customer->getName();
$email = $customer->getEmail();
$msg = $this->_getHelper()->__("Customer %s with the e-mail %s has a birthday on %s and been rewarded %s.", $name, $email, $date, $pointsString);
Mage::log($msg, null, $this->getLogFileName());
}
}
示例6: setCustomer
/**
* Set the customer account (if any) for the card.
*/
public function setCustomer(Mage_Customer_Model_Customer $customer, Mage_Payment_Model_Info $payment = null)
{
if ($customer->getEmail() != '') {
$this->setCustomerEmail($customer->getEmail());
/**
* Make an ID if we don't have one (and hope this doesn't break anything)
*/
if ($customer->getId() < 1) {
$customer->save();
}
$this->setCustomerId($customer->getId());
parent::setCustomer($customer);
} elseif (!is_null($payment)) {
$model = null;
/**
* If we have no email, try to find it from current scope data.
*/
if ($payment->getQuote() != null && $payment->getQuote()->getBillingAddress() != null && $payment->getQuote()->getBillingAddress()->getCustomerEmail() != '') {
$model = $payment->getQuote();
} elseif ($payment->getOrder() != null && ($payment->getOrder()->getCustomerEmail() != '' || $payment->getOrder()->getBillingAddress() != null && $payment->getOrder()->getBillingAddress()->getCustomerEmail() != '')) {
$model = $payment->getOrder();
} else {
/**
* This will fall back to checkout/session if onepage has no quote loaded.
* Should work for all checkouts that use normal Magento processes.
*/
$model = Mage::getSingleton('checkout/type_onepage')->getQuote();
}
if (!is_null($model)) {
if ($model->getCustomerEmail() == '' && $model->getBillingAddress() instanceof Varien_Object && $model->getBillingAddress()->getEmail() != '') {
$model->setCustomerEmail($model->getBillingAddress()->getEmail());
}
if ($model->hasEmail()) {
$this->setCustomerEmail($model->getEmail());
} elseif ($model->hasCustomerEmail()) {
$this->setCustomerEmail($model->getCustomerEmail());
}
$this->setCustomerId(intval($model->getCustomerId()));
}
}
return $this;
}
示例7: send
/**
* Send customer email
*
* @return bool
*/
public function send()
{
if (is_null($this->_website) || is_null($this->_customer)) {
return false;
}
if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
return false;
}
if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
return false;
}
$store = $this->_website->getDefaultStore();
$storeId = $store->getId();
if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
return false;
} elseif ($this->_type == 'stock' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId)) {
return false;
}
// set design parameters, required for email (remember current)
$currentDesign = Mage::getDesign()->setAllGetOld(array('store' => $storeId, 'area' => 'frontend', 'package' => Mage::getStoreConfig('design/package/name', $storeId)));
Mage::app()->getLocale()->emulate($storeId);
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
if ($this->_type == 'price') {
$this->_getPriceBlock()->setStore($store)->reset();
foreach ($this->_priceProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getPriceBlock()->addProduct($product);
}
$block = $this->_getPriceBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
} elseif ($this->_type == 'stock') {
$this->_getStockBlock()->setStore($store)->reset();
foreach ($this->_stockProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getStockBlock()->addProduct($product);
}
$block = $this->_getStockBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
} else {
Mage::app()->getLocale()->revert();
return false;
}
Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional($templateId, Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_customer->getEmail(), $this->_customer->getName(), array('customerName' => $this->_customer->getName(), 'alertGrid' => $block));
$translate->setTranslateInline(true);
// revert current design
Mage::getDesign()->setAllGetOld($currentDesign);
Mage::app()->getLocale()->revert();
return true;
}
示例8: syncCustomer
public function syncCustomer(Mage_Customer_Model_Customer $customer)
{
if (!($email = $customer->getEmail())) {
return false;
}
$this->load($email);
if (!$this->getId()) {
$this->setEmail($email);
}
$this->setName($customer->getName());
$this->save();
$this->cleanCache();
return true;
}
示例9: loadByCustomer
/**
* Load subscriber by customer
*
* @param Mage_Customer_Model_Customer $customer
* @return array
*/
public function loadByCustomer(Mage_Customer_Model_Customer $customer)
{
$select = $this->_read->select()->from($this->getMainTable())->where('customer_id=:customer_id');
Mage::fireLog($customer->getId(), "loadByCustomer");
$result = $this->_read->fetchRow($select, array('customer_id' => $customer->getId()));
if ($result) {
return $result;
}
$select = $this->_read->select()->from($this->getMainTable())->where('subscriber_email=:subscriber_email');
$result = $this->_read->fetchRow($select, array('subscriber_email' => $customer->getEmail()));
if ($result) {
return $result;
}
return array();
}
示例10: sendCustomerNotification
public function sendCustomerNotification(Mage_Customer_Model_Customer $customer, $store_id, $points, $point_model, $sender, $email_template = null)
{
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
$email = Mage::getModel('core/email_template');
$template = Mage::getStoreConfig(self::XML_PATH_CUSTOMER_NOTIFICATION_EMAIL_TEMPLATE, $store_id);
if ($email_template != null) {
$template = $email_template;
}
$recipient = array('email' => $customer->getEmail(), 'name' => $customer->getName());
//$sender = Mage::getStoreConfig(self::XML_PATH_NOTIFICATION_EMAIL_IDENTITY, $store_id);
$email->setDesignConfig(array('area' => 'frontend', 'store' => $store_id))->sendTransactional($template, $sender, $recipient['email'], $recipient['name'], array('points' => $points, 'customer' => $customer, 'point_model' => $point_model, 'store_name' => Mage::getModel('core/store')->load(Mage::app()->getStore($store_id)->getCode())->getName()));
$translate->setTranslateInline(true);
return $email->getSentSuccess();
}
示例11: sendSubscription
public function sendSubscription(Mage_Customer_Model_Customer $parent, $destination, $destination_name)
{
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
//$template = Mage::getStoreConfig(self::XML_PATH_SUBSCRIPTION_EMAIL_TEMPLATE, $this->getStoreId());
$email = Mage::getModel('core/email_template');
/* @var $email Mage_Core_Model_Email_Template */
//$email->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()));
$template = Mage::getStoreConfig(self::XML_PATH_SUBSCRIPTION_EMAIL_TEMPLATE, Mage::app()->getStore()->getId());
$recipient = array('email' => $destination, 'name' => $destination_name);
$sender = array('name' => strip_tags($parent->getFirstname() . ' ' . $parent->getLastname()), 'email' => strip_tags($parent->getEmail()));
$email->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId()))->sendTransactional($template, $sender, $recipient['email'], $recipient['name'], array('parent' => $parent, 'referral' => $this, 'store_name' => Mage::getModel('core/store')->load(Mage::app()->getStore()->getCode())->getName()));
$translate->setTranslateInline(true);
return $email->getSentSuccess();
}
示例12: send
/**
* Send customer email
*
* @return bool
*/
public function send()
{
if (is_null($this->_website) || is_null($this->_customer)) {
return false;
}
if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
return false;
}
if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
return false;
}
$storeId = $this->_website->getDefaultGroup()->getDefaultStore()->getId();
$storeCode = $this->_website->getDefaultGroup()->getDefaultStore()->getCode();
if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
return false;
} elseif ($this->_type == 'stock' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId)) {
return false;
}
Mage::getDesign()->setStore($storeId);
Mage::getDesign()->setArea('frontend');
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
if ($this->_type == 'price') {
$this->_getPriceBlock()->setStoreCode($storeCode);
foreach ($this->_priceProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getPriceBlock()->addProduct($product);
}
$block = $this->_getPriceBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
} elseif ($this->_type == 'stock') {
$this->_getStockBlock()->setStoreCode($storeCode);
foreach ($this->_stockProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getStockBlock()->addProduct($product);
}
$block = $this->_getStockBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
} else {
return false;
}
Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional($templateId, Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_customer->getEmail(), $this->_customer->getName(), array('customerName' => $this->_customer->getName(), 'alertGrid' => $block));
$translate->setTranslateInline(true);
return true;
}
示例13: send
/**
* Send customer email
*
* @return bool
*/
public function send()
{
if (is_null($this->_website) || is_null($this->_customer)) {
return false;
}
if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
return false;
}
if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
return false;
}
$store = Mage::getModel('core/store')->load($this->_customer->getStoreId());
$storeId = $store->getId();
if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
return false;
} elseif ($this->_type == 'stock' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId)) {
return false;
}
if ($this->_type != 'price' && $this->_type != 'stock') {
return false;
}
$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
Mage::app()->getTranslator()->init('frontend', true);
if ($this->_type == 'price') {
$this->_getPriceBlock()->setStore($store)->reset();
foreach ($this->_priceProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getPriceBlock()->addProduct($product);
}
$block = $this->_getPriceBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
} else {
$this->_getStockBlock()->setStore($store)->reset();
foreach ($this->_stockProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getStockBlock()->addProduct($product);
}
$block = $this->_getStockBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
}
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional($templateId, Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_customer->getEmail(), $this->_customer->getName(), array('customerName' => $this->_customer->getName(), 'alertGrid' => $block));
return true;
}
示例14: addTransaction
/**
* Add transaction that change customer reward point balance
*
* @param string $actionCode
* @param Mage_Customer_Model_Customer $customer
* @param type $object
* @param array $extraContent
* @return Magestore_RewardPoints_Model_Transaction
*/
public function addTransaction($actionCode, $customer, $object = null, $extraContent = array())
{
Varien_Profiler::start('REWARDPOINTS_HELPER_ACTION::addTransaction');
if (!$customer->getId()) {
throw new Exception($this->__('Customer must be existed.'));
}
$actionModel = $this->getActionModel($actionCode);
/** @var $actionModel Magestore_RewardPoints_Model_Action_Interface */
$actionModel->setData(array('customer' => $customer, 'action_object' => $object, 'extra_content' => $extraContent))->prepareTransaction();
$transaction = Mage::getModel('rewardpoints/transaction');
if (is_array($actionModel->getData('transaction_data'))) {
$transaction->setData($actionModel->getData('transaction_data'));
}
$transaction->setData('point_amount', (int) $actionModel->getPointAmount());
if (!$transaction->hasData('store_id')) {
$transaction->setData('store_id', Mage::app()->getStore()->getId());
}
$transaction->createTransaction(array('customer_id' => $customer->getId(), 'customer' => $customer, 'customer_email' => $customer->getEmail(), 'title' => $actionModel->getTitle(), 'action' => $actionCode, 'action_type' => $actionModel->getActionType(), 'created_time' => now(), 'updated_time' => now()));
Varien_Profiler::stop('REWARDPOINTS_HELPER_ACTION::addTransaction');
return $transaction;
}
示例15: loadByCustomer
/**
* Load subscriber by customer
*
* @param Mage_Customer_Model_Customer $customer
* @return array
*/
public function loadByCustomer(Mage_Customer_Model_Customer $customer)
{
$select = $this->_read->select()->from($this->_subscriberTable)->where('customer_id=?', $customer->getId());
$result = $this->_read->fetchRow($select);
if ($result) {
return $result;
}
$select = $this->_read->select()->from($this->_subscriberTable)->where('subscriber_email=?', $customer->getEmail());
$result = $this->_read->fetchRow($select);
if ($result) {
return $result;
}
return array();
}