- Posts: 6
- Thank you received: 0
Generate Serial based on account email address
I would also like a bit of a push in the right direction for where to look to generate the serial number appropriate to my location. I THINK I found the right spot in the randomgen.php file, but I've never dabbled in Joomla Plugin writing before (plus I'm a C# programmer, haven't looked at PHP in probably a year). So any help with that would be greatly appreciated, as this is one of the final things I need to get working before I can launch my product.
Please Log in or Create an account to join the conversation.
The most important function in a generator plugin is the "generate" one.
When the "generate" function is called, a variable with the name of the plugin (randomgen in my example) is set.
This variable contains the id of the plugin generator.
Thanks to "$order" you can retrieve a lot of information about the current order or the user account.
The "$serial" variable is for output. It is an array which would contains all generated serials.
About HikaSerial configuration, you have to set up all HikaShop order statuses which allow to attach a serial to the order (and to the user).
When an order is validated by PayPal, the order would have another status (generally "confirmed") and HikaSerial would retrieve a serial from the pack.
If the pack is empty, HikaSerial would call the associated generator to create new serials. It is at this moment that the "generate" function is called.
In the pack configuration, you have to select your plugin generator and save. The associated generator is display in the listing so you can easily check if the configuration is right.
Hope it help you !
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.
Jerome wrote: About HikaSerial configuration, you have to set up all HikaShop order statuses which allow to attach a serial to the order (and to the user).
When an order is validated by PayPal, the order would have another status (generally "confirmed") and HikaSerial would retrieve a serial from the pack.
If the pack is empty, HikaSerial would call the associated generator to create new serials. It is at this moment that the "generate" function is called.
In the pack configuration, you have to select your plugin generator and save. The associated generator is display in the listing so you can easily check if the configuration is right.
Hope it help you !
Regards,
That's the exact spot I was looking at for putting in my own serial number generation code, the existing serial number generating code just kinda threw me off a bit as it looked rather strange. :blink:
I'm having a hard time accessing the user email out of the $order variable though, I've tried doing a var_dump and it gave me NULL NULL NULL NULL NULL instead of something useful.
I also did some poking around through code, and arrived at trying out $order->customer->user_email; but that didn't give me anything either. :S
I've managed to get it to assign a random serial from the 'pack' so far, but the serial only shows up after I go into the order and hit "Refresh Associations". I have "Assignable Order Statuses" set to confirmed, shipped in the HikaSerial configuration.
Am I missing something in the HikaShop configuration so that the serial generation code gets called when the payment is confirmed? or could this be related to me still using the PayPal sandbox environment?
Please Log in or Create an account to join the conversation.
When an HikaShop order is updated (when the PayPal notification validate the order for example), HikaSerial is called.
But when a plugin update an order, it does not update every fields of the order so HikaSerial load the full order information and store them into " $order->cart ".
So you should access to the information by this variables.
$order->cart->order_user_id
$order->cart->products
I will investigate more about your assignation problem.
An access to your backend might be required (or I can send you a preview version of HikaSerial with some modifications).
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.
file: administrator/com_hikaserial/classes/order.php
line: 31-34
Replace:
By:
And it would fix the problem with payment notifications.
I will update the HikaSerial package right now, so you would be able to download HikaSerial 1.1.0 with the fix in several minutes.
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.

I'm heading to work soon, and will try out that fix and let you know how it works. Thanks for your help!
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Randomgen plugin has been integrated in HikaSerial to be used as example.
If you want to create a new plugin, you just have to rename files, rename the class (and two or three variables/const values) and modify the XML.
Class names in HikaShop and HikaSerial have some rules : plgHikaserialRandomgen
plg : a plugin class
Hikaserial : for HikaSerial (upercase for the first letter, lowercase otherwise)
Randomgen : name of the plugin (upercase for the first letter, lowercase otherwise)
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.
- Posts: 83
- Thank you received: 1
Thanks.
Please Log in or Create an account to join the conversation.