Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link a guest order to an existing customer account in magento

Tags:

magento

I want to link a guest order to a existing account in Magento. Does someone know which fields on which tables I have to change to accomplish this?

Is there maybe a easier way?

like image 474
Lexperts Avatar asked Jul 10 '12 08:07

Lexperts


1 Answers

This also seem to work..

$order_id = 5;  // Your Order ID
$customer_id = 7;  //Customer ID

$_order = Mage::getModel('sales/order')->load($order_id);

if($_order->getCustomerId() == NULL){
    $_order->setCustomerId($customer_id);
    $_order->save();
}
like image 72
Renon Stewart Avatar answered Oct 19 '22 23:10

Renon Stewart