本文整理汇总了PHP中Mage_Sales_Model_Quote::getCustomerFirstname方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getCustomerFirstname方法的具体用法?PHP Mage_Sales_Model_Quote::getCustomerFirstname怎么用?PHP Mage_Sales_Model_Quote::getCustomerFirstname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getCustomerFirstname方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}
示例4: _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;
}