- Posts: 61
- Thank you received: 3
Order Number
- demoisellegol
-
Topic Author
- Offline
Less
More
2 years 3 months ago #362619
by demoisellegol
Order Number was created by demoisellegol
-- url of the page with the problem -- : demoisellegol.fr
-- HikaShop version -- : 5.1.0
-- Joomla version -- : 5.1.2
-- PHP version -- : 8.1
Hi
how can set my order numbers to a random 8 digit number ?
thanks
-- HikaShop version -- : 5.1.0
-- Joomla version -- : 5.1.2
-- PHP version -- : 8.1
Hi
how can set my order numbers to a random 8 digit number ?
thanks
Please Log in or Create an account to join the conversation.
2 years 3 months ago - 2 years 3 months ago #362625
by Philip
Replied by Philip on topic Order Number
Hello,
In Component => HikaShop => Configuration, then Main tab, and finally Order part, you will find an input to define your order number, learn more in our documentation .
Regards
In Component => HikaShop => Configuration, then Main tab, and finally Order part, you will find an input to define your order number, learn more in our documentation .
Regards
Last edit: 2 years 3 months ago by Philip.
Please Log in or Create an account to join the conversation.
- demoisellegol
-
Topic Author
- Offline
Less
More
- Posts: 61
- Thank you received: 3
2 years 3 months ago #362629
by demoisellegol
Replied by demoisellegol on topic Order Number
I know where to change the code
I dont know the code
can you tell me what should i exactly put in that field for desired order number ?
I dont know the code
can you tell me what should i exactly put in that field for desired order number ?
Please Log in or Create an account to join the conversation.
- demoisellegol
-
Topic Author
- Offline
Less
More
- Posts: 61
- Thank you received: 3
2 years 3 months ago #362630
by demoisellegol
Replied by demoisellegol on topic Order Number
I managed to do what i want by reading the documentation
my problem is i want the orders IDs be a 5 digit RANDOM number not sequential
my problem is i want the orders IDs be a 5 digit RANDOM number not sequential
Please Log in or Create an account to join the conversation.
2 years 3 months ago #362634
by nicolas
Replied by nicolas on topic Order Number
Hi,
In that case, you need to develop a joomla plugin of the group "hikashop" and implement in it the event onBeforeOrderNumberGenerate(&$order, &$order_number)
It's quite simple with PHP's rand function ( www.php.net/manual/en/function.rand.php ):
Note that this code doesn't check if an order already exists with the randomly selected number. If you want to add that check, it's possible. You'll need to run a MySQL query on the hikashop_order table.
In that case, you need to develop a joomla plugin of the group "hikashop" and implement in it the event onBeforeOrderNumberGenerate(&$order, &$order_number)
It's quite simple with PHP's rand function ( www.php.net/manual/en/function.rand.php ):
Code:
function onBeforeOrderNumberGenerate(&$order, &$order_number){
$order_number = rand(10000, 99999);
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.054 seconds