Jump to content

Automatically generate Product Reference code


Recommended Posts

Hi, i am trying to alter the code when a product is created so that the Reference code is given the same value as the product ID.

The reason is I would like the Reference code to be automatically generated so I do not need to stay adding in a unique reference with each product added.

Can anyone tell me if it's possible and what the code should be? If not is there alternative options?


Link to comment
Share on other sites

Hi Rocky thanks for the reply.

I'm not too familiar with how Prestashop works so I'm not sure how to apply the code mentioned in the other post.

I would like that when creating a product it automatically generates the Reference Code, so it would be during the creation of a product, is that possible?

Thanks again

Link to comment
Share on other sites

I would say thats possible, but if you dont know how to apply the other threads code then trying to make it happen automatically during product import probably isnt the best option for you.

You can reset all your product references to the same as the product id's using an SQL command in phpMyAdmin,

UPDATE ps_product SET reference=id_product

back up the database first, you wont have the option to undo this. Also, check that I have the table name correct, it may be ps_product_lang.

I resolve this issue by producing a unique reference during the export of my csv file using php.. I use a combination of information the supplier provides about each product. Sounds like you are adding products manually in the back office though, setting up automated csv export is another challenge for another day, unless you're either going to spend the time learning to write code, or pay someone else to do it for you.

Link to comment
Share on other sites

  • 9 years later...
  • 1 month later...
  • 6 months later...
  • 8 months later...
18 hours ago, MILL3RDK said:


How do i install this to my Prestashop ??

The Read Me files dosn't tell my anything.... ;-(

You just add all files in one folder. You zip the folder and you install it from presta panel. Or you can upload the folder in modules folder and after continue install from presta panel.

Link to comment
Share on other sites

  • 2 months later...

Did someone successfully installed this module? I tried to install it from presta panel but it doesn't work. Then I tried to upload the module in the modules folder via FTP but I can't complete installation because I can't see the module in the BO (modules > module catalog).


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...