本文整理汇总了PHP中Mage_Sales_Model_Order::getCustomerName方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getCustomerName方法的具体用法?PHP Mage_Sales_Model_Order::getCustomerName怎么用?PHP Mage_Sales_Model_Order::getCustomerName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getCustomerName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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());
}
示例2: _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);
}
示例3: 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;
}
示例4: _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);
}
示例5: sendEmailNotification
/**
* Sends notification mail for selected shipping rate
*
* The code for this functionality is based on Mage_Sales_Model_Order::sendNewOrderEmail()
*
* @param Mage_Sales_Model_Order $order
* @return boolean
* @throws Exception
* @see Mage_Sales_Model_Order
*/
public function sendEmailNotification($order)
{
if (strncmp($order->getShippingMethod(), 'shippingrates_', 14) != 0) {
return false;
}
$notificationMail = $order->getShippingCarrier()->getNotificationMail($order->getShippingMethod());
if (!strlen(trim($notificationMail))) {
return false;
}
$storeId = $order->getStore()->getId();
// Start store emulation process
$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
try {
// Retrieve specified view block from appropriate design package (depends on emulated store)
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true);
$paymentBlock->getMethod()->setStore($storeId);
$paymentBlockHtml = $paymentBlock->toHtml();
} catch (Exception $exception) {
// Stop store emulation process
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
throw $exception;
}
// Stop store emulation process
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
// Retrieve corresponding email template id and customer name
if ($order->getCustomerIsGuest()) {
$templateId = Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
$customerName = $order->getBillingAddress()->getName();
} else {
$templateId = Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_TEMPLATE, $storeId);
$customerName = $order->getCustomerName();
}
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($notificationMail);
$mailer->addEmailInfo($emailInfo);
// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_IDENTITY, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId($templateId);
$mailer->setTemplateParams(array('order' => $order, 'billing' => $order->getBillingAddress(), 'payment_html' => $paymentBlockHtml));
$mailer->send();
return true;
}
示例6: _prepareCustomerData
/**
* prepare customer data to make requests
*
* @param Mage_Sales_Model_Order $mOrder
*
* @return array
*/
private function _prepareCustomerData($mOrder)
{
$aCustomerData['nfe.CPF'] = str_replace(array('.', '/', '-'), array('', '', ''), $mOrder->getCustomerTaxvat());
$aCustomerData['nfe.xNome'] = $mOrder->getCustomerName();
$aCustomerData['nfe.indIEDest'] = 9;
$mShipping = $mOrder->getShippingAddress();
$shippingStreet = $mShipping->getStreet();
$aCustomerData['nfe.enderDest']['nfe.xLgr'] = (string) trim($shippingStreet[0]);
$aCustomerData['nfe.enderDest']['nfe.nro'] = (string) trim($shippingStreet[1]);
if (isset($shippingStreet[2]) && $shippingStreet[2]) {
$aCustomerData['nfe.enderDest']['nfe.xCpl'] = (string) trim($shippingStreet[2]);
}
$aCustomerData['nfe.enderDest']['nfe.xBairro'] = trim($shippingStreet[3]);
$aCustomerData['nfe.enderDest']['nfe.fone'] = (string) trim(str_replace(array('-', ' ', '(', ')'), array('', '', '', ''), $mShipping->getTelephone()));
$shippingCity = $mShipping->getCity();
if (is_int($shippingCity)) {
$aCustomerData['nfe.enderDest']['nfe.cMun'] = $shippingCity;
$aCustomerData['nfe.enderDest']['nfe.xMun'] = Mage::getModel('easynfe_nfe/directory_country_region_city')->load(trim($shippingCity))->getName();
} else {
$shippingCityId = Mage::getModel('easynfe_nfe/directory_country_region_city')->load(trim($shippingCity), 'NAME')->getId();
$aCustomerData['nfe.enderDest']['nfe.cMun'] = $shippingCityId;
$aCustomerData['nfe.enderDest']['nfe.xMun'] = $shippingCity;
}
$aCustomerData['nfe.enderDest']['nfe.UF'] = Mage::getModel('directory/region')->load($mShipping->getRegionId())->getCode();
$aCustomerData['nfe.enderDest']['nfe.cPais'] = Mage::getModel('easynfe_nfe/directory_country')->load($mShipping->getCountryId(), 'country_id')->getId();
$aCustomerData['nfe.enderDest']['nfe.xPais'] = Mage::app()->getLocale()->getCountryTranslation($mShipping->getCountryId());
$aCustomerData['nfe.enderDest']['nfe.CEP'] = str_replace('-', '', $mShipping->getPostcode());
return $aCustomerData;
}
示例7: _filterOrder
/**
* @param Mage_Sales_Model_Order $order
* @param string $type
*
* @return Bronto_Common_Model_Email_Template_Filter
*/
protected function _filterOrder(Mage_Sales_Model_Order $order, $type = 'order')
{
if (!in_array('order', $this->_filteredObjects)) {
$this->setStoreId($order->getStoreId());
$index = 1;
foreach ($order->getAllItems() as $item) {
if (!$item->getParentItem()) {
$this->_filterOrderItem($item, $index);
$index++;
}
}
// Add Related Content
$this->_items = $order->getAllItems();
// Order may not be a shippable order
$shipAddress = 'N/A';
$shipDescription = 'N/A';
if ($order->getIsNotVirtual()) {
$shipAddress = $order->getShippingAddress()->format('html');
$shipDescription = $order->getShippingDescription();
}
// Check for guest orders
$customerName = $order->getCustomerIsGuest() ? $order->getBillingAddress()->getName() : $order->getCustomerName();
$this->setField('orderIncrementId', $order->getIncrementId());
$this->setField('orderCreatedAt', $order->getCreatedAtFormated('long'));
$this->setField('orderBillingAddress', $order->getBillingAddress()->format('html'));
$this->setField('orderShippingAddress', $shipAddress);
$this->setField('orderShippingDescription', $shipDescription);
$this->setField('orderCustomerName', $customerName);
$this->setField('orderStatusLabel', $order->getStatusLabel());
$this->setField('orderItems', $this->_filterOrderItems($order));
$this->_respectDesignTheme();
$totals = $this->_getTotalsBlock(Mage::getSingleton('core/layout'), $order, 'sales/order_totals', 'order_totals');
$this->setField('orderTotals', $totals->toHtml());
$this->_filteredObjects[] = 'order';
}
return $this;
}
示例8: _sendTransactionalMail
/**
* Send transactional email to customer.
*
* @param Mage_Sales_Model_Order $order Order object.
*
* @return void
*/
public function _sendTransactionalMail($order)
{
Mage::getModel('core/email_template')->sendTransactional(Mage::getStoreConfig(self::XML_PATH_CONFIG_EMAIL_TEMPLATE, $order->getStoreId()), Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY), $order->getCustomerEmail(), $order->getCustomerName(), array('ratingUrl' => $this->_getRatingUrl($order), 'imageUrl' => $this->_getImageUrl($order)), $order->getStoreId());
}