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

#   Get Text of Custom Field in Product Layout

##

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

Less More

- Posts: 15
- Thank you received: 3
-
-

4 years 9 months ago [\#339428](#339428) by [coolcatcreations](/forum/user/62914-coolcatcreations "View coolcatcreations's Profile")  *[Get Text of Custom Field in Product Layout](/forum/26-product-category-display/903971-get-text-of-custom-field-in-product-layout#339428 "Hi everyone! Some weeks ago I contacted Hika Shop because my filter was not working correctly on some items. Apparently, the issue was, that the values contained special Charakters like ö,ü,ß,ä and spaces. So I rewrote the select dropdown like this:  Value: niederoestereich Text: Niederösterreich  But the problem now is, that on the product detail page the value is shown instead of the text. So in database and for the filters I need the value to be used, for the Product display I need to show the text.  I need the same for selecting related articles in the product were I have a selection like value = url and label = Regionname and I want to put it on the product datailpage somewhat like that:  How can I solve this?  thanks!")* was created by *[coolcatcreations](/forum/user/62914-coolcatcreations "View coolcatcreations's Profile")*

Hi everyone!
Some weeks ago I contacted Hika Shop because my filter was not working correctly on some items. Apparently, the issue was, that the values contained special Charakters like ö,ü,ß,ä and spaces. So I rewrote the select dropdown like this:

**Value:**
niederoestereich
**Text:**
Niederösterreich

But the problem now is, that on the product detail page the value is shown instead of the text.
So in database and for the filters I need the value to be used, for the Product display I need to show the text.

I need the same for selecting related articles in the product were I have a selection like
value = url and label = Regionname and I want to put it on the product datailpage somewhat like that:
Code:

&lt;a href="&lt;?php echo $this-&gt;row-&gt;region-&gt;value; ?&gt;"&gt;&lt;?php echo $this-&gt;row-&gt;region-&gt;text; ?&gt;&lt;/a&gt;

How can I solve this?

thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MDM5NzEtZ2V0LXRleHQtb2YtY3VzdG9tLWZpZWxkLWluLXByb2R1Y3QtbGF5b3V0P3RtcGw9bWFya2Rvd24=) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14327
-
-

4 years 9 months ago -  4 years 9 months ago [\#339434](#339434) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Get Text of Custom Field in Product Layout](/forum/26-product-category-display/903971-get-text-of-custom-field-in-product-layout#339434 "Hi everyone! Some weeks ago I contacted Hika Shop because my filter was not working correctly on some items. Apparently, the issue was, that the values contained special Charakters like ö,ü,ß,ä and spaces. So I rewrote the select dropdown like this:  Value: niederoestereich Text: Niederösterreich  But the problem now is, that on the product detail page the value is shown instead of the text. So in database and for the filters I need the value to be used, for the Product display I need to show the text.  I need the same for selecting related articles in the product were I have a selection like value = url and label = Regionname and I want to put it on the product datailpage somewhat like that:  How can I solve this?  thanks!")*

Hi,

It would have been great if you could have provided a screenshot of the settings of the custom field.

Supposing that your custom field is of one of the type "single dropdown", "multiple dropdown", "radio" or "checkbox", to get the titles of the values on the product details page, and supposing that the product doesn't have variants, you can use such code: Code:

&lt;?php $fieldClass = hikashop_get('class.field'); $field = $fieldClass-&gt;getField('xxx', 'product'); echo $fieldClass-&gt;show($field,$this-&gt;element-&gt;xxx); ?&gt;

where xxx is the column name of the custom field.

So, if I understand correctly, you have a URL for the value, and the label of the link as title.
In that case, the code will probably look like this: Code:

&lt;?php $fieldClass = hikashop_get('class.field'); $field = $fieldClass-&gt;getField('xxx', 'product'); ?&gt; &lt;a href="&lt;?php echo $this-&gt;element-&gt;xxx; ?&gt;"&gt;&lt;?php echo $fieldClass-&gt;show($field,$this-&gt;element-&gt;xxx); ?&gt;&lt;/a&gt;

Last edit: 4 years 9 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

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

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

Less More

- Posts: 15
- Thank you received: 3
-
-

4 years 9 months ago [\#339438](#339438) by [coolcatcreations](/forum/user/62914-coolcatcreations "View coolcatcreations's Profile")  Replied by *[coolcatcreations](/forum/user/62914-coolcatcreations "View coolcatcreations's Profile")* on topic *[Get Text of Custom Field in Product Layout](/forum/26-product-category-display/903971-get-text-of-custom-field-in-product-layout#339438 "Hi everyone! Some weeks ago I contacted Hika Shop because my filter was not working correctly on some items. Apparently, the issue was, that the values contained special Charakters like ö,ü,ß,ä and spaces. So I rewrote the select dropdown like this:  Value: niederoestereich Text: Niederösterreich  But the problem now is, that on the product detail page the value is shown instead of the text. So in database and for the filters I need the value to be used, for the Product display I need to show the text.  I need the same for selecting related articles in the product were I have a selection like value = url and label = Regionname and I want to put it on the product datailpage somewhat like that:  How can I solve this?  thanks!")*

Thank you, Nicolas!
I tried with your code but it did not work and gave me a php error.
Call to a member function getField() on null

However, I managed to make it work like that - do you think my solution is ok?

$myField = $this-&gt;element-&gt;winery;
$field = $this-&gt;fields-&gt;field_value[$myField]-&gt;value;

&lt;a href="/winery/&lt;?php echo $myField; ?&gt;" title="More about &lt;?php echo $field; ?&gt;"&gt;&lt;?php echo $field; ?&gt;&lt;/a&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MDM5NzEtZ2V0LXRleHQtb2YtY3VzdG9tLWZpZWxkLWluLXByb2R1Y3QtbGF5b3V0P3RtcGw9bWFya2Rvd24=) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14327
-
-

4 years 9 months ago [\#339440](#339440) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Get Text of Custom Field in Product Layout](/forum/26-product-category-display/903971-get-text-of-custom-field-in-product-layout#339440 "Hi everyone! Some weeks ago I contacted Hika Shop because my filter was not working correctly on some items. Apparently, the issue was, that the values contained special Charakters like ö,ü,ß,ä and spaces. So I rewrote the select dropdown like this:  Value: niederoestereich Text: Niederösterreich  But the problem now is, that on the product detail page the value is shown instead of the text. So in database and for the filters I need the value to be used, for the Product display I need to show the text.  I need the same for selecting related articles in the product were I have a selection like value = url and label = Regionname and I want to put it on the product datailpage somewhat like that:  How can I solve this?  thanks!")*

Hi,

That error indicates that you made a typo while writting the code.
Anyways, yes you can do it like that too.
My method is just a bit cleaner as it handles more things (like translations of the titles).

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

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

Less More

- Posts: 15
- Thank you received: 3
-
-

4 years 9 months ago [\#339448](#339448) by [coolcatcreations](/forum/user/62914-coolcatcreations "View coolcatcreations's Profile")  Replied by *[coolcatcreations](/forum/user/62914-coolcatcreations "View coolcatcreations's Profile")* on topic *[Get Text of Custom Field in Product Layout](/forum/26-product-category-display/903971-get-text-of-custom-field-in-product-layout#339448 "Hi everyone! Some weeks ago I contacted Hika Shop because my filter was not working correctly on some items. Apparently, the issue was, that the values contained special Charakters like ö,ü,ß,ä and spaces. So I rewrote the select dropdown like this:  Value: niederoestereich Text: Niederösterreich  But the problem now is, that on the product detail page the value is shown instead of the text. So in database and for the filters I need the value to be used, for the Product display I need to show the text.  I need the same for selecting related articles in the product were I have a selection like value = url and label = Regionname and I want to put it on the product datailpage somewhat like that:  How can I solve this?  thanks!")*

Thank you Nicolas, much appreciated! Maybe it was the double semicolon in the example. But great that we have two examples now for others to find how to do it ![:-)](/media/kunena/emoticons/3.png ":-)")

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

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