How to collect information when serial is consumed

  • Posts: 33
  • Thank you received: 0
9 years 1 month ago #194759

How to collect required data from customer when they consume a serial supplied on a voucher?
What I want to do is require the customer to enter some information after they have entered their serial number.
Can this be done through custom fields?

I have used custom item fields and categories so that this information is collected when a certain product is ordered online.

The problem is that I want to require the customer to also enter and consume the consume voucher serial number which was supplied at an earlier time.

Is this possible?

Last edit: 9 years 1 month ago by suew. Reason: additional explanation

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
9 years 1 month ago #194792

Hi,

When you consume a serial, you can send some data which would be store in the serial "extra data".
If you want the fields be required, the best is to have a consume plugin which will refuse the serial to be consume if the extra data field is empty.

Some of the HikaSerial plugins already do things like that, like the "point consumer" plugin which refuse the consumption of a serial which could alter the "points" value that the "point generator" store in the extra data.
In your case, the filtering is the opposite but the way to add the feature is the same.

After that, to add the input in the consume page, the best is to use some view override. So the fields will be display in the consume menu and consume module.

Let me know if you need more details about a specific point.

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: suew

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

  • Posts: 33
  • Thank you received: 0
9 years 4 weeks ago #195624

Hi Jerome,

Thanks for your excellent reply. I basically understand what you are suggesting but am not sure how to go about creating the new consumer plugin to refuse to consume the serial if the extra data field is empty. I have read the developer information "How to create a HikaSerial plugin but not quite sure how to do it. Can you provide a bit more explanation.

Many thanks,
Sue

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
9 years 4 weeks ago #195691

Hi,

The easier is to use the trigger "onBeforeSerialConsume", something like that

public function onBeforeSerialConsume(&$serial, $user_id, &$do, &$extra_data) {
	// We check the required extra data
	if(empty($extra_data) || empty($extra_data['required_value'])) {
		// abort the consumption
		$do = false;
		$app = JFactory::getApplication();
		$app->enqueueMessage('message to indicate that the field is missing');
	}
}

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.
Last edit: 9 years 4 weeks ago by Jerome. Reason: fix code

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

  • Posts: 33
  • Thank you received: 0
9 years 4 weeks ago #195724

Thanks Jerome. I will give it a try.
You do a great job and are greatly appreciated.

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
9 years 4 weeks ago #195725

Thanks :)

(I just realized that there was a little mistake in my code so I edited my previous message to fix it).


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: 33
  • Thank you received: 0
9 years 3 weeks ago #196342

Hi Jerome. Hope all is well in your world.

I have done a view override of the consume page and included the extra data fields to collect information from the customer.
These are showing on the front end but the data is not being saved to the extra serial data fields. Can you give me some hints about how to correct this?

Thank for all you do.

Sue

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
9 years 3 weeks ago #196380

Hi,

Would it be possible to have more details about how you set the extra data fields in your form ?

In our documentation (which would require some improvements), there is a little part which give information about the serial extra data during the consumption :
www.hikashop.com/support/documentation/1...onsume-features.html

The webservice is compatible with html POST request.
So you can make a post request to the url:
index.php?option=com_hikaserial&ctrl=serial&task=consume
And give the rest of the parameters by POST ( hikaserial[serial_data] / hikaserial[format] / hikaserial[serial_extra_data][] )

When you submit data for the serial consumption, the extra data should have that "form"
<input type="text" value="" name="hikaserial[serial_extra_data][my_extra_data_field]" />

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.
Last edit: 9 years 3 weeks ago by Jerome. Reason: replace code with quote
The following user(s) said Thank You: suew

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

  • Posts: 33
  • Thank you received: 0
9 years 3 weeks ago #196399

Hi Jerome,

Thanks very much for your help. Together we have solved my problem. You are wonderful!

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

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