Jump to content

[SOLVED] How to Reset Product ID Numbers


Recommended Posts

Hi there, I had imported about 4000+ Items to my prestashop, and have gotten rid of all the products.
Now i seem to add a new product 1 by 1, and it adds an ID Number of 4226+

I would really like to get the Product ID Numbers to start from 1. If anyone can please tell me what table(s)
to edit in my PHPMyAdmin in order to accomplish this.

I tried "ALTER TABLE ps_product AUTO_INCREMENT = 1"
and
"ALTER TABLE ps_product_lang AUTO_INCREMENT = 1"

and nothing changed, added new product and it added 4228+

Hope to get some help from the community here.

Link to comment
Share on other sites

if your ps_product table is empty, then your code should work(I don't know why it doesn't work for you).
if there is any record left, you can only reset the number that is bigger than biggest one of table.

But for sure, the following statement will delete all data and reset the id from 1.

truncate table ps_product;



But, I suggest you don't reset the ids because table are connected, if you don't it correctly, it will cause error.
Here is one example. Assume you reset product id from 1, but you forget to clear ps_category_product table.

So please do it very carefully.

Link to comment
Share on other sites

Hi chino,

If you want to insert id=1, just do it directly in the mysql base, but I m not sure this can works.

The mysql command should works only if you remove every products first. the auto_increment value can't be inferior to an already existing id .

If you really want to wipe your database, simply delete all tables and then make a reinstallation

Regards,

Link to comment
Share on other sites

  • 3 years later...
×
×
  • Create New...