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

#   How to get HikaSerial number in a custom plugin

##

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

Less More

- Posts: 28
- Thank you received: 0
-
-

2 years 4 months ago [\#361973](#361973) by [RitchieM](/forum/user/46621-ritchiem "View RitchieM's Profile")  *[How to get HikaSerial number in a custom plugin](/forum/31-development/908369-how-to-get-hikaserial-number-in-a-custom-plugin#361973 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 4.4.5 -- PHP version -- : 8.2.20-nmm1  We create a custom plugin for the HikaShop. The plugin uses the onAfterOrderUpdate to take the placed order and forward the data to a CRM system. Some products have a HikaSerial randomgen package asigned. In the custom plugin I need to get the generated serialnumbers. Is there a direct way to get these numbers from the $order object? If not, is there a other smooth way or do I have to access the db directly?")* was created by *[RitchieM](/forum/user/46621-ritchiem "View RitchieM's Profile")*

-- HikaShop version -- : 5.1.0
-- Joomla version -- : 4.4.5
-- PHP version -- : 8.2.20-nmm1

We create a custom plugin for the HikaShop. The plugin uses the onAfterOrderUpdate to take the placed order and forward the data to a CRM system. Some products have a HikaSerial randomgen package asigned. In the custom plugin I need to get the generated serialnumbers. Is there a direct way to get these numbers from the $order object? If not, is there a other smooth way or do I have to access the db directly?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwODM2OS1ob3ctdG8tZ2V0LWhpa2FzZXJpYWwtbnVtYmVyLWluLWEtY3VzdG9tLXBsdWdpbj90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

2 years 4 months ago [\#362026](#362026) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[How to get HikaSerial number in a custom plugin](/forum/31-development/908369-how-to-get-hikaserial-number-in-a-custom-plugin#362026 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 4.4.5 -- PHP version -- : 8.2.20-nmm1  We create a custom plugin for the HikaShop. The plugin uses the onAfterOrderUpdate to take the placed order and forward the data to a CRM system. Some products have a HikaSerial randomgen package asigned. In the custom plugin I need to get the generated serialnumbers. Is there a direct way to get these numbers from the $order object? If not, is there a other smooth way or do I have to access the db directly?")*

Hello,

You will find details under : Code:

$order-&gt;order_serials

But you need to be sure that your plugin is called after the plugin "hikashop / serial".
Because the serial creation is also done during the "onAfterOrderUpdate" trigger, so that variable is filled at that moment.
If your plugin is called before, you won't be able to access the data ; when serials are created/assigned.
If the serials are already there (and the order status doesn't change), you will have to load the serials from the database. Loading the serials every time an HikaShop order is loaded would have some performance impacts.

Regards,

---

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

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

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

Less More

- Posts: 28
- Thank you received: 0
-
-

2 years 4 months ago -  2 years 4 months ago [\#362052](#362052) by [RitchieM](/forum/user/46621-ritchiem "View RitchieM's Profile")  Replied by *[RitchieM](/forum/user/46621-ritchiem "View RitchieM's Profile")* on topic *[How to get HikaSerial number in a custom plugin](/forum/31-development/908369-how-to-get-hikaserial-number-in-a-custom-plugin#362052 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 4.4.5 -- PHP version -- : 8.2.20-nmm1  We create a custom plugin for the HikaShop. The plugin uses the onAfterOrderUpdate to take the placed order and forward the data to a CRM system. Some products have a HikaSerial randomgen package asigned. In the custom plugin I need to get the generated serialnumbers. Is there a direct way to get these numbers from the $order object? If not, is there a other smooth way or do I have to access the db directly?")*

Obviously my plugin come first. The $order-&gt;order_serials is empty Code:

[order_serials] =&gt; stdClass Object ( [packs] =&gt; Array ( ) [serials] =&gt; Array ( )

How can I tell my plugin to wait for the hikashop serial plugin?
For the moment I do a database query which works but if I understood it right I have the risk of a race condition...

Regards
Richard

Last edit: 2 years 4 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile"). Reason: adding [code] tag

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwODM2OS1ob3ctdG8tZ2V0LWhpa2FzZXJpYWwtbnVtYmVyLWluLWEtY3VzdG9tLXBsdWdpbj90bXBsPW1hcmtkb3du) 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")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

2 years 4 months ago [\#362059](#362059) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[How to get HikaSerial number in a custom plugin](/forum/31-development/908369-how-to-get-hikaserial-number-in-a-custom-plugin#362059 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 4.4.5 -- PHP version -- : 8.2.20-nmm1  We create a custom plugin for the HikaShop. The plugin uses the onAfterOrderUpdate to take the placed order and forward the data to a CRM system. Some products have a HikaSerial randomgen package asigned. In the custom plugin I need to get the generated serialnumbers. Is there a direct way to get these numbers from the $order object? If not, is there a other smooth way or do I have to access the db directly?")*

Hello,

If you have the variable, then you're after HikaSerial.
But the trigger call doesn't apply that serial will be assigned or unassigned to the order ; thus the best for you would to be load the HikaSerial "order" class and call the function : loadSerialData($order_id)
It will perform the loading in the database and return it.

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwODM2OS1ob3ctdG8tZ2V0LWhpa2FzZXJpYWwtbnVtYmVyLWluLWEtY3VzdG9tLXBsdWdpbj90bXBsPW1hcmtkb3du) 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.064 seconds

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