Author Topic: How to Reset the product_id back to 1?  (Read 2036 times)

PowerPal

  • Beginner
  • *
  • Posts: 5
How to Reset the product_id back to 1?
« on: November 06, 2009, 06:25:54 am »
I've been uploading products and testing everything but I noticed that the product id number keeps going up...so, how can I reset this to start again at 1?

Thanks

rb

  • Advanced
  • Full Member
  • *****
  • Posts: 1503
Re: How to Reset the product_id back to 1?
« Reply #1 on: November 06, 2009, 18:02:59 pm »
Since product_id is an internal value not shown on VM screens, I'm not sure why you'd want to reset this value.  (Yes, I know it's shown in URLs).

That said, I don't believe this can be done within VirtueMart, but it can be done as a MySQL database command.  If you have phpMyAdmin (or equivalent) available on your server AND if you're comfortable with performing raw database management commands (meaning you understand the risks of making an error), AND if you are using the default Joomla and VirtueMart database prefixes, the command to execute is:

ALTER TABLE jos_vm_product AUTO_INCREMENT = 1;

Note that if the Product table has existing products in it when you execute this command, it will NOT set it to 1, but will set it to the current maximum id plus 1.