random number

  • Posts: 8
  • Thank you received: 0
8 years 3 months ago #247194

-- 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.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 3 months ago #247195

Hi,

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

There are two triggers not listed in our documentation

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.056 seconds
Powered by Kunena Forum