Custom field link problem

  • Posts: 42
  • Thank you received: 2
  • Hikashop Business
5 months 2 days 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: 1879
  • Thank you received: 254
  • MODERATOR
5 months 1 day 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 months 1 day ago by Philip.

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

  • Posts: 42
  • Thank you received: 2
  • Hikashop Business
5 months 1 day 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: 11833
  • Thank you received: 1635
  • MODERATOR
5 months 18 hours 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: 42
  • Thank you received: 2
  • Hikashop Business
4 months 4 weeks 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: 42
  • Thank you received: 2
  • Hikashop Business
4 months 4 weeks ago #292816

Second bug

Attachments:
Last Edit: 4 months 4 weeks ago by mojweb.

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

  • Posts: 63533
  • Thank you received: 9153
  • MODERATOR
4 months 4 weeks 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: 42
  • Thank you received: 2
  • Hikashop Business
4 months 4 weeks 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.

Time to create page: 0.098 seconds
Powered by Kunena Forum