Moving * for required fields

  • Posts: 182
  • Thank you received: 15
11 years 7 months ago #96676

I want to have the * next to the field name instead of its now akward position under the field.

I could edit this in the display/view/registration file to get what I want.
But for the other fields that are custom fields I can't find where to edit this.

See attachement.

Thanks


Jan

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
11 years 7 months ago #96716

Hi Jan,

If you really want to do that, I think that you'll have to :
- Edit the file "Hikashop/back/classes/field.php"
- Change the line :

function display(&$field, $value, $map, $inside = false, $options = '', $test = false, $allFields = null, $allValues = null){
		$field_type = $field->field_type;
		if(substr($field->field_type,0,4) == 'plg.') {
			$field_type = substr($field->field_type,4);
			JPluginHelper::importPlugin('hikashop', $field_type);
		}
		$classType = 'hikashop'.ucfirst($field_type);
		$class = new $classType($this);
		if(is_string($value))
			$value = htmlspecialchars($value, ENT_COMPAT,'UTF-8');

		$html = $class->display($field,$value,$map,$inside,$options,$test,$allFields,$allValues);

		if(!empty($field->field_required)){
			$html .=' <span class="hikashop_field_required">*</span>';
		}
		return $html;
	}
by :
function display(&$field, $value, $map, $inside = false, $options = '', $test = false, $allFields = null, $allValues = null){
		$field_type = $field->field_type;
		if(substr($field->field_type,0,4) == 'plg.') {
			$field_type = substr($field->field_type,4);
			JPluginHelper::importPlugin('hikashop', $field_type);
		}
		$classType = 'hikashop'.ucfirst($field_type);
		$class = new $classType($this);
		if(is_string($value))
			$value = htmlspecialchars($value, ENT_COMPAT,'UTF-8');
		$html= '';
		if(!empty($field->field_required)){
			$html .=' <span class="hikashop_field_required">*</span>';
		}
		$html .= $class->display($field,$value,$map,$inside,$options,$test,$allFields,$allValues);


		return $html;
	}

Hope this will help you a little.

The following user(s) said Thank You: jansuhr

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

  • Posts: 182
  • Thank you received: 15
11 years 7 months ago #96742

Hi Mohamed,

That moved them but only on top of the field instead of at the bottom.

I want them to be after the label in the tablecell before the cell that has the input field.









I might go with the other approach and setting the class hikashop_filed_required to be hidden and the rename the field names to include the * symbol.


Jan

Attachments:

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

  • Posts: 82785
  • Thank you received: 13353
  • MODERATOR
11 years 7 months ago #96744

You should hide the * with CSS and then add the * after the label display in the custom_fields or custom_fields_bootstrap file of the view user via the menu Display->Views.
For example, to add it to all the fields, you can simply add a * after:
<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>

The following user(s) said Thank You: jansuhr

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

  • Posts: 182
  • Thank you received: 15
11 years 7 months ago #96745

Hi Nicoals,

Yes I went with that method, except that I had to change it in my Swedish language file too.

And I don't need it on all fields so your tip can't be used this time.


Thanks


Jan

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

Time to create page: 0.064 seconds
Powered by Kunena Forum