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

#   2nd field on product option?

##

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

Less More

- Posts: 137
- Thank you received: 2
-
-

15 years 8 months ago [\#7487](#7487) by [emergentec](/forum/user/949-emergentec "View emergentec's Profile")  *[2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#7487 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")* was created by *[emergentec](/forum/user/949-emergentec "View emergentec's Profile")*

Hi!

I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.

My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this: Code:

[...] $time = time(); if (preg_match("/1 year/i", $order-&gt;cart-&gt;products[$j]-&gt;order_product_options)) { $time += ($oneyear); } elseif (preg_match("/6 months/i", $order-&gt;cart-&gt;products[$j]-&gt;order_product_options)) { $time += ($oneyear / 2); } [...]

So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like "order_product_option_code" where I can save the periode in days and not in words. So I can calculate with this value ...

Best regards

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14272
-
-

15 years 8 months ago [\#7489](#7489) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#7489 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

Hi,

When you create a custom field of the type multiple dropdown or single dropdown, you have two columns for the values of the dropdown: Value and Title. The title is what will be displayed to the user, the Value is what will be stored in the database. That way, you could set the titles "1 year" and "3 days" with the values being 365 and 3.

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

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

Less More

- Posts: 137
- Thank you received: 2
-
-

15 years 8 months ago [\#7493](#7493) by [emergentec](/forum/user/949-emergentec "View emergentec's Profile")  Replied by *[emergentec](/forum/user/949-emergentec "View emergentec's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#7493 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

I tried this (with options instead of drop-down; that shouldn't matter, right?!) but the radio buttons were only displayed in the backend. I want the user to choose the period in the frontend and not to create a own product for every period.

Best regards

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14272
-
-

15 years 8 months ago [\#7494](#7494) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#7494 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

If you want to have the custom fields on the product page, you need to create custom fields of the type "item". They are available in the Business edition.

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

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

Less More

- Posts: 28
- Thank you received: 0
-
-

15 years 8 months ago [\#8075](#8075) by [RemoteC](/forum/user/788-remotec "View RemoteC's Profile")  Replied by *[RemoteC](/forum/user/788-remotec "View RemoteC's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8075 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

Hi!

We (I'm employee at emergentec) have already bought the business edtion ![;-)](/media/kunena/emoticons/14.png ";-)")

I just made this item custom field, it is displayed in the frontend, so far so good but I have some further questions about this:

1.) Every single option is displayed on every single product. That's not what I want, I want to choose on which product which option is displayed. Where/How to configure that?

2.) How can I adjust the price depending on the option chosen by the customer?

3.) Where is the option value stored in the checkout process? I need to read it in my plugin (onAfterOrderCreate)?

thanks and best regards!

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14272
-
-

15 years 8 months ago [\#8085](#8085) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8085 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

Hi,

1/ There is no such option at the moment.

2/ Price cannot be changed based on custom fields.

In such cases, you should use characteristics like you did in your first approach. The values of the characteristics can be displayed differently with a one or two lines modification in the file administrator/components/com_hikashop/types/characteristic.php but limiting custom item fields on some products and/or changing the price based on them will require a lot of changes.

3/ in :
foreach($order-&gt;cart-&gt;products as $product){
echo $product-&gt;custom_item_field_column_name;
}

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

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

Less More

- Posts: 137
- Thank you received: 2
-
-

15 years 8 months ago [\#8466](#8466) by [emergentec](/forum/user/949-emergentec "View emergentec's Profile")  Replied by *[emergentec](/forum/user/949-emergentec "View emergentec's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8466 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

Hi!

3) I found the content of the option field in the database in the field order_product_options. But when I have 3 different values like 1 day, 1 month, 1 year, why is it stored this way in the database:
Code:

a:2:{i:8;O:8:"stdClass":6:{s:25:"variant_characteristic_id";s:2:"11";s:18:"variant_product_id";s:2:"29";s:8:"ordering";s:1:"0";s:17:"characteristic_id";s:2:"11";s:24:"characteristic_parent_id";s:1:"8";s:20:"characteristic_value";s:7:"1 month";}s:13:"licenseperiod";s:7:"1 month";}

and not just only the value like 1 month?

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14272
-
-

15 years 8 months ago [\#8472](#8472) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8472 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

Yes. The whole characteristic information is stored.
You can use the function unserialize on that data in order to get a php object that you will be able to use.

like this:
$obj = unserialize($data);
$period = $obj-&gt;licenseperiod;

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

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

Less More

- Posts: 137
- Thank you received: 2
-
-

15 years 8 months ago [\#8665](#8665) by [emergentec](/forum/user/949-emergentec "View emergentec's Profile")  Replied by *[emergentec](/forum/user/949-emergentec "View emergentec's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8665 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

I'm able to display the whole characteristig information with:
Code:

$res_product_options = $database-&gt;loadResultArray( 3 ); echo "Lizenz ohne unserialize: ".$res_product_options[0];

But using the "unserialize"-function returns an empty variable:
Code:

$res_product_options = $database-&gt;loadResultArray( 3 ) $obj = unserialize($res_product_options[0]); $period = $obj-&gt;licenseperiod; echo "Laufzeit: ".$period;

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14272
-
-

15 years 8 months ago [\#8666](#8666) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8666 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

You're missing a semi column after loadResultArray( 3 ) in your second code.
The unserialize function will transformed a serialized string into a php variable as long as the string is valid serialized data. So if you get an empty $obj it means that $res_product_options[0] does not contain the serialized string. It's a standard php function:
[ fr2.php.net/manual/en/function.unserialize.php](http://fr2.php.net/manual/en/function.unserialize.php)

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

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

Less More

- Posts: 137
- Thank you received: 2
-
-

15 years 8 months ago [\#8667](#8667) by [emergentec](/forum/user/949-emergentec "View emergentec's Profile")  Replied by *[emergentec](/forum/user/949-emergentec "View emergentec's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8667 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

The missing semi column came from bad copy&amp;paste ![:)](/media/kunena/emoticons/8.png ":)")

$res_product_options[0] contains the string I already posted:
Code:

a:2:{i:8;O:8:"stdClass":6:{s:25:"variant_characteristic_id";s:2:"12";s:18:"variant_product_id";s:2:"30";s:8:"ordering";s:1:"0";s:17:"characteristic_id";s:2:"12";s:24:"characteristic_parent_id";s:1:"8";s:20:"characteristic_value";s:6:"1 year";}s:13:"licenseperiod";s:6:"1 year";}

I tried to get the period with $period = $obj-&gt;characteristic_value; and $period = $obj-&gt;licenseperiod;

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14272
-
-

15 years 8 months ago [\#8669](#8669) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8669 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

Actually, it's not an object but an array. You will need to do this:
$period = $obj;

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

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

Less More

- Posts: 137
- Thank you received: 2
-
-

15 years 8 months ago [\#8973](#8973) by [emergentec](/forum/user/949-emergentec "View emergentec's Profile")  Replied by *[emergentec](/forum/user/949-emergentec "View emergentec's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8973 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

Now I developed a Joomla User-Plugin which triggers automatically on "onUserLogin".

I was able to get the Hikashop User-ID with Code:

$user_id =&amp; hikashop::loadUser();

But I would also need the firstname, lastname and the company name. Is it possible to get these variables without a extra database query?

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86293
- Thank you received: 14272
-
-

15 years 8 months ago [\#8975](#8975) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: 2nd field on product option?](/forum/4-how-to/7487-2nd-field-on-product-option#8975 "Hi!  I encountered the next problem in establashing my shop: I wrote a costum plugin (onAfterOrderCreate) to send some order information via SOAP to another server. This works but I have different product options which I need to catch, in this case the lifetime of a license.  My first approach was to create a product option where the user can choose the periode (e.g. 1 month, 6 months, 1 year) and in the plugin I wrote something like this:  So I search for dedictated periods but what if I want some special lifetimes like 1 day or 2 years or ... so I think this approach isn't so good, it would be better if i read the lifetime as an int in days, so I'm more flexible. My problem is now: how can I get such a variable in the product option? There is only one field for each option but I need a 2nd field like &quot;order&#95;product&#95;option&#95;code&quot; where I can save the periode in days and not in words. So I can calculate with this value ...  Best regards")*

That information isn't in the user table unless you created custom user fields for them but in the address table, so you will have to make a query for that.
Note that your users can have several addresses with several names...

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

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

Time to create page: 0.207 seconds

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

[](#top)
