Magento – Registration on Checkout page and then pay via PayPal

I have issue, after checkout on “checkout/onepage/success” get a user info using “order id”, something like:

$orderInfo = Mage::getModel('sales/order')->load($lastOrderId);
$customerId = $orderInfo->getCustomerId();

Order from user that registrated on Checkout page and then pay via PayPal become a “guest order”, and ofcourse in “Model(‘sales/order’)” customer id is null, and in DB this transaction and order looks like a “Guest order” that was made by PayPal account, not from Magento’s. Another payment systems working fine with registration on Checkout page, and after checkout I can get customer id.
The question is, how to get a “user id” from just registrated users in Magento site throught Checkout page and bought something via PayPal?

3 thoughts on “Magento – Registration on Checkout page and then pay via PayPal”

  1. you can load the user by email from customer model

    Mage::getModel('customer/customer')->loadByEmail($orderInfo->getBillingAddress()->getEmail());
    

    and more viable way to do this would be listening save_order_after event and detect if you are dealing with paypal checkout and add the customer to the order right away

  2. Doesn’t find any way, it probably Magento guys with PayPal guys should to talk about…
    But, I just rewrite a OnClick event of “Register” button on checkout page:

    <button type="button" class="button" onclick="window.location.href='/customer/account/create';">
    <span><span>Register</span></span>
    </button>
    

    Before there was “checkout.setMethod()”, I just sending user to registration page.

Leave a Reply

Your email address will not be published. Required fields are marked *