This SO Question has two answers:
- Set the
AUTO_INCREMENT
for thecustomer_entity
table. - Set the
increment_prefix
andincrement_last_id
for thecustomer
entity in theentity_store
table.
The second seems more correct (or at least more internally consistent with Magento), but it doesn't seem to work as far as I can tell. I've tried it multiple times with different configurations (with store_id 0, store_id 1 and setting the increment_per_store in eav_entity_type
to 1 for customer), but each time I register as a new customer that customer's increment_id remains NULL
and the entity_id increments from 1.
I'm reasonably sure the AUTO_INCREMENT
approach will work, but given the fact that the increment_last_id
works for order numbers, the second approach has a number of upvotes and seems more Magento-like I'd like to understand if that answer is more correct and I'm just doing it wrong.
Best Answer
Only the second of the two options will actually adjust the
increment_id
of the customer entity. The first method will change theentity_id
field instead of theincrement_id
. So I think you are correct in favoring the second option.As far as getting that method to work, Magento will only use the
eav_entity_store.increment_last_id
for the customer entities when a "Generate Human-Friendly Customer ID" setting is set to "Yes" in the config. SeeMage_Customer_Model_Resource_Customer::setNewIncrementId
for where this check happens happens.You can find this setting in the Magento admin at System -> Configuration -> Customer Configuration -> Create New Account Options -> Generate Human-Friendly Customer ID.