[SOLVED] Key Generation based on user input.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #69019

Hi,

The classname of your plugin is "plgHikaserialRandomgen", that's why your plugin can't work.
Rename the classname to "plgHikaserialTallygen" and it would work.

After that, your generate function does not use the $quantity variable.
You can read our HikaSerial developper documentation for more information and a "template" for this function.
www.hikashop.com/fr/hikashop/125-hikaser...er.html#fct_generate

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.
The following user(s) said Thank You: manjeshmohan

Please Log in or Create an account to join the conversation.

  • Posts: 83
  • Thank you received: 1
11 years 5 months ago #69023

Hi,

Please find the attached screenshot and plugin file.

Please have a look at the procedure of installing the HikaSerial plugin which I've done and correct me if I'm wrong:

1. I've installed the attached plugin through the extension manager.
2. Gone to HikaSerial->Plugin section and I've enabled the Tally Serial plugin.

After clicking on the plugin, I'm getting the page which I've attached the screenshot.

Please get me some idea to get in the correct path.

Thanks,
Manjesh.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83
  • Thank you received: 1
11 years 5 months ago #69067

Hi,

I've found out the solution for the issue mentioned in my earlier post. :)

Now I just need to check whether I'm able to retrieve the data from the two fields in the tally serial plugin, that is, Tally Serial from the frontend and Module Key from the backend.

I've changed the class name to the following:

class plgHikaserialTallysergen extends hikaserialPlugin {

then I've set populate to false:
protected $type = 'generator';
	protected $multiple = true;
	protected $populate = false;
	protected $doc_form = 'tallysergen-';

then I've deleted the quantity;
public function __construct(&$subject, $config) {
		parent::__construct($subject, $config);
	}

	public function generate(&$pack, &$order, &$serials) {

then included the pack name plus retrieved the data from the tally serial and module key:
if(!isset($pack->tallysergen))
			return;

		parent::pluginParams($pack->tallysergen);

		if(empty($this->plugin_params->mkey)) {
		$this->plugin_params->mkey = 97531;
		}
at last I've concatenated both the fields value into serial;
$serial = $this->plugin_params->mkey.$order->tallyserial;

	}

	public function configurationHead() {
		return array();
	}

	public function configurationLine($id = 0) {
		return null;
	}

	public function onPackGeneratorTypeDisplay(&$values) {
		parent::listPlugins('tallysergen', $values);
	}

	public function onDisplaySerials(&$data, $viewName) {
		return;
	}
}

But I'm unable to get any data in the serial that the serial field is blank in the mail as well as in the backend serial's section.

what/where could be the problem? :(

Regards,
Manjesh.

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #69089

Hi,

There are several problems.
First : you removed a parameter to the function "generate". I am quite sure the function does not appreciate.
Second : you didn't use the template of the generate function from our documentation, so you didn't write any serial in the $serials output parameter (and you can't generate several serials if the $quantity is more than one. Because even if your removed the parameter, the value would still be there).
Third : you didn't use the code that I gave you twice which explain how read a custom field value in the $order object.

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
11 years 5 months ago #69119

Hi,

Sorry that I'm a newbie to php and a weak coder. Please bear with me.
Thanks for your understanding.

I've cleared the problems which you've mentioned.

Please check the same:

public function generate(&$pack, &$order, $quantity, &$serials) {
		if(!isset($pack->tallysergen))
			return;

		parent::pluginParams($pack->tallysergen);

		if(empty($this->plugin_params->mkey)) {
		$this->plugin_params->mkey = 97531;
		}
		for($q = 0; $q < $quantity; $q++) {
			$serials = '';
			$serial = $this->plugin_params->mkey.$order->tallyserial;
			$serials[] = $serial;
		}
		return true;
	}


In one of your post, you've mentioned the following things:

If you want a serial which would be the same with same tally serial, you can do something like this:
$serial = strtoupper(md5('mySaltValue' . $order->taillyserial));
You can make a "substr" if you want a tinier serial, add some dashes, etc.
But the important point is to change the "mySaltValue" !


Sorry that I did not understand certain things like using md5 and 'mySaltValue'. Also I've used the same way to retrieve the tallyserial value just as you mentioned ($order->taillyserial).

Thank you for your patient listening.

Regards,
Manjesh.

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #69154

Hi,

The last version of your generate function looks good :)

md5 is a hash function. It allows to create a non-reversible code depending on your internal value and the tallyserial.
Without your internal value (called "salt") it would not be possible to generate the same hash. It's like cryptography.
If you want more information about md5, you can make a search on php.net or wikipedia.

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
11 years 5 months ago #69177

Hi,

Thanks for the reply.

Everything went on well except one thing that the tallyserial value is not retrieved, so it is not concatenated with the module key rather I'm getting only module key as the serial in the order success mail.

Is the following code correct to retrieve the tallyserial value?

public function generate(&$pack, &$order, $quantity, &$serials) {
		if(!isset($pack->tallysergen))
			return;
 
		parent::pluginParams($pack->tallysergen);
 
		if(empty($this->plugin_params->mkey)) {
		$this->plugin_params->mkey = 97531;
		}
		for($q = 0; $q < $quantity; $q++) {
			$serials = '';
			$serial = $this->plugin_params->mkey.$order->tallyserial;
			$serials[] = $serial;
		}
		return true;
	}

Thanks,
Manjesh.

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #69282

Hi,

Your code looks good and the $order parameter of the generate function contains the complete HikaShop order object.
This object contains all require data, including custom fields.
I take a lot at your website and HikaSerial does not work anymore, Joomla told me that the component was not found but there is still is entry in the menu (without his submenus).

If you want to try the order custom field, the best is to use the dynamic assignation.
Use an existing order, which have a good "tallyserial" (you can edit it in the backend) and change his status.
If there is already a serial attached, you can remove it thanks to HikaSerial backend.

During the "refresh association", HikaSerial load the order in the database, retrieving the main values and the custom fields.
By changing the status of the order, when you will change from "created" to "confirmed", HikaShop would trigger HikaSerial like it does during payment processing. It is the best way to test the "production" process.

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
11 years 5 months ago #70521

Hi Jerome,

My Serial generator plugin works perfectly. :woohoo: :)

Thanks for your great and quick support. :cheer:

Warm Regards,
Manjesh.

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #70523

Hi Manjesh,

Very good news !
Thanks for choosing HikaShop and HikaSerial :)

Best 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
11 years 5 months ago #70528

Hi Jerome,

I've few quick questions.

1. How can I subscribe to the Hikashop and Hikaserial newsletter to get to know about the latest updates of your products?

2. My subscription period for both Hikashop and Hikaserial is till September 2014, so can I download/get the latest updates of these products, if there is any new release out during this period?

Thanks & Regards,
Manjesh.

Please Log in or Create an account to join the conversation.

  • Posts: 25994
  • Thank you received: 4004
  • MODERATOR
11 years 5 months ago #70546

Hi,

1 - When you download HikaShop starter you can subscribe to the newsletter.
When you bought HikaShop or HikaSerial, you are automatically added to our list (and you would be able to unsubscribe).
We always send a newsletter when a new version of HikaShop is published.

2 - HikaShop 2.0 and HikaSerial 1.5 would be release. They would have new features and support of Joomla 3.0
New version of HikaSerial depends on the feature requests.
Regarding the change log, there is a new small release every month : www.hikashop.com/en/hikashop/120-hikaserial-change-log.html
HikaShop have bigger releases, every 2~3 months.

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.
The following user(s) said Thank You: manjeshmohan

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.080 seconds
Powered by Kunena Forum