Custom Field "Read Only" in both - front & backend

  • Posts: 48
  • Thank you received: 0
11 years 8 months ago #94516

Hi,
I would like to set several custom fields (for example the "address company" to "read only". Meaning, the user cannot change this in the frontend. As it is described in the help section: "Read only: Used to lock the value of a text type custom field, the customer can't change it's value."

However, the point is, if I set a field to "Read Only", then it is also not editable in the admin backend anymore. That means, it cannot changed at all. I also cannot setup the data for a new user.

I think this should be editable by the admin in the backend, shouldn´t it be?

Thx

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

  • Posts: 13201
  • Thank you received: 2322
11 years 8 months ago #94557

Hi,

What can be done is editing the view "user / editaddress" (backend template) and relplace the line:

echo $this->fieldsClass->display($oneExtraField,$this->address->$fieldName,'data[address]['.$fieldName.']',false,''.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'address\',0);"'); ?>
By:
echo $this->fieldsClass->display($oneExtraField,$this->address->$fieldName,'data[address]['.$fieldName.']',false,'backend'.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'address\',0);"'); ?>
And in the class field.php (administrator/components/com_hikashop/classes/field.php) replace the line:
$size .= empty($field->field_options['readonly']) ? '' : ' readonly="readonly"';
By:
		if(!preg_match('/^backend/',$options))
			$size .= empty($field->field_options['readonly']) ? '' : ' readonly="readonly"';
		$options = preg_replace('/^backend/','',$options);

The following user(s) said Thank You: theweasel68

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

  • Posts: 48
  • Thank you received: 0
11 years 8 months ago #94583

Thanks. Will this be part of the next update release, or do I need to take care about saving & updating the new field.php file?
I assume, changes in the VIEW files will remain even after an update, as long as the changes where made via the HikaShop backend?

Last edit: 11 years 8 months ago by theweasel68.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 8 months ago #94684

Hi,

We will not add it in short therm, but later there will be options to set the access on the custom fields.

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

Time to create page: 0.075 seconds
Powered by Kunena Forum