本文整理汇总了PHP中Mage_Customer_Model_Customer::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Customer_Model_Customer::getName方法的具体用法?PHP Mage_Customer_Model_Customer::getName怎么用?PHP Mage_Customer_Model_Customer::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Customer_Model_Customer
的用法示例。
在下文中一共展示了Mage_Customer_Model_Customer::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
}
示例2: registerCustomerInfo
/**
* Get Customer Info
*
* @param Mage_Customer_Model_Customer $customer got customer
* @return void
*/
public function registerCustomerInfo($customer)
{
/**
* @var $customer Mage_Customer_Model_Customer
*/
if ($customer) {
$telephone = $customer->getData('oc_telephone');
$name = $customer->getName();
Mage::register('customer_name', $name);
Mage::register('customer_phone', $telephone);
}
}
示例3: 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;
}
示例4: 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;
}
示例5: 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();
}
示例6: 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;
}
示例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 = 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;
}
示例8: getCustomerData
/**
* Create array of customer values for API
*
* @param Mage_Customer_Model_Customer $customer
* @return array
*/
public function getCustomerData(Mage_Customer_Model_Customer $customer)
{
try {
if ($primaryBillingAddress = $customer->getPrimaryBillingAddress()) {
$address = implode(', ', $primaryBillingAddress->getStreet());
$state = $customer->getPrimaryBillingAddress()->getRegion();
$zipcode = $customer->getPrimaryBillingAddress()->getPostcode();
} else {
$address = '';
$state = '';
$zipcode = '';
}
$data = array('id' => $customer->getEmail(), 'key' => 'email', 'fields' => array('keys' => 1), 'keysconfict' => 'merge', 'vars' => array('id' => $customer->getId(), 'name' => $customer->getName(), 'suffix' => $customer->getSuffix() ? $customer->getSuffix() : '', 'prefix' => $customer->getPrefix() ? $customer->getPrefix() : '', 'firstName' => $customer->getFirstname(), 'middleName' => $customer->getMiddlename() ? $customer->getMiddlename() : '', 'lastName' => $customer->getLastname(), 'address' => $address, 'storeID' => $customer->getStoreId(), 'groupId' => $customer->getGroupId(), 'taxClassId' => $customer->getTaxClassId(), 'createdAt' => date("Y-m-d H:i:s", $customer->getCreatedAtTimestamp()), 'primaryBillingAddress' => $this->getAddress($customer->getPrimaryBillingAddress()), 'defaultBillingAddress' => $this->getAddress($customer->getDefaultBillingAddress()), 'defaultShippingAddress' => $this->getAddress($customer->getDefaultShippingAddress()), 'state' => $state, 'zipCode' => $zipcode), 'lists' => array(Mage::helper('sailthruemail')->getMasterList() => 1));
return $data;
} catch (Exception $e) {
Mage::logException($e);
}
}
示例9: sendFraudPaymentEmail
/**
* Send email id payment is in Fraud status
* @param Mage_Customer_Model_Customer $receiver
* @param Mage_Sales_Model_Order $order
* @param string $message
* @return Mage_Checkout_Helper_Data
*/
public function sendFraudPaymentEmail($receiver, $order, $message, $email_key = 'fraud_payment')
{
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
$mailTemplate = Mage::getModel('core/email_template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
$template = Mage::getStoreConfig('hipay/' . $email_key . '/template', $order->getStoreId());
$copyTo = $this->_getEmails('hipay/' . $email_key . '/copy_to', $order->getStoreId());
$copyMethod = Mage::getStoreConfig('hipay/' . $email_key . '/copy_method', $order->getStoreId());
if ($copyTo && $copyMethod == 'bcc') {
$mailTemplate->addBcc($copyTo);
}
$sendTo = array(array('email' => $receiver->getEmail(), 'name' => $receiver->getName()));
if ($copyTo && $copyMethod == 'copy') {
foreach ($copyTo as $email) {
$sendTo[] = array('email' => $email, 'name' => null);
}
}
$shippingMethod = '';
if ($shippingInfo = $order->getShippingAddress()->getShippingMethod()) {
$data = explode('_', $shippingInfo);
$shippingMethod = $data[0];
}
$paymentMethod = '';
if ($paymentInfo = $order->getPayment()) {
$paymentMethod = $paymentInfo->getMethod();
}
$items = '';
foreach ($order->getAllVisibleItems() as $_item) {
/* @var $_item Mage_Sales_Model_Quote_Item */
$items .= $_item->getProduct()->getName() . ' x ' . $_item->getQty() . ' ' . $order->getStoreCurrencyCode() . ' ' . $_item->getProduct()->getFinalPrice($_item->getQty()) . "\n";
}
$total = $order->getStoreCurrencyCode() . ' ' . $order->getGrandTotal();
foreach ($sendTo as $recipient) {
$mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $order->getStoreId()))->sendTransactional($template, Mage::getStoreConfig('hipay/' . $email_key . '/identity', $order->getStoreId()), $recipient['email'], $recipient['name'], array('reason' => $message, 'dateAndTime' => Mage::app()->getLocale()->date(), 'customer' => $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname(), 'customerEmail' => $order->getCustomerEmail(), 'billingAddress' => $order->getBillingAddress(), 'shippingAddress' => $order->getShippingAddress(), 'shippingMethod' => Mage::getStoreConfig('carriers/' . $shippingMethod . '/title'), 'paymentMethod' => Mage::getStoreConfig('payment/' . $paymentMethod . '/title'), 'items' => nl2br($items), 'total' => $total));
}
$translate->setTranslateInline(true);
return $this;
}
示例10: deleteCustomer
/**
* @param \Mage_Customer_Model_Customer $customer
* @return bool|\Exception
*/
protected function deleteCustomer(\Mage_Customer_Model_Customer $customer)
{
try {
$customer->delete();
$this->output->writeln(sprintf('<info>%s (%s) was successfully deleted</info>', $customer->getName(), $customer->getEmail()));
return true;
} catch (\Exception $e) {
$this->output->writeln('<error>' . $e->getMessage() . '</error>');
return $e;
}
}
示例11: addMessage
/**
* @param string $text
* @param Mage_Customer_Model_Customer|Varien_Object|false $customer
* @param Mage_Admin_Model_User|false $user
* @param string $triggeredBy
* @param string $messageType
* @param bool|Mirasvit_Helpdesk_Model_Email $email
* @param bool|string $bodyFormat
*
* @return Mirasvit_Helpdesk_Model_Message
*
* @throws Exception
*/
public function addMessage($text, $customer, $user, $triggeredBy, $messageType = Mirasvit_Helpdesk_Model_Config::MESSAGE_PUBLIC, $email = false, $bodyFormat = false)
{
$message = Mage::getModel('helpdesk/message')->setTicketId($this->getId())->setType($messageType)->setBody($text)->setBodyFormat($bodyFormat)->setTriggeredBy($triggeredBy);
if ($triggeredBy == Mirasvit_Helpdesk_Model_Config::CUSTOMER) {
$message->setCustomerId($customer->getId());
$message->setCustomerName($customer->getName());
$message->setCustomerEmail($customer->getEmail());
$message->setIsRead(true);
$this->setLastReplyName($customer->getName());
} elseif ($triggeredBy == Mirasvit_Helpdesk_Model_Config::USER) {
$message->setUserId($user->getId());
if ($this->getOrigData('user_id') == $this->getData('user_id')) {
if ($messageType != Mirasvit_Helpdesk_Model_Config::MESSAGE_INTERNAL) {
$this->setUserId($user->getId());
// In case of different departments of ticket and owner, correct department id
$departments = Mage::getModel('helpdesk/department')->getCollection();
$departments->addUserFilter($user->getId())->addFieldToFilter('is_active', true);
if ($departments->count()) {
$this->_department = null;
$this->setDepartmentId($departments->getFirstItem()->getId());
}
}
}
$this->setLastReplyName($user->getName());
if ($message->isThirdParty()) {
$message->setThirdPartyEmail($this->getThirdPartyEmail());
}
} elseif ($triggeredBy == Mirasvit_Helpdesk_Model_Config::THIRD) {
$message->setThirdPartyEmail($this->getThirdPartyEmail());
if ($email) {
$this->setLastReplyName($email->getSenderNameOrEmail());
$message->setThirdPartyName($email->getSenderName());
}
}
if ($email) {
$message->setEmailId($email->getId());
}
//если тикет был закрыт, затем поступило сообщение от пользователя - мы его открываем
if ($triggeredBy != Mirasvit_Helpdesk_Model_Config::USER) {
if ($this->isClosed()) {
$status = Mage::getModel('helpdesk/status')->loadByCode(Mirasvit_Helpdesk_Model_Config::STATUS_OPEN);
$this->setStatusId($status->getId());
}
$this->setIsArchived(false);
}
$message->save();
if ($email) {
$email->setIsProcessed(true)->setAttachmentMessageId($message->getId())->save();
} else {
Mage::helper('helpdesk')->saveAttachments($message);
}
if (!$this->getIsSpam()) {
if ($this->getReplyCnt() == 0) {
Mage::helper('helpdesk/notification')->newTicket($this, $customer, $user, $triggeredBy, $messageType);
} else {
Mage::helper('helpdesk/notification')->newMessage($this, $customer, $user, $triggeredBy, $messageType);
}
}
$this->setReplyCnt($this->getReplyCnt() + 1);
if (!$this->getFirstReplyAt() && $user) {
$this->setFirstReplyAt(Mage::getSingleton('core/date')->gmtDate());
}
$this->setLastReplyAt(Mage::getSingleton('core/date')->gmtDate());
$this->save();
Mage::helper('helpdesk/history')->addMessage($this, $text, $triggeredBy, array('customer' => $customer, 'user' => $user, 'email' => $email), $messageType);
return $message;
}
示例12: sendConfirmation
/**
* @param $affiliate TBT_Rewards_Model_Customer the person who's making the referral and will earn the points
* @param $child TBT_Rewards_Model_Customer the person being referred to the site
* @param $destinationEmail
*
* @return send result
*/
public function sendConfirmation(Mage_Customer_Model_Customer $affiliate, $destinationEmail, $destinationName, $message = "", $pointsSummary = "")
{
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
$store_id = $this->getStoreId();
$store_id = empty($store_id) ? Mage::app()->getStore()->getId() : $store_id;
$email = Mage::getModel('core/email_template');
$email->setDesignConfig(array('area' => 'frontend', 'store' => $store_id));
/* @var $email Mage_Core_Model_Email_Template */
$template = Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_EMAIL_TEMPLATE, $store_id);
$recipient = array('email' => $affiliate->getEmail(), 'name' => $affiliate->getName());
$sender = array('name' => strip_tags($this->getSubscSenderName($store_id)), 'email' => strip_tags($this->getSubscSenderEmail($store_id)));
$store_name = Mage::getModel('core/store')->load(Mage::app()->getStore()->getCode())->getName();
// save theme settings because sendTransactional might not restore them
$initial_layout = Mage::getDesign()->getTheme('layout');
$initial_template = Mage::getDesign()->getTheme('template');
$initial_skin = Mage::getDesign()->getTheme('skin');
$initial_locale = Mage::getDesign()->getTheme('locale');
$customerId = $this->getReferralChildId();
$customer = Mage::getModel('rewards/customer')->load($customerId);
$email->sendTransactional($template, $sender, $recipient['email'], $recipient['name'], array('parent' => $affiliate, 'affiliate' => $affiliate, 'referral' => $this, 'store_name' => $store_name, 'msg' => $message, 'referral_customer' => $customer, 'points_earned' => $pointsSummary, 'affiliate_url' => (string) Mage::helper('rewardsref/url')->getUrl($affiliate), 'referral_code' => (string) Mage::helper('rewardsref/code')->getCode($affiliate->getEmail()), 'referral_shortcode' => (string) Mage::helper('rewardsref/shortcode')->getCode($affiliate->getEmail())));
$translate->setTranslateInline(true);
if (!$email->getProcessedTemplate()) {
throw new Exception(Mage::helper('rewards')->__("The referral e-mail template was not properly loaded. This might be due to locale issues with characters that could be read, or tempalte variables that could not be parsed properly. The template being loaded was %s", $template));
}
$return_value = $email->getSentSuccess();
// restore theme restore
Mage::getDesign()->setTheme('layout', $initial_layout);
Mage::getDesign()->setTheme('template', $initial_template);
Mage::getDesign()->setTheme('skin', $initial_skin);
Mage::getDesign()->setTheme('locale', $initial_locale);
return $return_value;
}
示例13: _filterCustomer
/**
* @param Mage_Customer_Model_Customer $customer
*
* @return Bronto_Common_Model_Email_Template_Filter
*/
protected function _filterCustomer(Mage_Customer_Model_Customer $customer)
{
if (!in_array('customer', $this->_filteredObjects)) {
// Handle Defaults from settings
$customerName = trim($customer->getName()) == '' ? Mage::helper('bronto_common')->getDefaultGreeting('full', 'store', $this->getStoreId()) : $customer->getName();
$customerPrefix = trim($customer->getPrefix()) == '' ? Mage::helper('bronto_common')->getDefaultGreeting('prefix', 'store', $this->getStoreId()) : $customer->getPrefix();
$customerFirstName = trim($customer->getFirstname()) == '' ? Mage::helper('bronto_common')->getDefaultGreeting('firstname', 'store', $this->getStoreId()) : $customer->getFirstname();
$customerLastName = trim($customer->getLastname()) == '' ? Mage::helper('bronto_common')->getDefaultGreeting('lastname', 'store', $this->getStoreId()) : $customer->getLastname();
$this->setField('customerName', $customerName);
$this->setField('firstName', $customerFirstName);
$this->setField('prefix', $customerPrefix);
$this->setField('lastName', $customerLastName);
$this->setField('customerEmail', $customer->getEmail());
$this->setField('customerPassword', $customer->getPassword());
if ($store = $customer->getStore()) {
$this->setField('confirmationLink', $store->getUrl('customer/account/confirm', array('_query' => array('id' => $customer->getId(), 'key' => $customer->getConfirmation()))));
if (Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(array('>=', '6')))) {
$this->setField('passwordResetLink', $store->getUrl('customer/account/resetpassword', array('_query' => array('id' => $customer->getId(), 'token' => $customer->getRpToken()))));
}
} else {
$this->setField('confirmationLink', Mage::getUrl('customer/account/confirm', array('_query' => array('id' => $customer->getId(), 'key' => $customer->getConfirmation()))));
if (Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(array('>=', '6')))) {
$this->setField('passwordResetLink', Mage::getUrl('customer/account/resetpassword', array('_query' => array('id' => $customer->getId(), 'token' => $customer->getRpToken()))));
}
}
$this->_filteredObjects[] = 'customer';
}
return $this;
}
示例14: synchroniseCustomer
/**
* Synchronise a Magento customer with WordPress
*
* @param Mage_Customer_Model_Customer $customer
* @return bool
*/
public function synchroniseCustomer(Mage_Customer_Model_Customer $customer)
{
$email = $customer->getEmail();
if ($customer->getCsData() && $customer->getCsData()->getEmail()) {
$email = $customer->getCsData()->getEmail();
}
$user = Mage::getModel('wordpress/user')->loadByEmail($email);
if (!$user->getId() && !$customer->getPassword()) {
return false;
}
$user->setUserEmail($customer->getEmail())->setUserRegistered($customer->getCreatedAt())->setUserNicename($customer->getName())->setDisplayName($customer->getFirstname())->setFirstName($customer->getFirstname())->setLastName($customer->getLastname())->setNickname($customer->getFirstname());
if (!$user->getUserLogin() || strpos($user->getUserLogin(), '@') !== false) {
$user->setUserLogin($customer->getEmail());
}
try {
if ($customer->hasPassword()) {
if ($customer->validatePassword($customer->getPassword())) {
$wpHash = $this->hashPasswordForWordPress($customer->getPassword());
if ($this->isValidWordPressPassword($customer->getPassword(), $wpHash)) {
$user->setUserPass($wpHash);
}
}
}
$user->save();
$customer->setWordpressUser($user);
} catch (Exception $e) {
Mage::helper('wordpress')->log($e);
}
}
示例15: _sendNewReleaseEmail
/**
* Send email with new release information.
*
* @param Mage_Customer_Model_Customer $customer
* Customer to send the mail to
* @param Faett_Package_Model_Link_Purchased $linkPurchased
* The data about when the product has been purchased
* @param Faett_Package_Model_Link $link
* Data previously created link
* @return Faett_Package_Model_Mysql4_Link
* The instance
*/
protected function _sendNewReleaseEmail(Mage_Customer_Model_Customer $customer, Faett_Package_Model_Link_Purchased $linkPurchased, Faett_Package_Model_Link $link)
{
try {
// load the translation model
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
// initialize the store ID necessary for the translation
$storeId = $customer->getStoreId();
if ($customer->getWebsiteId() != '0' && $storeId == '0') {
$storeIds = Mage::app()->getWebsite($customer->getWebsiteId())->getStoreIds();
reset($storeIds);
$storeId = current($storeIds);
}
// load the email template, generate and send the mail
Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional(Mage::getStoreConfig(Faett_Channel_Model_Service::XML_PATH_EMAILS_RELEASE_NEW), Mage::getStoreConfig(Mage_Customer_Model_Customer::XML_PATH_REGISTER_EMAIL_IDENTITY), $customer->getEmail(), $customer->getName(), array('customer' => $customer, 'linkPurchased' => $linkPurchased, 'link' => $link));
// close the translation model
$translate->setTranslateInline(true);
} catch (Exception $e) {
Mage::logException($e);
}
// return the instance itself
return $this;
}