本文整理汇总了PHP中Mage_Sales_Model_Order::getCustomerEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getCustomerEmail方法的具体用法?PHP Mage_Sales_Model_Order::getCustomerEmail怎么用?PHP Mage_Sales_Model_Order::getCustomerEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getCustomerEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logSale
/**
* Send order to MailChimp
*
* @param Mage_Sales_Model_Order $order
* @return bool|array
*/
public function logSale($order)
{
$this->_order = $order;
$api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
if (!$api) {
return false;
}
$subtotal = $this->_order->getSubtotal();
$discount = (double) $this->_order->getDiscountAmount();
if ($discount != 0) {
$subtotal = $subtotal + $discount;
}
$this->_info = array('id' => $this->_order->getIncrementId(), 'total' => $subtotal, 'shipping' => $this->_order->getShippingAmount(), 'tax' => $this->_order->getTaxAmount(), 'store_id' => $this->_order->getStoreId(), 'store_name' => $this->_order->getStoreName(), 'plugin_id' => 1215, 'items' => array());
$emailCookie = $this->_getEmailCookie();
$campaignCookie = $this->_getCampaignCookie();
$this->setItemstoSend();
if ($emailCookie && $campaignCookie) {
$this->_info['email_id'] = $emailCookie;
$this->_info['campaign_id'] = $campaignCookie;
//Send order to MailChimp
$rs = $api->campaignEcommOrderAdd($this->_info);
} else {
$this->_info['email'] = $this->_order->getCustomerEmail();
$rs = $api->ecommOrderAdd($this->_info);
}
if ($rs === TRUE) {
$this->_logCall();
return true;
} else {
return $rs;
}
}
示例2: _prepareCustomerData
/**
* @return array
*/
protected function _prepareCustomerData()
{
$customer_id = null;
$customer = null;
$customer_log = null;
$billing_address = $this->_order->getBillingAddress();
$customer_verified = false;
$customer_orders_count = 0;
$gender = $this->_order->getCustomerGender();
if (!$this->_order->getCustomerIsGuest()) {
$customer_id = $this->_order->getCustomerId();
if ($customer_id) {
/** @var Mage_Customer_Model_Customer $customer */
$customer = Mage::getModel("customer/customer");
$customer->load($customer_id);
/** @var Mage_Log_Model_Customer $customer_log */
$customer_log = Mage::getModel('log/customer')->load($customer_id);
}
$customer_verified = $this->getCustomerIsConfirmedStatus($customer);
$orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $customer_id);
/** @noinspection PhpUndefinedMethodInspection */
$customer_orders_count = $orders->count();
}
$data = array_filter(array('customer_id' => $customer_id, 'customer_is_guest' => $this->_order->getCustomerIsGuest(), 'verified' => $customer_verified, 'language_code' => $this->_language_code, 'last_login_on' => $customer_log ? $customer_log->getLoginAt() : null, 'created_on' => $customer ? $customer->getData('created_at') : null, 'updated_on' => $customer ? $customer->getData('updated_at') : null, 'birthdate' => $this->_order->getCustomerDob(), 'email' => $this->_order->getCustomerEmail(), 'title' => '', 'prefix' => $this->_order->getCustomerPrefix(), 'suffix' => $this->_order->getCustomerSuffix(), 'first_name' => $this->_order->getCustomerFirstname(), 'middle_name' => $this->_order->getCustomerMiddlename(), 'last_name' => $this->_order->getCustomerLastname(), 'company_name' => $billing_address ? $billing_address->getCompany() : null, 'gender' => $gender == 1 ? 'male' : ($gender == 2 ? 'female' : null), 'telephone1' => $billing_address ? $billing_address->getTelephone() : null, 'telephone2' => '', 'telephone3' => '', 'fax' => $billing_address ? $billing_address->getFax() : null, 'vat_number' => $this->_order->getCustomerTaxvat(), 'reg_ip_address' => '', 'customer_orders_count' => $customer_orders_count));
return $data;
}
示例3: getOrderSecret
/**
* Generate and return order secret
*
* @param Mage_Sales_Model_Order $order
* @return string
*/
public function getOrderSecret($order)
{
$email = $order->getCustomerEmail();
$orderId = $order->getRealOrderId();
$storeSecret = $this->getSBSecret();
return md5($email . $orderId . $storeSecret);
}
示例4: _createCustomer
/**
* @param Mage_Sales_Model_Order $order
* @return int
*/
protected function _createCustomer(Mage_Sales_Model_Order $order)
{
/** @var $customer Mage_Customer_Model_Customer */
$customer = Mage::getModel('customer/customer')->setWebsiteId($order->getStore()->getWebsiteId())->loadByEmail($order->getCustomerEmail());
$customerGroupId = 1;
// @todo load general customer group ID?
if (!$customer->getId()) {
$customer->addData(array('prefix' => $order->getCustomerPrefix(), 'firstname' => $order->getCustomerFirstname(), 'middlename' => $order->getCustomerMiddlename(), 'lastname' => $order->getCustomerLastname(), 'suffix' => $order->getCustomerSuffix(), 'email' => $order->getCustomerEmail(), 'group_id' => $customerGroupId, 'taxvat' => $order->getCustomerTaxvat(), 'website_id' => $order->getStore()->getWebsiteId(), 'default_billing' => '_item1', 'default_shipping' => '_item2'));
// Billing Address
/** @var $billingAddress Mage_Sales_Model_Order_Address */
$billingAddress = $order->getBillingAddress();
/** @var $customerBillingAddress Mage_Customer_Model_Address */
$customerBillingAddress = Mage::getModel('customer/address');
$billingAddressArray = $billingAddress->toArray();
unset($billingAddressArray['entity_id']);
unset($billingAddressArray['parent_id']);
unset($billingAddressArray['customer_id']);
unset($billingAddressArray['customer_address_id']);
unset($billingAddressArray['quote_address_id']);
$customerBillingAddress->addData($billingAddressArray);
$customerBillingAddress->setPostIndex('_item1');
$customer->addAddress($customerBillingAddress);
// Shipping Address
/** @var $shippingAddress Mage_Sales_Model_Order_Address */
$shippingAddress = $order->getShippingAddress();
/** @var $customerShippingAddress Mage_Customer_Model_Address */
$customerShippingAddress = Mage::getModel('customer/address');
$shippingAddressArray = $shippingAddress->toArray();
unset($shippingAddressArray['entity_id']);
unset($shippingAddressArray['parent_id']);
unset($shippingAddressArray['customer_id']);
unset($shippingAddressArray['customer_address_id']);
unset($shippingAddressArray['quote_address_id']);
$customerShippingAddress->addData($shippingAddressArray);
$customerShippingAddress->setPostIndex('_item2');
$customer->addAddress($customerShippingAddress);
// Save the customer
$customer->setPassword($customer->generatePassword());
$customer->save();
}
// Link customer to order
$order->setCustomerId($customer->getId());
$order->setCustomerIsGuest(0);
$order->setCustomerGroupId($customerGroupId);
$order->save();
return $customer->getId();
}
示例5: getCustomerEmail
/**
* Returns the current customers email adress.
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
* @return string the customers email adress
*/
public function getCustomerEmail($object)
{
$email = $object->getCustomerEmail();
if (empty($email)) {
$email = $object->getBillingAddress()->getEmail();
}
return $email;
}
示例6: _sendPaymentDeclineEmail
/**
* Send Payment Decline email
*/
protected function _sendPaymentDeclineEmail(Mage_Sales_Model_Order $order, $type = 'soft')
{
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('amazon_payments_async_decline_' . $type);
$orderUrl = Mage::getUrl('sales/order/view', array('order_id' => $order->getId(), '_store' => $order->getStoreId(), '_forced_secure' => true));
$templateParams = array('order_url' => $orderUrl, 'store' => Mage::app()->getStore($order->getStoreId()), 'customer' => Mage::getModel('customer/customer')->load($order->getCustomerId()));
$sender = array('name' => Mage::getStoreConfig('trans_email/ident_general/email', $order->getStoreId()), 'email' => Mage::getStoreConfig('trans_email/ident_general/name', $order->getStoreId()));
$emailTemplate->sendTransactional($emailTemplate->getId(), $sender, $order->getCustomerEmail(), $order->getCustomerName(), $templateParams, $order->getStoreId());
}
示例7: getSenderParams
/**
* Retorna um array com informações do Sender(Cliente) para ser enviado pra API
* @param Mage_Sales_Model_Order $order
* @param $payment
* @return array
*/
public function getSenderParams(Mage_Sales_Model_Order $order, $payment)
{
$digits = new Zend_Filter_Digits();
$cpf = $this->_getCustomerCpfValue($order->getCustomer(), $payment);
//telefone
$phone = $this->_extractPhone($order->getBillingAddress()->getTelephone());
$retorno = array('senderName' => sprintf('%s %s', trim($order->getCustomerFirstname()), trim($order->getCustomerLastname())), 'senderEmail' => $order->getCustomerEmail(), 'senderHash' => $payment['additional_information']['sender_hash'], 'senderCPF' => $digits->filter($cpf), 'senderAreaCode' => $phone['area'], 'senderPhone' => $phone['number']);
return $retorno;
}
示例8: recordPointsUponFirstOrder
/**
*
*
* @param Mage_Sales_Model_Order $order
*/
public function recordPointsUponFirstOrder($order)
{
try {
if (!Mage::getModel('rewardsref/referral_firstorder')->hasReferralPoints()) {
return $this;
}
//$order = $observer->getEvent()->getInvoice()->getOrder();
$referralModel = Mage::getModel('rewardsref/referral_firstorder');
if ($referralModel->isSubscribed($order->getCustomerEmail()) && !$referralModel->isConfirmed($order->getCustomerEmail())) {
$child = Mage::getModel('rewards/customer')->load($order->getCustomerId());
Mage::getModel('rewardsref/referral_firstorder')->trigger($child);
$parent = Mage::getModel('rewards/customer')->load($referralModel->getReferralParentId());
$referralModel->sendConfirmation($parent, $child, $parent->getEmail());
}
} catch (Exception $e) {
Mage::logException($e);
}
}
示例9: toQuote
/**
* Converting order object to quote object
*
* @param Mage_Sales_Model_Order $order
* @return Mage_Sales_Model_Quote
*/
public function toQuote(Mage_Sales_Model_Order $order, $quote = null)
{
if (!$quote instanceof Mage_Sales_Model_Quote) {
$quote = Mage::getModel('sales/quote');
}
$quote->setStoreId($order->getStoreId())->setOrderId($order->getId())->setCustomerId($order->getCustomerId())->setCustomerEmail($order->getCustomerEmail())->setCustomerGroupId($order->getCustomerGroupId())->setCustomerTaxClassId($order->getCustomerTaxClassId())->setCustomerIsGuest($order->getCustomerIsGuest())->setBaseCurrencyCode($order->getBaseCurrencyCode())->setStoreCurrencyCode($order->getStoreCurrencyCode())->setQuoteCurrencyCode($order->getOrderCurrencyCode())->setStoreToBaseRate($order->getStoreToBaseRate())->setStoreToQuoteRate($order->getStoreToOrderRate())->setGrandTotal($order->getGrandTotal())->setBaseGrandTotal($order->getBaseGrandTotal())->setCouponCode($order->getCouponCode())->setGiftcertCode($order->getGiftcertCode())->setAppliedRuleIds($order->getAppliedRuleIds())->collectTotals();
Mage::dispatchEvent('sales_convert_order_to_quote', array('order' => $order, 'quote' => $quote));
return $quote;
}
示例10: _sendPaymentDeclineEmail
/**
* Send Payment Decline email
*/
protected function _sendPaymentDeclineEmail(Mage_Sales_Model_Order $order)
{
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('amazon_payments_async_decline');
$orderUrl = Mage::getUrl('sales/order/view', array('order_id' => $order->getId(), '_store' => $order->getStoreId(), '_forced_secure' => true));
$templateParams = array('order_url' => $orderUrl, 'store' => Mage::app()->getStore($order->getStoreId()), 'customer' => Mage::getModel('customer/customer')->load($order->getCustomerId()));
$processedTemplate = $emailTemplate->getProcessedTemplate($templateParams);
// Test template:
//var_dump($emailTemplate->debug()); echo $processedTemplate;
$emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $order->getStoreId()))->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', $order->getStoreId()))->send($order->getCustomerEmail(), $order->getCustomerName(), $templateParams);
}
示例11: createGuessCustomerFromOrder
public static function createGuessCustomerFromOrder(Mage_Sales_Model_Order $order)
{
$aCustomer = new self();
$aCustomer->email = $order->getCustomerEmail();
$aCustomer->type = 'g';
$aCustomer->gender = 0;
$aCustomer->first_name = $order->getCustomerFirstname();
$aCustomer->last_name = $order->getCustomerLastname();
return $aCustomer;
}
示例12: autoExportJobs
/** Send order to MailChimp Automatically by Order Status
*
*
*/
public function autoExportJobs()
{
$allow_sent = false;
$orderIds[] = '0';
$ecommerceOrders = Mage::getModel('monkey/ecommerce')->getCollection()->getData();
if ($ecommerceOrders) {
foreach ($ecommerceOrders as $ecommerceOrder) {
$orderIds[] = $ecommerceOrder['order_id'];
}
}
$orders = Mage::getResourceModel('sales/order_collection');
//Get ALL orders which has not been sent to MailChimp
$orders->getSelect()->where('main_table.entity_id NOT IN(?)', $orderIds);
//Get status options selected in the Configuration
$states = explode(',', Mage::helper('monkey')->config('order_status'));
foreach ($orders as $order) {
foreach ($states as $state) {
if ($order->getStatus() == $state || $state == 'all_status') {
$allow_sent = true;
}
}
if ($allow_sent == true) {
$this->_order = $order;
$api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
if (!$api) {
return false;
}
$subtotal = $this->_order->getSubtotal();
$discount = (double) $this->_order->getDiscountAmount();
if ($discount != 0) {
$subtotal = $subtotal + $discount;
}
$this->_info = array('id' => $this->_order->getIncrementId(), 'total' => $subtotal, 'shipping' => $this->_order->getShippingAmount(), 'tax' => $this->_order->getTaxAmount(), 'store_id' => $this->_order->getStoreId(), 'store_name' => $this->_order->getStoreName(), 'plugin_id' => 1215, 'items' => array());
$email = $this->_order->getCustomerEmail();
$campaign = $this->_order->getEbizmartsMagemonkeyCampaignId();
$this->setItemstoSend();
if ($email && $campaign) {
$this->_info['email_id'] = $email;
$this->_info['campaign_id'] = $campaign;
//Send order to MailChimp
$rs = $api->campaignEcommOrderAdd($this->_info);
} else {
$this->_info['email'] = $email;
$rs = $api->ecommOrderAdd($this->_info);
}
$allow_sent = false;
if ($rs === TRUE) {
$this->_logCall();
}
}
}
}
示例13: getScript
public function getScript()
{
$request = Mage::app()->getRequest();
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$flag = false;
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
$script = "<script>var apiKey = '" . $this->getKey() . "';</script>" . "\n";
if ($module == 'checkout' && $controller == 'onestep' && $action == 'success' || $module == 'checkout' && $controller == 'onepage' && $action == 'success' || $module == 'securecheckout' && $controller == 'index' && $action == 'success' || $module == 'customdownloadable' && $controller == 'onepage' && $action == 'success' || $module == 'onepagecheckout' && $controller == 'index' && $action == 'success' || $module == 'onestepcheckout' && $controller == 'index' && $action == 'success') {
$order = new Mage_Sales_Model_Order();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($orderId);
// Load order details
$order_total = round($order->getGrandTotal(), 2);
// Get grand total
$order_coupon = $order->getCouponCode();
// Get coupon used
$items = $order->getAllItems();
// Get items info
$cartInfo = array();
// Convert object to string
foreach ($items as $item) {
$product = Mage::getModel('catalog/product')->load($item->getProductId());
$name = $item->getName();
$qty = $item->getQtyToInvoice();
$cartInfo[] = array('id' => $item->getProductId(), 'name' => $name, 'quantity' => $qty);
}
$cartInfoString = serialize($cartInfo);
$cartInfoString = addcslashes($cartInfoString, "'");
$order_name = $order->getCustomerName();
// Get customer's name
$order_email = $order->getCustomerEmail();
// Get customer's email id
// Call invoiceRefiral function
$scriptAppend = "<script>whenAvailable('invoiceRefiral',function(){invoiceRefiral('{$order_total}','{$order_total}','{$order_coupon}','{$cartInfoString}','{$order_name}','{$order_email}','{$orderId}', '{$currency}')});</script>" . "\n";
if ($this->debug()) {
$scriptAppend .= "<script>console.log('Module: " . $module . ", Controller: " . $controller . ", Action: " . $action . "');</script>";
$scriptAppend .= "<script>console.log('Total: " . $order_total . ", Coupon: " . $order_coupon . ", Cart: " . $cartInfoString . ", Name: " . $order_name . ", Email: " . $order_email . ", Id: " . $orderId . ", Currency: " . $currency . "');</script>";
}
$script .= '<script>var showButton = false;</script>' . "\n";
} else {
if ($this->debug()) {
$scriptAppend = "<script>console.log('Module: " . $module . ", Controller: " . $controller . ", Action: " . $action . "');</script>";
} else {
$scriptAppend = '';
}
$script .= '<script>var showButton = true;</script>' . "\n";
}
$script .= '<script type="text/javascript">(function e(){var e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="//rfer.co/api/v1/js/all.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>' . "\n";
return $script . $scriptAppend;
}
示例14: _createCustomerFromOrder
/**
* Creates new customer from order, adds order addresses as customer addresses
*
* @param Mage_Sales_Model_Order|bool $order
* @return Mage_Customer_Model_Customer
*/
protected function _createCustomerFromOrder($order)
{
if (!$order instanceof Mage_Sales_Model_Order) {
return false;
}
// Check if customer with email address exists
$existingCustomer = Mage::getResourceModel('customer/customer_collection')->addFieldToFilter('email', $order->getCustomerEmail());
if (Mage::getSingleton('customer/config_share')->isWebsiteScope()) {
$existingCustomer->addFieldToFilter('website_id', $order->getWebsiteId());
}
$existingCustomer = $existingCustomer->getFirstItem();
if (!$existingCustomer instanceof Mage_Customer_Model_Customer || !$existingCustomer->getId()) {
return Mage::getModel('customer/customer');
}
// Create customer
/** @var Mage_Customer_Model_Customer $customer */
$customer = Mage::getModel('customer/customer')->setEmail($order->getCustomerEmail())->setStoreId($order->getStoreId())->setPrefix($order->getCustomerPrefix())->setFirstname($order->getCustomerFirstname())->setLastname($order->getCustomerLastname());
$customer->save();
// Create customer addresses
foreach ($order->getAddressesCollection() as $orderAddress) {
/** @var Mage_Sales_Model_Order_Address $orderAddress */
/** @var Mage_Customer_Model_Address $address */
$address = Mage::getModel('customer/address')->setParentId($customer->getEntityId())->setCustomerId($customer->getEntityId())->setIsActive(true)->setPrefix($orderAddress->getPrefix())->setFirstname($orderAddress->getFirstname())->setMiddlename($orderAddress->getMiddlename())->setLastname($orderAddress->getLastname())->setSuffix($orderAddress->getSuffix())->setStreet($orderAddress->getStreet())->setCity($orderAddress->getCity())->setPostcode($orderAddress->getPostcode())->setCountryId($orderAddress->getCountryId())->setTelephone($orderAddress->getTelephone())->setCompany($orderAddress->getCompany())->setRegion($orderAddress->getRegion())->setRegionId($orderAddress->getRegionId());
$address->save();
// Save default billing and shipping
if ($orderAddress->getAddressType() == 'billing') {
$customer->setDefaultBilling($address->getEntityId());
} elseif ($orderAddress->getAddressType() == 'shipping') {
$customer->setDefaultShipping($address->getEntityId());
}
}
// Force confirmation
$customer->setConfirmation($customer->getRandomConfirmationKey());
$customer->save();
return $customer;
}
示例15: _sendEmail
/**
* @param Mage_Sales_Model_Order $order
* @throws Mage_Core_Exception
*/
protected function _sendEmail(Mage_Sales_Model_Order $order)
{
// Send email
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
/** @var Mage_Core_Helper_Data $helper */
$helper = Mage::helper('core');
$loginUrl = Mage::getUrl('ho_customer/account/login', array('encryption' => $helper->getEncryptor()->encrypt($order->getCustomerId()), 'forward_url' => base64_encode(Mage::getUrl('ho_customer/account/completeProfile'))));
/** @var Mage_Core_Model_Email_Template $emailTemplate */
$emailTemplate = Mage::getModel('core/email_template');
$emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $order->getStoreId()))->sendTransactional($this->getConfig()->getEmailTemplate($order->getStoreId()), $this->getConfig()->getEmailSender($order->getStoreId()), $order->getCustomerEmail(), $order->getCustomerName(), array('order' => $order, 'login_url' => $loginUrl));
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
$customer->setData('complete_profile_sent', true)->getResource()->saveAttribute($customer, 'complete_profile_sent');
$translate->setTranslateInline(true);
}