Ezequielb 2 Posted April 8, 2020 Posted April 8, 2020 (edited) Hello, I need to use this function to generate a ramdon product reference number for PS 1.7.6.x. I need to assign this number to products in database as unique. How should I get this done? //Function to get random alphanumeric code function random_code() { // String of all numeric characters $start_letter = str_shuffle('ABCD'); $number = str_shuffle('0123456789'); $letter = str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); return substr(($start_letter), 0, 1).substr(($number), 0, 4).'-'.substr(($letter), 0, 1); } echo random_code(); // Result is a random number like: A6789-M Edited April 8, 2020 by Ezequielb (see edit history) Share this post Link to post Share on other sites
MrBraco2 0 Posted May 22, 2020 Posted May 22, 2020 (edited) Hi, Did you find your answer? What is the code you used and what file? I need the same thing . To make it unique, i selected the table ps_product in phpmyadmin and make it UNIQUE. Edited May 22, 2020 by MrBraco2 modification (see edit history) Share this post Link to post Share on other sites
Ezequielb 2 Posted May 22, 2020 Posted May 22, 2020 20 hours ago, MrBraco2 said: Hi, Did you find your answer? What is the code you used and what file? I need the same thing . To make it unique, i selected the table ps_product in phpmyadmin and make it UNIQUE. Hi, this was solved here.. best regards! Share this post Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now