2

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?

8

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);
            }
        }
    }

}
  • Thanks for giving me another solution, could you push me in the right direction of how do go about this... tutorial maybe for writing these methods. I presume it would reside in success.phtml? Does that seem fitting? – thismethod Jan 29 '15 at 22:49
  • Take a look at my update – Renon Stewart Jan 29 '15 at 23:50
  • You're awesome, i'll give it a shot. – thismethod Feb 7 '15 at 0:26
  • not working any ideas? – Yehuda Schwartz Mar 31 '16 at 16:09
  • $customer->loadByEmail($email); should be $customer->loadByEmail($order->getCustomerEmail()); – Renon Stewart Mar 31 '16 at 20:06
3

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 had to re-read that a few times to wrap my brain around what you were saying. You made a very valid point. Perhaps a random guest checks out and uses some email address that isn't his and it gets attached to a members account that just happens to have that same email; something common perhaps like smith@gmail.com or something. hmmmm – thismethod Jan 28 '15 at 20:10
  • yes, exactly ;) sorry if I confused you – dsitovs Jan 28 '15 at 20:14
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.