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 Checko开发者_Go百科ut 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?
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
this looks to be a regitered bug?
http://www.magentocommerce.com/bug-tracking/issue/?issue=11133
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.
精彩评论