Skip to main content

random number

More
10 years 1 month ago #247194 by Tierschutzfutter
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.6.0
-- PHP version -- : 5.2
-- Browser(s) name and version -- : Firefox

Hello,

i have a question regarding invoice and order numbers. Is it possible to have a random number? If this is not possible can i have a random unique number if order was created?

Reason:
We want to sell voucher and every voucher has to have a unique id.

Kind regards
Michael

Please Log in or Create an account to join the conversation.

More
10 years 1 month ago #247195 by Jerome
Replied by Jerome on topic random number
Hi,

www.hikashop.com/support/documentation/6...r-documentation.html

There are two triggers not listed in our documentation
Code:
onBeforeOrderNumberGenerate( &$data, &$result ) onBeforeInvoiceNumberGenerate( &$data, &$result )
the first parameter $data is generally the order object and $result is a string where you can put the number you generated (to override the default behavior).

Thanks to that trigger you can have a custom plugin which will give a random number for your "order number".
You can see to generate several random numbers and perform a little database query to check that you do not have duplicates (generating several random avoid to perform a query loop).

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

Time to create page: 0.167 seconds
Powered by Kunena Forum