Exemplo n.º 1
0
 private function initializeCustomer()
 {
     if ($this->proxyOrder->isCheckoutMethodGuest()) {
         $this->quote->setCustomerId(null)->setCustomerEmail($this->proxyOrder->getBuyerEmail())->setCustomerFirstname($this->proxyOrder->getCustomerFirstName())->setCustomerLastname($this->proxyOrder->getCustomerLastName())->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
     }
     $this->quote->assignCustomer($this->proxyOrder->getCustomer());
 }
Exemplo n.º 2
0
 /**
  * @param  $customerInfo
  *   [customer] => Array
  *       (
  *           [bindId] => 1 (int)
  *           [website] => 1 (int)
  *           [group] => 1 (int)
  *           [newsletter] => 0|1
  *       )
  *
  * @param  $checkoutMode
  * @param  $billingAddress
  * @param  $needNotifyCustomer
  * @return Ess_M2ePro_Model_MagentoSales
  */
 protected function _assignCustomer($customerInfo, $checkoutMode, $billingAddress, $needNotifyCustomer)
 {
     $customer = Mage::getModel('customer/customer');
     switch ($checkoutMode) {
         default:
         case Ess_M2ePro_Model_Accounts::ORDERS_CUSTOMER_MODE_GUEST:
             $this->_quote->setCustomerId(null)->setCustomerEmail($billingAddress['email'])->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
             return $this;
         case Ess_M2ePro_Model_Accounts::ORDERS_CUSTOMER_MODE_NEW:
             // Register each customer
             // If we have customer with selected email - assign customer to quote
             $customer->setWebsiteId($customerInfo['website']);
             // Try to use storeId for customer
             $customer->loadByEmail($billingAddress['email']);
             if ($customer->getId()) {
                 // Customer this such email already exist
                 // If this customer need confirmation, manual activate
                 if ($customer->getConfirmation() && $customer->isConfirmationRequired()) {
                     $customer->setConfirmation(null);
                     $customer->save();
                 }
             } else {
                 // We need to create customer and register it
                 $customer = $this->_createCustomer($billingAddress, $customerInfo['website'], $customerInfo['group'], $needNotifyCustomer, $customerInfo['newsletter']);
             }
             break;
         case Ess_M2ePro_Model_Accounts::ORDERS_CUSTOMER_MODE_EXIST:
             if (!$customerInfo['bindId']) {
                 throw new LogicException('The customer ID was not specified in eBay account settings for Predefined customer mode. ');
             }
             // Assign all checkout to single account
             // Load account
             $customer = Mage::getModel('customer/customer')->load($customerInfo['bindId']);
             break;
     }
     if (!$customer->getId()) {
         // Not found - Customer
         throw new LogicException('Cannot find customer for order. It is not existed or was deleted.');
     }
     $this->_quote->assignCustomer($customer);
 }
Exemplo n.º 3
0
 /**
  * Prepare quote for guest checkout order submit
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return Mage_Checkout_Model_Api_Resource_Customer
  */
 protected function _prepareGuestQuote(Mage_Sales_Model_Quote $quote)
 {
     $quote->setCustomerId(null)->setCustomerEmail($quote->getBillingAddress()->getEmail())->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
     return $this;
 }