Ezequielb 0 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 (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 0 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