[Skip to main content](#vessel-content)

#   random number

##

- **[Tierschutzfutter](/forum/user/42435-tierschutzfutter "View Tierschutzfutter's Profile")**
- [![Tierschutzfutter's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/42435-tierschutzfutter "View Tierschutzfutter's Profile") Topic Author
- [ Offline](/forum/user/42435-tierschutzfutter)

Less More

- Posts: 8
- Thank you received: 0
-
-

10 years 3 months ago [\#247194](#247194) by [Tierschutzfutter](/forum/user/42435-tierschutzfutter "View Tierschutzfutter's Profile")  *[random number](/forum/35-orders-management/885920-random-number#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")* was created by *[Tierschutzfutter](/forum/user/42435-tierschutzfutter "View Tierschutzfutter's Profile")*

-- 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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg4NTkyMC1yYW5kb20tbnVtYmVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Away](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

10 years 3 months ago [\#247195](#247195) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[random number](/forum/35-orders-management/885920-random-number#247195 "-- 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")*

Hi,

[ www.hikashop.com/support/documentation/6...r-documentation.html](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html)

There are two triggers not listed in our documentation Code:

onBeforeOrderNumberGenerate( &amp;$data, &amp;$result ) onBeforeInvoiceNumberGenerate( &amp;$data, &amp;$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 &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg4NTkyMC1yYW5kb20tbnVtYmVyP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.058 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
