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

#   Generate Serial based on Product and option

##

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago [\#92627](#92627) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#92627 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")* was created by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")*

I have yet to purchase the plugin because I need to know if this is possible.

I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.

If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

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

13 years 7 months ago [\#92862](#92862) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#92862 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Hi,

You can easily create your own generator plugin for HikaSerial.
There are several example plugins in the package, you can duplicate the, change their name and create your own algorithm.

HikaSerial have a developper documentation which would explain you the different triggers with for the most important of them, a little portion of source code (for the example).
[ www.hikashop.com/en/hikashop/125-hikaserial-developer.html](http://www.hikashop.com/en/hikashop/125-hikaserial-developer.html)

Regards,

---

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

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

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago [\#92985](#92985) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#92985 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Thank you for this information.

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago [\#95381](#95381) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#95381 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Jerome,

I need some help.

I have my serial algorithm coded now in PHP. (Took me a few hours for some simple string replacing algorithms we use in our other software:: I'm new to PHP, but I did it!) :laugh:

I have a copy of the "Random Generator" out on our site and I need to use it as a base for implementing my new generator code.

Basically I have 2 parameters that I need to gather from the order (Software Type, Option Selected) that I need to pull into my algorithm.

I guess I don't understand the Plugin Params and Generate section of the developer documentation. Could you elaborate on how to tie in my params and generate with my php code?

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

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

13 years 7 months ago [\#95454](#95454) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#95454 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Hi,

The generate function have several parameters. In these parameters you have the $order object which contains all information of the order.
You can access to the order custom fields in the same time.
If you have a custom field named "software_type" (the name and not the label), you can access it by: $order-&gt;software_type.

If you want to read an item custom field, you have to check the order cart like it is done in the plugin "secure ebook". Code:

if(!empty($order-&gt;cart-&gt;products)) { foreach($order-&gt;cart-&gt;products as $p) { if($p-&gt;product_id == $pack-&gt;product_id) { // Read the product code or any "item custom field". $product_code = $p-&gt;order_product_code; break; } } }

If you want to read a product custom field, you have to load the product. Code:

$productClass = hikaserial::get('shop.class.product'); $product = $productClass-&gt;get($pack-&gt;product_id); $software_type_custom_field = $product-&gt;software_type;

If you want to example on the plugin params you can check the "secure ebook" plugin too.
You can create as many params as you want in the plugin, they would be serialized and stored in the database.
In the configuration file, you have to use a specific name for your inputs like: Code:

&lt;input type="text" name="data[generator][generator_params][sdk_key]" value="&lt;?php echo @$this-&gt;element-&gt;generator_params-&gt;sdk_key; ?&gt;"/&gt;

The name should start with "data[generator][generator_params]".

In the plugin afterwards, you can access to this parameters.
First you have to call the plugin system in order to load your parameters for your plugin instance (because you can have several configurations in the same plugin). Code:

parent::pluginParams($pack-&gt;randomgen);

(replace "randomgen" with your plugin name).
If you plugin is not a "multiple configuration" plugin, you should load the parameters with another command: Code:

parent::pluginParams(0, 'secureebook');

(replace "secureebook" with your plugin name).

And after you can access to the parameters like Code:

$this-&gt;plugin_params-&gt;sdk_key;

Regards,

---

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

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

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago [\#95481](#95481) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#95481 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Thanks for elaborating on this.

I'm a little unclear on how these return the license/serial that gets tied to the order and how it gets displayed to the end user in their email/account/order.

I may have more questions as I dive deeper.

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

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

13 years 7 months ago [\#95501](#95501) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#95501 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Hi,

The last parameter of the "generate" function is "&amp;$serials".
It is an output array where your plugin have to put your serials. Code:

$serials[] = $serial;

Where $serial is just the text of the serial data or could be an object like this: Code:

$serial = new stdClass(); $serial-&gt;extradata = array(); $serial-&gt;extradata['my_key'] = 'my data'; $serial-&gt;data = 'my_generated_serial'; $serials[] = $serial;

The generate function provide serial keys (with some extra data if required) and after that, HikaSerial would insert the full serial data into the database.
When a serial is generated, HikaSerial would automatically display it to the user in the email, in his order, etc.

Regards,

---

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

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago -  13 years 7 months ago [\#95529](#95529) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#95529 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Let me ask another noob question. ![:)](/media/kunena/emoticons/8.png ":)") What do you recommend as the best way to test a license generator plugin... Just keep placing "test" orders? Is there any other way?

I should also specify what I said earlier:

I really only need what the product was (where I will get software type) and the option they chose upon adding it to their cart. These two things will be all I need to run through my generating algorithm.

So really I have no parameters or configuration that needs to be set. Can I ignore that stuff or strip it out?

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

Last edit: 13 years 7 months ago by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile"). Reason: clarification

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

13 years 7 months ago [\#95538](#95538) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#95538 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Hi,

The payment plugins "collect on delivery" allow you to create easily some test orders.
So you can place a test order, confirm it manually and use the "refresh association" button.
By deleting the serial in the database, you can re-generate one by pressing the button.

Regards,

---

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

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago -  13 years 7 months ago [\#95626](#95626) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#95626 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Sorry, I'm way lost here Jerome.

I've gone through the documentation and it is hard to understand. I understand there's a first language difference as well, but It's just not very thorough to start.

I don't need much complexity in my implementation. I don't have any configuration necessary. I just need it to grab the product from order object and any options that they added.

I've set up my licensegen.php with what should return a value no matter what... But I don't know if I understand the basic hikaserial setup properly. Do I need to use the PACK setup if I am generating a license one-off for each order and having them attached to the order? If not, how do I accomplish this.

I have a pack set up with my current plugin, and I have it selected in the respective product that should get a license. When I place an order and confirm it, nothing attaches, nor does anything get created.

Here's my licensegen.php (without my algorithm)
Code:

&lt;?php /** * @package HikaSerial for Joomla! * @version 1.0 * @author Josh Weaver * @copyright (C) 2012-2013 By the Book. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;?php class plgHikaserialLicensegen extends hikaserialPlugin { protected $type = 'generator'; protected $multiple = true; protected $populate = false; protected $doc_form = 'licensegen-'; public function __construct(&amp;$subject, $config) { parent::__construct($subject, $config); } /** * @param object $pack : the hikashop pack object, with the options. * [ pack_id, product_id, quantity, pack_name, pack_data, pack_generator, pack_params ] * @param object $order : the hikashop order object, with all data. * @param int $quantity : the quantity of serials that you generator has to create. * @param array $serials : output array for the generated serials. */ public function generate(&amp;$pack, &amp;$order, $quantity, &amp;$serials) { if(!isset($pack-&gt;licensegen)) // replace "mypluginname" by your plugin name return; // load $this-&gt;plugin_params; parent::pluginParams($pack-&gt;licensegen); // replace "mypluginname" by your plugin name for($q = 0; $q &lt; $quantity; $q++) { $serial = ''; //Algorithm here that produces $lic; $serial = $lic; $serials[] = $serial; } } public function configurationHead() { return array(); } public function configurationLine($id = 0) { return null; } public function onPackGeneratorTypeDisplay(&amp;$values) { $values['plg.licensegen'] = 'Btb License Gen'; } public function onDisplaySerials(&amp;$data, $viewName) { return; } }

BTW: I know this doesn't contain the code for my product / options designation yet...

I'm sorry to keep bombarding you with this stuff, but this is the last step to get our store online and I feel like I'm banging my head.

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

Last edit: 13 years 7 months ago by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile").

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

13 years 7 months ago [\#95669](#95669) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#95669 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Hi,

In your plugin, you should use this code for the trigger onPackGeneratorTypeDisplay: Code:

public function onPackGeneratorTypeDisplay(&amp;$values) { // list all sub generators parent::listPlugins('licensegen', $values); }

A serial is generated only when the order is confirmed (or depending on the HikaSerial configuration).
If nothing generated, it could have a problem during the generation. You could add some traces in your plugin in order to check that he is right called (just putting some "echo" or "var_dump" would help you).

Regards,

---

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

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago -  13 years 7 months ago [\#96200](#96200) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96200 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Yes, this is just creating a serial when the order is confirmed.

EDIT:
It appears to be generating now.

It wouldn't attach without the Link to product quantity to be set to yes. I didn't expect this as I have these products on an unlimited quantity.

Thoughts?

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

Last edit: 13 years 7 months ago by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile"). Reason: Fixed issue?

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago [\#96206](#96206) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96206 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Also, how do I know what objects exist inside the $order object? How do I refer to them?

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

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

13 years 7 months ago [\#96229](#96229) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96229 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Hi,

If your plugin have the "protected $populate = false;" as describe in your previous post, HikaSerial can't use the "Generate" button in the pack.
At this moment you would have a message: "This generator can't populate the database".
You don't want to have the "populate" feature because your algorithm needs the order information to generate a serial.

Did you put some traces as mentioned ?

The order object documentation could be found here: [ www.hikashop.com/fr/support/documentation/156](http://www.hikashop.com/fr/support/documentation/156)

Regards,

---

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

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago [\#96231](#96231) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96231 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Ah, I edited the message above with my fixed status. It is generating now with hardcoded params, I will change populate to false when I get the code working fully.

I will try adding some traces, but I am not sure how to get them to show up and where they will. I have an echo in place but it doesn't seem to pop up anywhere.

Thanks for the doc, that will be helpful.

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago -  13 years 7 months ago [\#96273](#96273) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96273 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Can you tell me how to translate this array info from the Options?:

I need the product and one option that I need to pull from the cart order into my generator ("Concurrent Users")... what would that look like?

EDIT:

I have figured out how to pull the product code to my algorithm, but am having issues getting the option for that product.

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

Last edit: 13 years 7 months ago by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile").

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

13 years 7 months ago [\#96346](#96346) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96346 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Hi,

If you want to be sure that your function is right called, you can put a temporally "die('a message');" in order to stop the process and see if you are entering in a function (or in a condition).
A little bit "rude" but it could help.

What are "options for products ?
In the order object, you can read the information from the table "order_product" but if you want more information about one specific product, you have to load it as explain before ( [ www.hikashop.com/en/forum/17-serial-how-...nd-option.html#95454](http://www.hikashop.com/en/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option.html#95454) ).

Regards,

---

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

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago [\#96358](#96358) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96358 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

I just need to get the option they selected when they purchased the product. How do I do this? When I load the product based on the product_id tied to the pack, I just get a table with only the product and nothing from the next array with the option info.

Can you explain this?

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

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

- **[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")**
- [![btbjosh's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/splatter_hand.png)](/forum/user/12727-btbjosh "View btbjosh's Profile") Topic Author
- [ Offline](/forum/user/12727-btbjosh)

Less More

- Posts: 90
- Thank you received: 1
-
-
-

13 years 7 months ago [\#96362](#96362) by [btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")  Replied by *[btbjosh](/forum/user/12727-btbjosh "View btbjosh's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96362 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

With the way that HIKASHOP works, my product options are separate products in the order array.

I guess the only relationship between them (from what I can tell) is the parent_id. I guess I need to figure out how to use that to grab the proper order_characteristic using that parent_id, I'm just not a PHP guru like you guys.

---

![:)](/media/kunena/emoticons/8.png ":)") — Josh

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

13 years 7 months ago [\#96363](#96363) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Generate Serial based on Product and option](/forum/17-serial-how-to/78873-generate-serial-based-on-product-and-option#96363 "I have yet to purchase the plugin because I need to know if this is possible.  I know you can customize the generators to some extent, but I need to know if it is possible to generate a software key based on the product they choose and an option choice.  If this is possible, could you point in the direction on how to accomplish this? I know basic/intermediate javascript but very little PHP so any assistance will be greatly appreciated.")*

Hi,

Options, variant or custom field ?

Why using options ? Are you sure that's the right solution ?
Why not using item custom field as advised ?

I do not understand your question and your structure.
Please give me real details, example, something to understand what you're talking about.
You're talking about "options" but giving names of "variants" organization. So, I don't know what you are really using and having in your website.

Regards,

---

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

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

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

[](#top)
