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

#   Custom field link problem

##

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

Less More

- Posts: 431
- Thank you received: 22
-

8 years 5 months ago [\#292647](#292647) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#292647 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")* was created by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")*

-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.7.8
-- PHP version -- : 7.1

We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail.
I try to delete default value in custom field, but allways : is showing.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Philip](/forum/user/34318-philip "View Philip's Profile")**
- [![Philip's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar34318_2015-11-18-2.png)](/forum/user/34318-philip "View Philip's Profile")
- [ Offline](/forum/user/34318-philip)

Less More

- Posts: 4820
- Thank you received: 654
-
-

8 years 5 months ago -  8 years 5 months ago [\#292653](#292653) by [Philip](/forum/user/34318-philip "View Philip's Profile")  Replied by *[Philip](/forum/user/34318-philip "View Philip's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#292653 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Hello,

You're right the **classic way to proceed is to display a field only if the value isn't empty**, that's the better way to proceed for most of HikaShop user, sorry if that's don't fit your specific needs.

Anyway, I have 2 solutions to suggest :
- Create **another** custom field (with the **same Label**) for all other product **that don't need your url link**.
- Then, use some some **custom Css**, to only **hide** this custom field **value**, see my screenshot to better understand my idea :

For **product configuration** page :
image missing https://cdn.pbrd.co/images/Hl8JOQ9.png

Then the **custom Css** to only remove the custom field value (and not the label)
image missing https://cdn.pbrd.co/images/Hl8JOaO.png

See [ **this tutorial**](https://www.hikashop.com/support/documentation/272-hikashop-display-by-color.html#custom) to see how to add Css command

The other solution is to realize a custom code of HikaShop Custom field process to display (only this field) even if empty, you can do it yourself or ask for one of [ **partner**](https://www.hikashop.com/home/our-partners.html)

Hope this will answer your questions.
Regards

Last edit: 8 years 5 months ago by [Philip](/forum/user/34318-philip "View Philip's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 431
- Thank you received: 22
-

8 years 5 months ago [\#292677](#292677) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#292677 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

I dont understand.
You say "You're right the classic way to proceed is to display a field only if the value isn't empty."

This is the right way. And your link custom field not working that way. So there is a bug and maybe you should solve it?

There are other problems to.
If I fill value for link field and want to delete it over time, there is label on product with no value.

Sorry for my bad english ![;)](/media/kunena/emoticons/24.png ";)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

8 years 5 months ago [\#292701](#292701) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#292701 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Hello,

> We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail.
> I try to delete default value in custom field, but allways : is showing.

Can you give us more information about your issue but also about what you exactly want to achieve through some screenshots ?

Thank you.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 431
- Thank you received: 22
-

8 years 5 months ago [\#292813](#292813) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#292813 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

I need link custom field.
Custom field works, but with bug. To reproduce, you can try:
- create custom field link
- check on product detail - OK
- delete value of custom field link
- check on product detail - empty field still there

Second bug
- create custom field link
- enter default value and save
- try to delete default value - you cant

The result is: custom field link allways shows, empty or not.
Text field for example shows when something is writen in field. When you delete that value, field not showing on frontend. That is right behavior.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 431
- Thank you received: 22
-

8 years 5 months ago -  8 years 5 months ago [\#292816](#292816) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#292816 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Second bug

- [ ![bug2.jpg](/forum/attachment/43714) ](/forum/attachment/43714 "bug2.jpg") [ ](/forum/attachment/43714?download=1 "bug2.jpg")
- [ ![bug1.jpg](/forum/attachment/43715) ](/forum/attachment/43715 "bug1.jpg") [ ](/forum/attachment/43715?download=1 "bug1.jpg")

Last edit: 8 years 5 months ago by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) 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: 86322
- Thank you received: 14281
-
-

8 years 5 months ago [\#292823](#292823) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#292823 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Hi,

I see. Add the code: Code:

function check(&amp;$field,&amp;$value,$oldvalue) { if(is_string($value)) $value = trim($value,':'); return parent::check($field, $value, $oldvalue); }

after the code: Code:

class hikashopFieldLink extends hikashopFieldText { var $displayFor = false;

in the file administrator/components/com_hikashop/classes/field.php and that will fix both problems.

The following user(s) said Thank You: [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 431
- Thank you received: 22
-

8 years 5 months ago [\#292857](#292857) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#292857 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Now work as espected. Please ad fix in next update.
Thank you.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 431
- Thank you received: 22
-

5 years 4 months ago [\#333314](#333314) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#333314 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

The problem exist again. Nicolas, it seems that something change in that file after update.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) 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: 86322
- Thank you received: 14281
-
-

5 years 4 months ago [\#333320](#333320) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#333320 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Hi,

Which problem, the first or second bug you reported here ?
We did some modifications in the code of the link type custom fields with the latest version of HikaShop as it didn't handle correctly empty values.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 431
- Thank you received: 22
-

5 years 4 months ago [\#333330](#333330) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#333330 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Custom field works, but with bug. To reproduce, you can try:
- create custom field link
- check on product detail - OK
- delete value of custom field link
- check on product detail - empty field still there

So if I enter link and save, then delete link and save, link is still on product page, but only slash.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) 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: 86322
- Thank you received: 14281
-
-

5 years 4 months ago [\#333333](#333333) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#333333 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Hi,

Ok, I think I see what you mean.
I've added a patch on our end.
Please download again the install package on our website and install it on yours and it will add the patch for that.
Please note that you'll have to save the product once to see the change if the custom field is already empty but displaying on the product details page.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 431
- Thank you received: 22
-

5 years 4 months ago [\#333364](#333364) by [mojweb](/forum/user/5128-mojweb "View mojweb's Profile")  Replied by *[mojweb](/forum/user/5128-mojweb "View mojweb's Profile")* on topic *[Custom field link problem](/forum/26-product-category-display/894699-custom-field-link-problem#333364 "-- HikaShop version -- : 3.4.0 -- Joomla version -- : 3.7.8 -- PHP version -- : 7.1  We need a cutom field link on some products (not all). So I set custom field link. All works fine, but cant find a way to have empty field. So if admin not enter url and text, then field is not showing on product detail. I try to delete default value in custom field, but allways : is showing.")*

Solved. Thank you

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84OTQ2OTktY3VzdG9tLWZpZWxkLWxpbmstcHJvYmxlbT90bXBsPW1hcmtkb3du) or [Create an account](/register) 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.435 seconds

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