jxdyzwh Posted September 23, 2013 Share Posted September 23, 2013 how to change order reference? now order reference is 9 Character,i wanto change order reference to 15 Character Link to comment Share on other sites More sharing options...
PascalVG Posted September 23, 2013 Share Posted September 23, 2013 Hi jx, do you still want it to be a random letter combination?? Link to comment Share on other sites More sharing options...
PascalVG Posted September 23, 2013 Share Posted September 23, 2013 The creation of a reference is done in Function generateReference(), which is located in classes/Order/Order.php: public static function generateReference() { return strtoupper(Tools::passwdGen(9, 'NO_NUMERIC')); // Change to 15 } Which uses the function passwdGen from file classes/tools.php: public static function passwdGen($length = 8, $flag = 'ALPHANUMERIC') { switch ($flag) { case 'NUMERIC': $str = '0123456789'; break; case 'NO_NUMERIC': $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; break; default: $str = 'abcdefghijkmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; break; } for ($i = 0, $passwd = ''; $i < $length; $i++) $passwd .= Tools::substr($str, mt_rand(0, Tools::strlen($str) - 1), 1); return $passwd; } You're lucky, the reference field is a varchar(32), so making it longer to 15 is no problem in the database. Only check the screens/PDF's etc if it still fits on the lines.. pascal Link to comment Share on other sites More sharing options...
vekia Posted September 23, 2013 Share Posted September 23, 2013 duplicated question: http://www.prestashop.com/forums/topic/276821-about-order-reference/ Nemo1 posted solution there Link to comment Share on other sites More sharing options...
Recommended Posts