Page 2 of 2

Re: Feature request: use random order number

Posted: 21 Feb 2024, 18:11
by mino182
Jan wrote: 21 Feb 2024, 16:58
there is no problem to add new variable {randomstring}, but the question still remains, how to prevent from possible duplicate?
Jan
{randomstring} could be based on timestamp...

Or something like {randomstring}{id}{randomstring}. And id will be with fixed lenght...

Re: Feature request: use random order number

Posted: 21 Feb 2024, 21:47
by keep2000
Jan wrote: 21 Feb 2024, 16:58 Hi, the questions:

- how to avoid possible duplicates with random number?
- the ID is still used in e.g. links, etc, so even if there is random number for order number (not order ID), there is still some chance, user can get the ID e.g. in links, etc. :idea:

there is no problem to add new variable {randomstring}, but the question still remains, how to prevent from possible duplicate?

Jan
The second issue isn't a significant problem I think. Of course, heavy users can dig out the information, although some platforms (like VirtueMart) use order number-based tracking URLs.

As for the first issue, VirtueMart uses order ID-based hash/token. This token doesn't directly contain the ID but generates a random unique string based on it. Or it could be based on the timestamp.
Alternatively, there's the plain old method: checking and regenerating until it's not already taken. For a 8-10 characters long alphanumeric string won't be too much conflict:) using numbers and capital letters for a 8 character long string there are 36^8 =2,821,109,907,456 variations if I'm right. For 10 characters it's 3,656,158,440,062,976

Re: Feature request: use random order number

Posted: 22 Feb 2024, 01:07
by Jan
Hi, added to feature request list:
https://github.com/PhocaCz/PhocaCart/issues/212

Jan