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

#   How to debug a serial generator plugin?

##

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

Less More

- Posts: 11
- Thank you received: 0
-
-

10 years 9 months ago -  10 years 9 months ago [\#229588](#229588) by [yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")  *[How to debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229588 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")* was created by *[yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")*

-- HikaShop version -- : 2.6.1
-- HikaSerial version -- : 1.10.2
-- Joomla version -- : 3.4.8

Hi,
I'm working on a custom serial generator plugin.
Now I need to debug my code.

But I can't find a way to execute/call the generate hook/method.
Can you tell me the url to manually call it for a certain order ID / pack ID?
That would make thinks way easier for me.

Thanks!

Last edit: 10 years 9 months ago by [yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE0LWhpa2FzZXJpYWwvODgyMjMxLWhvdy10by1kZWJ1Zy1hLXNlcmlhbC1nZW5lcmF0b3ItcGx1Z2luP3RtcGw9bWFya2Rvd24=) 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: 26395
- Thank you received: 4077
-
- [](http://obsi.dev)
-

10 years 9 months ago [\#229607](#229607) 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 debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229607 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")*

Hi,

In order to test my generator plugins in HikaSerial, I generally use the "generate" button when you edit a pack.
You first need to assign the generator with your pack and then, the button will be available in the toolbar.
But that generation do not use any order ID.

So, if you want to test with an order ID ; you can create a new order in your HikaShop backend, add a virtual product, change the order into "confirmed" and then use the "Add pack" button.
Once you have added a pack to the order ; you can use the button "refresh associations" to call the generation.
The idea is to delete or unassign the serial (in the serial listing) and then re-click on the "refresh association" to force the creation of a new serial thanks to your plugin.

Let me know if you need further details.

Regards,

---

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

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

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

Less More

- Posts: 11
- Thank you received: 0
-
-

10 years 9 months ago -  10 years 9 months ago [\#229641](#229641) by [yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")  Replied by *[yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")* on topic *[How to debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229641 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")*

Hi Jerome,

I tried the 'generate' button. Works nicely but I really need to test it with an order as the generator requires product details.

Unfortunately I had no success to use the add pack / refresh associations button.
(the add pack function seems weird, I have to add qty &gt; 1 or refresh the page to see it has been added.)

Then, when I click refresh associations, *nothing* seems to happen.
Seems like my generator function isn't even called.
At the moment, my generate function will just log some debug infos, and I verified it works in pack generation.
But it doesn't seem to be called when refreshing associations.
Maybe my pack settings aren't correct?

For debugging I stripped my generate function down to:
Code:

public function generate(&amp;$pack, &amp;$order, $quantity, &amp;$serials) { $debuginfo = ''; $serial = 'xx'; $debuginfo.= print_r($pack,true)."\n\n\n"; $debuginfo.= print_r($order,true)."\n\n\n"; file_put_contents(__DIR__.'/debug.log',$debuginfo); for($q = 0; $q &lt; $quantity; $q++) { $serial = $serial.'_reply'; $serials[] = $serial; } return true; }

Any idea why it is not being called?

Last edit: 10 years 9 months ago by [yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE0LWhpa2FzZXJpYWwvODgyMjMxLWhvdy10by1kZWJ1Zy1hLXNlcmlhbC1nZW5lcmF0b3ItcGx1Z2luP3RtcGw9bWFya2Rvd24=) 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: 26395
- Thank you received: 4077
-
- [](http://obsi.dev)
-

10 years 9 months ago [\#229661](#229661) 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 debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229661 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")*

Hi,

The "Add pack" will call the "refresh association" directly after you validate the mini-form.
Your currently need to refresh the order page ; the reload in Ajax is unfortunately, not for right now.
Once you have added your pack (and refresh the page), you just need to use the "refresh associations" to re-generate the missing serials. That's why you need to delete them in another tab.

Otherwise refresh association will call your generator as long as your pack is configure to not use a "pack data".
See : [ www.hikashop.com/support/documentation/1...ition.html#pack\_data](https://www.hikashop.com/support/documentation/117-pack-edition.html#pack_data)

Regards,

---

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

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

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

Less More

- Posts: 11
- Thank you received: 0
-
-

10 years 9 months ago [\#229663](#229663) by [yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")  Replied by *[yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")* on topic *[How to debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229663 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")*

Hi Jerome, you were too fast ![;)](/media/kunena/emoticons/24.png ";)")
I was just about to post new info about the problem.

My pack is set up to use no pack data.

Clicking refresh associations will always remove existing serials but not generate new ones.
I tracked down the executed task to refresh() function in admin hikaserial/classes/order.php.

Last lines of the function are: Code:

if(in_array($order-&gt;order_status, $statuses)) { $this-&gt;assignSerials($order); } else { $this-&gt;unassignSerials($order); }

now, for some reason $statuses will always be an array with the only entry being an empty string - array( 0=&gt;"" ).
Which ends in serials always being unassigned.
Statuses array is assigned by hikaserial config vars assignable_order_statuses or order_confirmed_status.
Both don't seem to exist when I dump hikaserial::config(false).

I checked hikaserial configuration in backend but I couldn't find settings with matching or similar names.

So my current question is: What should I do to make sure $statuses array is filled with correct entries?

Thanks for your help ![:)](/media/kunena/emoticons/3.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE0LWhpa2FzZXJpYWwvODgyMjMxLWhvdy10by1kZWJ1Zy1hLXNlcmlhbC1nZW5lcmF0b3ItcGx1Z2luP3RtcGw9bWFya2Rvd24=) 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: 26395
- Thank you received: 4077
-
- [](http://obsi.dev)
-

10 years 9 months ago [\#229666](#229666) 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 debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229666 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")*

Hi,

Does your order confirmed ?
Is HikaSerial configured correctly for the "assignable order statuses" ?
[ www.hikashop.com/support/documentation/1...nable\_order\_statuses](https://www.hikashop.com/support/documentation/111-hikaserial-configuration.html#assignable_order_statuses)

Regards,

---

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

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

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

Less More

- Posts: 11
- Thank you received: 0
-
-

10 years 9 months ago [\#229677](#229677) by [yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")  Replied by *[yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")* on topic *[How to debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229677 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")*

Weird. It's working now.
Didn't really change anything though.
Maybe a configuration resave or something fixed it. ![:)](/media/kunena/emoticons/3.png ":)")

One last question.
Seems refresh associations doesn't generate the serial,
if there already is a serial assigned. Is this the desired behaviour?
If so, is there a way to force the re-generation, even if they already were generated?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE0LWhpa2FzZXJpYWwvODgyMjMxLWhvdy10by1kZWJ1Zy1hLXNlcmlhbC1nZW5lcmF0b3ItcGx1Z2luP3RtcGw9bWFya2Rvd24=) 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: 26395
- Thank you received: 4077
-
- [](http://obsi.dev)
-

10 years 9 months ago [\#229679](#229679) 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 debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229679 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")*

> Once you have added your pack (and refresh the page), you just need to use the "refresh associations" to re-generate the missing serials. That's why you need to delete them in another tab.

---

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

The following user(s) said Thank You: [yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")

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

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

Less More

- Posts: 11
- Thank you received: 0
-
-

10 years 9 months ago [\#229782](#229782) by [yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")  Replied by *[yoolabs](/forum/user/40784-yoolabs "View yoolabs's Profile")* on topic *[How to debug a serial generator plugin?](/forum/14-hikaserial/882231-how-to-debug-a-serial-generator-plugin#229782 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.10.2 -- Joomla version -- : 3.4.8  Hi, I'm working on a custom serial generator plugin. Now I need to debug my code.  But I can't find a way to execute/call the generate hook/method. Can you tell me the url to manually call it for a certain order ID / pack ID? That would make thinks way easier for me.  Thanks!")*

Ah now I do understand what you were telling me ![:)](/media/kunena/emoticons/3.png ":)")
Great everything's working perfectly now.
Thanks for your help Jerome!

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

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

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

Time to create page: 0.069 seconds

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