本文整理汇总了PHP中Mage_Sales_Model_Quote::getCustomerEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getCustomerEmail方法的具体用法?PHP Mage_Sales_Model_Quote::getCustomerEmail怎么用?PHP Mage_Sales_Model_Quote::getCustomerEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getCustomerEmail方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _updateQuote
protected function _updateQuote(Mage_Sales_Model_Quote $quote)
{
if (!Mage::helper('recapture')->isEnabled()) {
return $this;
}
if (!$quote->getId()) {
return;
}
//sales_quote_save_before gets called like 5 times on some page loads, we don't want to do 5 updates per page load
if (Mage::registry('recapture_has_posted')) {
return;
}
Mage::register('recapture_has_posted', true);
$mediaConfig = Mage::getModel('catalog/product_media_config');
$storeId = Mage::app()->getStore();
$transportData = array('first_name' => $quote->getCustomerFirstname(), 'last_name' => $quote->getCustomerLastname(), 'email' => $quote->getCustomerEmail(), 'external_id' => $quote->getId(), 'grand_total' => $quote->getGrandTotal(), 'products' => array(), 'totals' => array());
$cartItems = $quote->getAllVisibleItems();
foreach ($cartItems as $item) {
$productModel = $item->getProduct();
$productImage = (string) Mage::helper('catalog/image')->init($productModel, 'thumbnail');
//check configurable first
if ($item->getProductType() == 'configurable') {
if (Mage::getStoreConfig('checkout/cart/configurable_product_image') == 'itself') {
$child = $productModel->getIdBySku($item->getSku());
$image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($child, 'thumbnail', $storeId);
if ($image) {
$productImage = $mediaConfig->getMediaUrl($image);
}
}
}
//then check grouped
if (Mage::getStoreConfig('checkout/cart/grouped_product_image') == 'parent') {
$options = $productModel->getTypeInstance(true)->getOrderOptions($productModel);
if (isset($options['super_product_config']) && $options['super_product_config']['product_type'] == 'grouped') {
$parent = $options['super_product_config']['product_id'];
$image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($parent, 'thumbnail', $storeId);
$productImage = $mediaConfig->getMediaUrl($image);
}
}
$optionsHelper = Mage::helper('catalog/product_configuration');
if ($item->getProductType() == 'configurable') {
$visibleOptions = $optionsHelper->getConfigurableOptions($item);
} else {
$visibleOptions = $optionsHelper->getCustomOptions($item);
}
$product = array('name' => $item->getName(), 'sku' => $item->getSku(), 'price' => $item->getPrice(), 'qty' => $item->getQty(), 'image' => $productImage, 'options' => $visibleOptions);
$transportData['products'][] = $product;
}
$totals = $quote->getTotals();
foreach ($totals as $total) {
//we pass grand total on the top level
if ($total->getCode() == 'grand_total') {
continue;
}
$total = array('name' => $total->getTitle(), 'amount' => $total->getValue());
$transportData['totals'][] = $total;
}
Mage::helper('recapture/transport')->dispatch('cart', $transportData);
return $this;
}
示例2: 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;
}
示例3: updateQuote
/**
* Update Quote Email Address if is guest and current email address assigned doesn't match new email
*
* @param Mage_Sales_Model_Quote $quote
*/
public function updateQuote(Mage_Sales_Model_Quote $quote)
{
$queue = Mage::getModel('bronto_emailcapture/queue');
$currentEmail = $queue->getCurrentEmail();
if (is_null($quote->getCustomerId()) && $queue->isValidEmail($currentEmail) && $quote->getCustomerEmail() !== $currentEmail) {
$quote->setCustomerEmail(Mage::getModel('bronto_emailcapture/queue')->getCurrentEmail())->save();
}
}
示例4: prepareOrderReview
/**
* Check whether order review has enough data to initialize
*
* @param $token
* @throws Mage_Core_Exception
*/
public function prepareOrderReview()
{
$payment = $this->_quote->getPayment();
if (!$payment || !$this->_quote->getCustomerEmail()) {
Mage::throwException(Mage::helper('sagepaysuite')->__('Payer is not identified.'));
}
$this->_ignoreAddressValidation();
$this->_quote->collectTotals()->save();
}
示例5: toOrder
/**
* Convert quote model to order model
*
* @param Mage_Sales_Model_Quote $quote
* @return Mage_Sales_Model_Order
*/
public function toOrder(Mage_Sales_Model_Quote $quote, $order = null)
{
if (!$order instanceof Mage_Sales_Model_Order) {
$order = Mage::getModel('sales/order');
}
/* @var $order Mage_Sales_Model_Order */
$order->setStoreId($quote->getStoreId())->setQuoteId($quote->getId())->setRemoteIp($quote->getRemoteIp())->setCustomerId($quote->getCustomerId())->setCustomerEmail($quote->getCustomerEmail())->setCustomerFirstname($quote->getCustomerFirstname())->setCustomerLastname($quote->getCustomerLastname())->setCustomerGroupId($quote->getCustomerGroupId())->setCustomerTaxClassId($quote->getCustomerTaxClassId())->setCustomerNote($quote->getCustomerNote())->setCustomerNoteNotify($quote->getCustomerNoteNotify())->setCustomerIsGuest($quote->getCustomerIsGuest())->setBaseCurrencyCode($quote->getBaseCurrencyCode())->setStoreCurrencyCode($quote->getStoreCurrencyCode())->setOrderCurrencyCode($quote->getQuoteCurrencyCode())->setStoreToBaseRate($quote->getStoreToBaseRate())->setStoreToOrderRate($quote->getStoreToQuoteRate())->setCouponCode($quote->getCouponCode())->setGiftcertCode($quote->getGiftcertCode())->setIsVirtual($quote->getIsVirtual())->setIsMultiPayment($quote->getIsMultiPayment())->setAppliedRuleIds($quote->getAppliedRuleIds());
Mage::dispatchEvent('sales_convert_quote_to_order', array('order' => $order, 'quote' => $quote));
return $order;
}
示例6: sendCart
/**
* Create Cart data to post to API
*
* @param Mage_Sales_Model_Quote $quote
* @param string $email
* @param string $eventType
* @return boolean
*/
public function sendCart(Mage_Sales_Model_Quote $quote, $email = null, $eventType = null)
{
try {
if ($eventType) {
$this->_eventType = $eventType;
}
if (!$email) {
if (!($email = $quote->getCustomerEmail())) {
Mage::logException("Unable to post purchase: customer email is not defined.");
return false;
}
}
$data = array('email' => $email, 'items' => $this->_getItems($quote->getAllVisibleItems()), 'incomplete' => 1, 'reminder_time' => '+' . Mage::helper('sailthruemail')->getReminderTime() . ' min', 'reminder_template' => Mage::getStoreConfig('sailthru/email/abandoned_cart_template', $quote->getStoreId()), 'message_id' => $this->getMessageId());
$response = $this->apiPost('purchase', $data);
if (array_key_exists('error', $response)) {
return $this->handleError($response, $quote, $email);
}
Mage::getSingleton('checkout/session')->setSailthuAbandonedCartId($quote->getId());
return true;
} catch (Exception $e) {
Mage::logException($e);
}
}
示例7: _lookupCustomerId
/**
* Checks if customer with email coming from Express checkout exists
*
* @return int
*/
protected function _lookupCustomerId()
{
return Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getWebsite()->getId())->loadByEmail($this->_quote->getCustomerEmail())->getId();
}
示例8: _addCustomer
/**
* Sets the customer info if available
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
* @return $this
*/
protected function _addCustomer($object)
{
$format = Mage::getStoreConfig('tax/avatax/cust_code_format', $object->getStoreId());
$customer = Mage::getModel('customer/customer');
if ($object->getCustomerId()) {
$customer->load($object->getCustomerId());
$taxClass = Mage::getModel('tax/class')->load($customer->getTaxClassId())->getOpAvataxCode();
$this->_request->setCustomerUsageType($taxClass);
}
switch ($format) {
case OnePica_AvaTax_Model_Source_Customercodeformat::LEGACY:
if ($customer->getId()) {
$customerCode = $customer->getName() . ' (' . $customer->getId() . ')';
} else {
$address = $object->getBillingAddress() ? $object->getBillingAddress() : $object;
$customerCode = $address->getFirstname() . ' ' . $address->getLastname() . ' (Guest)';
}
break;
case OnePica_AvaTax_Model_Source_Customercodeformat::CUST_EMAIL:
$customerCode = $object->getCustomerEmail() ? $object->getCustomerEmail() : $customer->getEmail();
break;
case OnePica_AvaTax_Model_Source_Customercodeformat::CUST_ID:
default:
$customerCode = $object->getCustomerId() ? $object->getCustomerId() : 'guest-' . $object->getId();
break;
}
$this->_request->setCustomerCode($customerCode);
return $this;
}
示例9: sendPaymentFailedEmail
/**
* Send email id payment was failed
*
* @param Mage_Sales_Model_Quote $checkout
* @param string $message
* @param string $checkoutType
* @return Mage_Checkout_Helper_Data
*/
public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'onepage')
{
$translate = Mage::getSingleton('Mage_Core_Model_Translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
$mailTemplate = Mage::getModel('Mage_Core_Model_Email_Template');
/* @var $mailTemplate Mage_Core_Model_Email_Template */
$template = Mage::getStoreConfig('checkout/payment_failed/template', $checkout->getStoreId());
$copyTo = $this->_getEmails('checkout/payment_failed/copy_to', $checkout->getStoreId());
$copyMethod = Mage::getStoreConfig('checkout/payment_failed/copy_method', $checkout->getStoreId());
if ($copyTo && $copyMethod == 'bcc') {
$mailTemplate->addBcc($copyTo);
}
$_reciever = Mage::getStoreConfig('checkout/payment_failed/reciever', $checkout->getStoreId());
$sendTo = array(array('email' => Mage::getStoreConfig('trans_email/ident_' . $_reciever . '/email', $checkout->getStoreId()), 'name' => Mage::getStoreConfig('trans_email/ident_' . $_reciever . '/name', $checkout->getStoreId())));
if ($copyTo && $copyMethod == 'copy') {
foreach ($copyTo as $email) {
$sendTo[] = array('email' => $email, 'name' => null);
}
}
$shippingMethod = '';
if ($shippingInfo = $checkout->getShippingAddress()->getShippingMethod()) {
$data = explode('_', $shippingInfo);
$shippingMethod = $data[0];
}
$paymentMethod = '';
if ($paymentInfo = $checkout->getPayment()) {
$paymentMethod = $paymentInfo->getMethod();
}
$items = '';
foreach ($checkout->getAllVisibleItems() as $_item) {
/* @var $_item Mage_Sales_Model_Quote_Item */
$items .= $_item->getProduct()->getName() . ' x ' . $_item->getQty() . ' ' . $checkout->getStoreCurrencyCode() . ' ' . $_item->getProduct()->getFinalPrice($_item->getQty()) . "\n";
}
$total = $checkout->getStoreCurrencyCode() . ' ' . $checkout->getGrandTotal();
foreach ($sendTo as $recipient) {
$mailTemplate->setDesignConfig(array('area' => Mage_Core_Model_App_Area::AREA_FRONTEND, 'store' => $checkout->getStoreId()))->sendTransactional($template, Mage::getStoreConfig('checkout/payment_failed/identity', $checkout->getStoreId()), $recipient['email'], $recipient['name'], array('reason' => $message, 'checkoutType' => $checkoutType, 'dateAndTime' => Mage::app()->getLocale()->date(), 'customer' => $checkout->getCustomerFirstname() . ' ' . $checkout->getCustomerLastname(), 'customerEmail' => $checkout->getCustomerEmail(), 'billingAddress' => $checkout->getBillingAddress(), 'shippingAddress' => $checkout->getShippingAddress(), 'shippingMethod' => Mage::getStoreConfig('carriers/' . $shippingMethod . '/title'), 'paymentMethod' => Mage::getStoreConfig('payment/' . $paymentMethod . '/title'), 'items' => nl2br($items), 'total' => $total));
}
$translate->setTranslateInline(true);
return $this;
}
示例10: __construct
/**
* set the quote information
* @param Mage_Sales_Model_Quote $quoteData
*/
public function __construct(Mage_Sales_Model_Quote $quoteData)
{
$customerModel = Mage::getModel('customer/customer');
$customerModel->load($quoteData->getCustomerId());
$this->id = $quoteData->getId();
$this->email = $quoteData->getCustomerEmail();
$this->store_name = $quoteData->getStore()->getName();
$created_at = new Zend_Date($quoteData->getCreatedAt(), Zend_Date::ISO_8601);
$this->created_date = $created_at->toString(Zend_Date::ISO_8601);
if ($quoteData->getShippingAddress()) {
$this->delivery_method = $quoteData->getShippingAddress()->getShippingDescription();
$this->delivery_total = $quoteData->getShippingAddress()->getShippingAmount();
}
$this->currency = $quoteData->getStoreCurrencyCode();
if ($payment = $quoteData->getPayment()) {
$this->payment = $payment->getMethod();
}
$this->couponCode = $quoteData->getCouponCode();
/**
* custom quote attributes
*/
$helper = Mage::helper('ddg');
$website = Mage::app()->getStore($quoteData->getStore())->getWebsite();
$customAttributes = $helper->getConfigSelectedCustomQuoteAttributes($website);
if ($customAttributes) {
$fields = Mage::getResourceModel('ddg_automation/quote')->getQuoteTableDescription();
foreach ($customAttributes as $customAttribute) {
if (isset($fields[$customAttribute])) {
$field = $fields[$customAttribute];
$value = $this->_getCustomAttributeValue($field, $quoteData);
if ($value) {
$this->_assignCustom($field, $value);
}
}
}
}
/**
* Billing address.
*/
if ($quoteData->getBillingAddress()) {
$billingData = $quoteData->getBillingAddress()->getData();
$this->billing_address = array('billing_address_1' => $this->_getStreet($billingData['street'], 1), 'billing_address_2' => $this->_getStreet($billingData['street'], 2), 'billing_city' => $billingData['city'], 'billing_region' => $billingData['region'], 'billing_country' => $billingData['country_id'], 'billing_postcode' => $billingData['postcode']);
}
/**
* Shipping address.
*/
if ($quoteData->getShippingAddress()) {
$shippingData = $quoteData->getShippingAddress()->getData();
$this->delivery_address = array('delivery_address_1' => $this->_getStreet($shippingData['street'], 1), 'delivery_address_2' => $this->_getStreet($shippingData['street'], 2), 'delivery_city' => $shippingData['city'], 'delivery_region' => $shippingData['region'], 'delivery_country' => $shippingData['country_id'], 'delivery_postcode' => $shippingData['postcode']);
}
/**
* Quote items.
* @var Mage_Sales_Model_Quote_Item $productItem
*/
foreach ($quoteData->getAllItems() as $productItem) {
$product = $productItem->getProduct();
if ($product) {
// category names
$categoryCollection = $product->getCategoryCollection()->addAttributeToSelect('name');
foreach ($categoryCollection as $cat) {
$categories = array();
$categories[] = $cat->getName();
$this->categories[]['Name'] = substr(implode(', ', $categories), 0, 244);
}
//get attribute set name
$attributeSetName = $this->_getAttributeSetName($product);
$this->products[] = array('name' => $productItem->getName(), 'sku' => $productItem->getSku(), 'qty' => (int) number_format($productItem->getData('qty'), 2), 'price' => (double) number_format($productItem->getPrice(), 2, '.', ''), 'attribute-set' => $attributeSetName);
} else {
// when no product information is available limit to this data
$this->products[] = array('name' => $productItem->getName(), 'sku' => $productItem->getSku(), 'qty' => (int) number_format($productItem->getData('qty'), 2), 'price' => (double) number_format($productItem->getPrice(), 2, '.', ''));
}
}
$this->quote_subtotal = (double) number_format($quoteData->getData('subtotal'), 2, '.', '');
$discountAmount = $quoteData->getData('subtotal') - $quoteData->getData('subtotal_with_discount');
$this->discount_amount = (double) number_format($discountAmount, 2, '.', '');
$this->quote_total = (double) number_format($quoteData->getData('grand_total'), 2, '.', '');
return true;
}
示例11: _getRecipientCustomer
/**
* Get customer object for recipient
*
* @param array $recipient
* @param Mage_Sales_Model_Quote $quote
*
* @return boolean|Mage_Customer_Model_Customer
*/
protected function _getRecipientCustomer(array $recipient, $quote)
{
if ($recipient['customer_id'] != 0) {
/* @var $customer Mage_Customer_Model_Customer */
$customer = Mage::getModel('customer/customer')->load($recipient['customer_id']);
} elseif ($quote) {
// Guest Abandon. Create Customer on the fly
$storeId = $recipient['store_id'];
$customer = Mage::getModel('customer/customer')->setFirstName($quote->getCustomerFirstname())->setLastName($quote->getCustomerLastname())->setEmail($quote->getCustomerEmail())->setStoreId($storeId)->setId($recipient['customer_id'])->setWebsiteId(Mage::getModel('core/store')->load($storeId)->getWebsiteId());
}
if (!$customer || false === $customer->getId()) {
return false;
}
return $customer;
}
示例12: _prepareGuestQuote
protected function _prepareGuestQuote(Mage_Sales_Model_Quote $quote)
{
$quote->setCustomerId(null)->setCustomerEmail($quote->getCustomerEmail())->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
return $this;
}