I have a client which uses a ERP System to handle all Magento orders. For this reason I have created a module which exports all orders as a csv file. In Addition the ERP System of my client expect a continuous customer id, but the problem is that only registered customers get a customer id, so guests don't have a customer id, but customers ids should be continuous like the following example:
40000, 40001, 40002, 40003 registered customer, guest, guest, registed customer
Is there a way in Magento to grab the last customer id and add the guest temporary as new customer, so that Magento get notice of the new last customer id and remove this temporary customer after this action again?
I am looking for something like the following pseudocode:
$lastCustomerId = $customerCollection->getLastId(); $newId = $lastCustomerId + 1; $customer = Mage::getModel("customer/customer"); $customer->setId($newId); $customer->save(); // write the id to the file $customer = Mage::getModel('customer/customer')->load($newId); $customer->delete();