Question

In the admin panel under the menu item Customers > Manage Customers. When you click on a customer it shows all their customer information.

The problem is if I checkout as a guest and use the same email i use when i'm logged in the record does not get stored in my recent orders. Is this functionality standard? Is there a way to associate the emails so even if they checkout as a guest it still gets recorded in the customer information > recent orders section?

I've looked through the configuration settings for customer configuration and checkout but to no avail.

It only shows under Sales > Orders.

Are you allowed to store information if they're a guest?

Was it helpful?

Solution

By default when a customer check out as a register user magento will store the customer info and link the customer to existing order using:

Table : sales_flat_order
   - customer_id        : numeric customer id
   - customer_is_guest  : bool - add clickable link in sales order admin

Therefore you could create a custom module. Then using an observer you could

  1. Check if the customer is checking out as guest
  2. If there is a existing customer with the same email
  3. Update the order accordingly.

Please note this method may assign the order to wrong user if someone existing customer mistype there email

Take a look at Magento - Wiki - Customize Magento using Event/Observer

In config.xml

...
<events>
  <sales_order_place_before>
    <observers>
      <sales_order_place_after_observer>
        <type>singleton</type>
        <class>convertcustomer/observer</class>
        <method>checkCustomerRecord</method>
      </sales_order_place_after_observer>
    </observers>
  </sales_order_place_before>     
</events>
...

In observer.php

Class MagePal_Model_ConvertCustomer_Observer{
    function checkCustomerRecord($observer){
        $order = $observer->getOrder();

        // if guest
        if(!$order->getCustomerId()){
            $storeId = $order->getStoreId()
            $websiteId = Mage::getModel('core/store')->load($storeId)->getWebsiteId();

            $customer = Mage::getModel("customer/customer"); 
            $customer->setWebsiteId($websiteId); 
            $customer->loadByEmail($email);

            //if email found
            if($customer->getId()){
                $order->setCustomerId($customer->getId());
                $order->setCustomerIsGuest(0);
            }
        }
    }

}

OTHER TIPS

I suppose recent orders are being filtered not by customer email address, but by it's ID otherwise I can place an order for random email address that is registered on that website and it will be assigned to him even if that customer didn't purchase anything (for example he was on that website 1 year ago). :) so it's more for security reasons. There's a possibility to login during checkout, so customer should use it.

I agree with @dsitovs here that if we assign guest checkout order to email matched customer then we are blind.

Same qst: what if I type my email wrong and system associates my order with other customer?

Magento Behaviour

When customer checkout as guest, then that means he/she want to remain anonymous with the system. However, if he/she later want to see that order associated with his/her account then it needs manual work.

There a simple extension that I have built, allows you to relate such customer with their orders. https://www.magentocommerce.com/magento-connect/relate-customer-with-order.html

I am posting this answer so that someone will get benefited.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top