Question

This SO Question has two answers:

  1. Set the AUTO_INCREMENT for the customer_entity table.
  2. Set the increment_prefix and increment_last_id for the customer entity in the entity_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.

Was it helpful?

Solution

Only the second of the two options will actually adjust the increment_id of the customer entity. The first method will change the entity_id field instead of the increment_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. See Mage_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.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top