It is possible to create a completely new EAV increment model. This is where the magic happens when getting the next ids :)
Firstly you can see what the current model is by looking at the table eav_entity_type
under the column increment_model
. For example to order has the following set.
eav/entity_increment_numeric
You can create your new model and set it for orders via an install script.
class My_CustomEav_Model_Entity_Increment_New extends Mage_Eav_Model_Entity_Increment_Abstract
{
public function getNextId()
{
// Some magic here to get the unique vaue you want and return it
}
}
The table eav_entity_store
holds a few more pieces of important information. Here you can store increment_prefix varchar(20)
which is the prefix that is normally added to the increment, I think the default it 1, and increment_last_id varchar(50)
this stores the last id used for the entity type on a given store, note that without changing the table definition you will be limited to varchar(50)
, though that should be enough....maybe.
NOTE I have not tested this myself as I have never needed to but it should all work nicely if the ids are unique.
Yes you can, the tables you would want to have a look at are as follows:
sales_flat_order
,
sales_flat_order_item
,
These two tables basically contain all the information regarding an order, from address, delivery method etc. to products & qtys ordered.
You can relate them to each other as follows: the entity_id
field in sales_flat_order
is the order_id
field in sales_flat_order_item
.
The column named increment_id
in sales_flat_order
is the order number which is visible in the front- and back-end.
Best Answer
Yes you can. Change the column increment_last_id in the eav_entity_store table. You can also change the incremental prefix in that table. Make sure you change the value for the correct store id.