本文整理汇总了PHP中Mage_Sales_Model_Order::getCustomerFirstname方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getCustomerFirstname方法的具体用法?PHP Mage_Sales_Model_Order::getCustomerFirstname怎么用?PHP Mage_Sales_Model_Order::getCustomerFirstname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::getCustomerFirstname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: 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;
}
示例3: 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;
}
示例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: _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;
}
示例6: buildCustomer
/**
* Build up the customers data onto an object
*
* @param Mage_Sales_Model_Order $order
*
* @return array
*/
private function buildCustomer(Mage_Sales_Model_Order $order, $includeId = true)
{
$customer = array('firstName' => $order->getCustomerFirstname(), 'lastName' => $order->getCustomerLastname(), 'email' => $order->getCustomerEmail(), 'phone' => $order->getBillingAddress()->getTelephone());
// Shall we include the customer ID?
if ($includeId) {
$customer['id'] = $this->getBraintreeId();
}
// Handle empty data with alternatives
if (empty($customer['firstName'])) {
$customer['firstName'] = $order->getBillingAddress()->getFirstname();
}
if (empty($customer['lastName'])) {
$customer['lastName'] = $order->getBillingAddress()->getLastname();
}
if (empty($customer['email'])) {
$customer['email'] = $order->getBillingAddress()->getEmail();
}
return $customer;
}
示例7: addBuyerInfo
/**
* This adds the buyer information to the invoice.
*
* @param Bitpay\Invoice $invoice
* @param Mage_Sales_Model_Order $order
* @return Bitpay\Invoice
*/
private function addBuyerInfo($invoice, $order)
{
if (false === isset($invoice) || true === empty($invoice) || false === isset($order) || true === empty($order)) {
$this->debugData('[ERROR] In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): missing or invalid invoice or order parameter.');
throw new \Exception('In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): missing or invalid invoice or order parameter.');
} else {
$this->debugData('[INFO] In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): function called with good invoice and order parameters.');
}
$buyer = new Bitpay\Buyer();
if (false === isset($buyer) || true === empty($buyer)) {
$this->debugData('[ERROR] In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): could not construct new BitPay buyer object.');
throw new \Exception('In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): could not construct new BitPay buyer object.');
}
$buyer->setFirstName($order->getCustomerFirstname());
$buyer->setLastName($order->getCustomerLastname());
if (Mage::getStoreConfig('payment/bitpay/fullscreen')) {
$address = $order->getBillingAddress();
} else {
$quote = Mage::getSingleton('checkout/session')->getQuote();
$address = $quote->getBillingAddress();
}
$street = $address->getStreet1();
if (null !== $street && '' !== $street) {
$buyer->setAddress(array($street, $address->getStreet2(), $address->getStreet3(), $address->getStreet4()));
}
$region = $address->getRegion();
$regioncode = $address->getRegionCode();
if (null !== $regioncode && '' !== $regioncode) {
$buyer->setState($regioncode);
} else {
if (null !== $region && '' !== $region) {
$buyer->setState($region);
}
}
$country = $address->getCountry();
if (null !== $country && '' !== $country) {
$buyer->setCountry($country);
}
$city = $address->getCity();
if (null !== $city && '' !== $city) {
$buyer->setCity($city);
}
$postcode = $address->getPostcode();
if (null !== $postcode && '' !== $postcode) {
$buyer->setZip($postcode);
}
$email = $address->getEmail();
if (null !== $email && '' !== $email) {
$buyer->setEmail($email);
}
$telephone = $address->getTelephone();
if (null !== $telephone && '' !== $telephone) {
$buyer->setPhone($telephone);
}
$invoice->setBuyer($buyer);
return $invoice;
}
示例8: _createCustomerName
protected function _createCustomerName(Mage_Sales_Model_Order $order)
{
$data = array('firstName' => $order->getCustomerFirstname(), 'middleName' => strlen($order->getCustomerMiddlename()) > 0 ? $order->getCustomerMiddlename() : null, 'lastName' => $order->getCustomerLastname(), 'prefix' => strlen($order->getCustomerPrefix()) > 0 ? $order->getCustomerPrefix() : null, 'suffix' => strlen($order->getCustomerSuffix()) > 0 ? $order->getCustomerSuffix() : null);
return $data;
}
示例9: _setCustomerData
/**
* Set Customer information on the payload
*
* @param Mage_Sales_Model_Order
* @param IOrderCustomer
* @return self
*/
protected function _setCustomerData(Mage_Sales_Model_Order $order, IOrderCustomer $payload)
{
$payload->setFirstName($order->getCustomerFirstname())->setLastName($order->getCustomerLastname())->setMiddleName($order->getCustomerMiddlename())->setHonorificName($order->getCustomerPrefix())->setGender($this->_getCustomerGender($order))->setCustomerId($this->_getCustomerId($order))->setEmailAddress($order->getCustomerEmail())->setTaxId($order->getCustomerTaxvat())->setIsTaxExempt($order->getCustomer()->getTaxExempt());
$dob = $this->_getAsDateTime($order->getCustomerDob());
if ($dob) {
$payload->setDateOfBirth($dob);
}
return $this;
}
示例10: addBuyerInfo
/**
* This adds the buyer information to the invoice.
*
* @param Bitpay\Invoice $invoice
* @param Mage_Sales_Model_Order $order
* @return Bitpay\Invoice
*/
private function addBuyerInfo($invoice, $order)
{
if (false === isset($invoice) || true === empty($invoice) || false === isset($order) || true === empty($order)) {
$this->debugData('[ERROR] In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): missing or invalid invoice or order parameter.');
throw new \Exception('In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): missing or invalid invoice or order parameter.');
} else {
$this->debugData('[INFO] In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): function called with good invoice and order parameters.');
}
$buyer = new Bitpay\Buyer();
if (false === isset($buyer) || true === empty($buyer)) {
$this->debugData('[ERROR] In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): could not construct new BitPay buyer object.');
throw new \Exception('In Bitpay_Core_Model_Method_Bitcoin::addBuyerInfo(): could not construct new BitPay buyer object.');
}
$buyer->setFirstName($order->getCustomerFirstname());
$buyer->setLastName($order->getCustomerLastname());
$address = $order->getBillingAddress();
if (!empty($address->getStreet1())) {
$buyer->setAddress(array($address->getStreet1(), $address->getStreet2(), $address->getStreet3(), $address->getStreet4()));
}
if (!empty($address->getRegionCode())) {
$buyer->setState($address->getRegionCode());
} else {
if (!empty($address->getRegion())) {
$buyer->setState($address->getRegion());
}
}
if (!empty($address->getCountry())) {
$buyer->setCountry($address->getCountry());
}
if (!empty($address->getCity())) {
$buyer->setCity($address->getCity());
}
if (!empty($address->getPostcode())) {
$buyer->setZip($address->getPostcode());
}
if (!empty($address->getEmail())) {
$buyer->setEmail($address->getEmail());
}
if (!empty($address->getTelephone())) {
$buyer->setPhone($address->getTelephone());
}
$invoice->setBuyer($buyer);
return $invoice;
}
示例11: loadData
/**
* Loads the buyer info from a Magento order model.
*
* @param Mage_Sales_Model_Order $order the order model.
*/
public function loadData(Mage_Sales_Model_Order $order)
{
$this->_firstName = $order->getCustomerFirstname();
$this->_lastName = $order->getCustomerLastname();
$this->_email = $order->getCustomerEmail();
}
示例12: 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;
}
示例13: loadData
/**
* Loads the order info from a Magento order model.
*
* @param Mage_Sales_Model_Order $order the order model.
*/
public function loadData(Mage_Sales_Model_Order $order)
{
$this->_orderNumber = $order->getId();
$this->_externalOrderRef = $order->getRealOrderId();
$this->_createdDate = $order->getCreatedAt();
$this->_paymentProvider = $order->getPayment()->getMethod();
$this->_orderStatus = Mage::getModel('nosto_tagging/meta_order_status', array('code' => $order->getStatus(), 'label' => $order->getStatusLabel()));
foreach ($order->getAllStatusHistory() as $item) {
/** @var Mage_Sales_Model_Order_Status_History $item */
$this->_orderStatuses[] = Mage::getModel('nosto_tagging/meta_order_status', array('code' => $item->getStatus(), 'label' => $item->getStatusLabel(), 'createdAt' => $item->getCreatedAt()));
}
$this->_buyer = Mage::getModel('nosto_tagging/meta_order_buyer', array('firstName' => $order->getCustomerFirstname(), 'lastName' => $order->getCustomerLastname(), 'email' => $order->getCustomerEmail()));
foreach ($order->getAllVisibleItems() as $item) {
/** @var $item Mage_Sales_Model_Order_Item */
$this->_items[] = $this->buildItem($item, $order);
}
if ($this->includeSpecialItems) {
if (($discount = $order->getDiscountAmount()) > 0) {
/** @var Nosto_Tagging_Model_Meta_Order_Item $orderItem */
$this->_items[] = Mage::getModel('nosto_tagging/meta_order_item', array('productId' => -1, 'quantity' => 1, 'name' => 'Discount', 'unitPrice' => $discount, 'currencyCode' => $order->getOrderCurrencyCode()));
}
if (($shippingInclTax = $order->getShippingInclTax()) > 0) {
/** @var Nosto_Tagging_Model_Meta_Order_Item $orderItem */
$this->_items[] = Mage::getModel('nosto_tagging/meta_order_item', array('productId' => -1, 'quantity' => 1, 'name' => 'Shipping and handling', 'unitPrice' => $shippingInclTax, 'currencyCode' => $order->getOrderCurrencyCode()));
}
}
}
示例14: createHashForOrder
/**
* Build a hash over some unmodifiable(!) order properties.
*
* @param Mage_Sales_Model_Order $order
* @return string
*/
public function createHashForOrder(Mage_Sales_Model_Order $order)
{
$orderHash = $order->getId();
$orderHash .= $order->getIncrementId();
$orderHash .= $order->getQuoteId();
$orderHash .= $order->getCustomerEmail();
$orderHash .= $order->getCustomerFirstname();
$orderHash .= $order->getCustomerLastname();
$orderHash .= $order->getShippingMethod();
$orderHash .= $order->getStoreName();
$orderHash .= $order->getGrandTotal();
return hash("sha512", $orderHash);
}
示例15: addCustomerData
/**
* Add customer data to PaynetEasy payment
*
* @param PaynetTransaction $paynetTransaction PaynetEasy payment transaction
* @param MageOrder $mageOrder Magento order
*
* @return PaynetTransaction PaynetEasy payment transaction
*/
protected function addCustomerData(PaynetTransaction $paynetTransaction, MageOrder $mageOrder)
{
$mageAddress = $mageOrder->getBillingAddress();
$paynetTransaction->getPayment()->getCustomer()->setEmail($mageAddress->getEmail())->setFirstName($mageOrder->getCustomerFirstname())->setLastName($mageOrder->getCustomerLastname())->setIpAddress($mageOrder->getRemoteIp());
}