Custom field link problem

  • Posts: 275
  • Thank you received: 14
  • Hikashop Business
5 years 10 months ago #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.

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

  • Posts: 4486
  • Thank you received: 609
  • MODERATOR
5 years 10 months ago #292653

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 :



Then the custom Css to only remove the custom field value (and not the label)


See this tutorial 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

Hope this will answer your questions.
Regards

Last edit: 5 years 10 months ago by Philip.

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

  • Posts: 275
  • Thank you received: 14
  • Hikashop Business
5 years 10 months ago #292677

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 ;)

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

  • Posts: 12953
  • Thank you received: 1778
5 years 10 months ago #292701

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 or Create an account to join the conversation.

  • Posts: 275
  • Thank you received: 14
  • Hikashop Business
5 years 10 months ago #292813

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 or Create an account to join the conversation.

  • Posts: 275
  • Thank you received: 14
  • Hikashop Business
5 years 10 months ago #292816

Second bug

Attachments:
Last edit: 5 years 10 months ago by mojweb.

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

  • Posts: 81361
  • Thank you received: 13036
  • MODERATOR
5 years 10 months ago #292823

Hi,

I see. Add the code:

function check(&$field,&$value,$oldvalue) {
		if(is_string($value))
			$value = trim($value,':');
		return parent::check($field, $value, $oldvalue);
	}
after the 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

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

  • Posts: 275
  • Thank you received: 14
  • Hikashop Business
5 years 10 months ago #292857

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

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

  • Posts: 275
  • Thank you received: 14
  • Hikashop Business
2 years 9 months ago #333314

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

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

  • Posts: 81361
  • Thank you received: 13036
  • MODERATOR
2 years 9 months ago #333320

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 or Create an account to join the conversation.

  • Posts: 275
  • Thank you received: 14
  • Hikashop Business
2 years 9 months ago #333330

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 or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13036
  • MODERATOR
2 years 9 months ago #333333

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 or Create an account to join the conversation.

  • Posts: 275
  • Thank you received: 14
  • Hikashop Business
2 years 9 months ago #333364

Solved. Thank you

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

Time to create page: 0.097 seconds
Powered by Kunena Forum