当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order::getCustomerPrefix方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order::getCustomerPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getCustomerPrefix方法的具体用法?PHP Mage_Sales_Model_Order::getCustomerPrefix怎么用?PHP Mage_Sales_Model_Order::getCustomerPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order的用法示例。


在下文中一共展示了Mage_Sales_Model_Order::getCustomerPrefix方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:29,代码来源:Submit.php

示例2: _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();
 }
开发者ID:hsq,项目名称:Ho_Customer,代码行数:51,代码来源:GuestOrders.php

示例3: _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;
 }
开发者ID:hsq,项目名称:Ho_Customer,代码行数:42,代码来源:Observer.php

示例4: _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;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:5,代码来源:Guest.php

示例5: _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;
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:16,代码来源:Create.php

示例6: getGenderCode

 /**
  * This method returns the customer gender code
  *
  * @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $quote
  * @return string
  */
 public function getGenderCode($quote)
 {
     $gender = $quote->getCustomerGender();
     if ($gender) {
         $attribute = Mage::getModel('eav/entity_attribute')->loadByCode('customer', 'gender');
         $option = $attribute->getFrontend()->getOption($gender);
         switch (strtolower($option)) {
             case 'male':
                 return 'M';
             case 'female':
                 return 'F';
         }
     }
     $gender = $quote->getCustomerPrefix();
     if ($gender) {
         switch (strtolower($gender)) {
             case 'herr':
             case 'mr':
                 return 'M';
             case 'frau':
             case 'mrs':
                 return 'F';
         }
     }
     return 'U';
 }
开发者ID:ratepay,项目名称:magento-module,代码行数:32,代码来源:Data.php

示例7: getPrefix

 /**
  * Retrieve the prefix
  *
  * @param Mage_Sales_Model_Order $order
  * @return string
  */
 public function getPrefix(Mage_Sales_Model_Order $order)
 {
     $gender = $order->getCustomerPrefix();
     if ($gender) {
         switch (strtolower($gender)) {
             case 'herr':
             case 'mr':
                 return 'MR';
             case 'frau':
             case 'mrs':
                 return 'MRS';
             case 'fräulein':
             case 'ms':
                 return 'MS';
         }
     }
     return '';
 }
开发者ID:Aya-Mousa,项目名称:HyperpayMagentoo,代码行数:24,代码来源:Data.php


注:本文中的Mage_Sales_Model_Order::getCustomerPrefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。