User registration form: Order of the field

  • Posts: 43
  • Thank you received: 3
9 years 3 months ago #211755

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.3

Hi all,

in the default setting of the customers registration form all fields are displayed in one column.
I would like to display the street and house number in one row as well as the post code and city in one row.
The related php file uses a table which is not static but will be generated related to the used fields, so there is nothing that can be changed manually by editing the table.
Any clue how that could work? Or is it just a simple setting that can be edited in the custom fields section and I overlooked this?

Thanks.

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #211759

Hi,

You'll have to edit the the custom_fields or custom_fields_bootstrap view file of the "user" view via the menu Display>Views to change that.
As you say, it's not a static HTML code but dynamic so you'll need to use PHP code to modify the display in the view.
So you would skip the display of the closing div (td/tr) tags at the end of the file for the post code custom field, and you would skip the opening div (td/tr) tags at the beginning of the foreach for the city custom field. And that would make the post code and city fields display on the same line (maybe some additional CSS might be necessary to make it look nice.
In fact, with the boostrap display, you might even be able to do that with pure (albeit tricky) CSS.

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

  • Posts: 43
  • Thank you received: 3
9 years 3 months ago #212199

Hi Nicolas,

basically I understand what you are saying. If it was statc HTML it would be simple to skip the td-tags for the related fields.
But in php I really have no understanding how that could work. I think there need to be made some exceptions in the code only with the fields that should be displayed different (street, house number, post code, city). But as long as the code applies to all relevant fields I have no understanding.

This is the related code of the user custom_fields file:

?><?php
	$type = $this->type;
	foreach($this->extraFields[$type] as $fieldName => $oneExtraField) {
	?>
		<tr class="hikashop_registration_<?php echo $fieldName;?>_line" id="hikashop_<?php echo $type.'_'.$oneExtraField->field_namekey; ?>">
			<td class="key">
				<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
			</td>
			<td>
				<?php $onWhat='onchange'; if($oneExtraField->field_type=='radio') $onWhat='onclick';
				echo $this->fieldsClass->display(
						$oneExtraField,
						@$this->$type->$fieldName,
						'data['.$type.']['.$fieldName.']',
						false,
						' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\''.$type.'\',0);"',
						false,
						$this->extraFields[$type],
						$this->$type
				); ?>
			</td>
		</tr>
	<?php }	?>

Last edit: 9 years 3 months ago by disc.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 3 months ago #212204

Hi,

It's not complex to add specific rules for only one field.

For example if you want to add the:
<tr class="hikashop_registration_<?php echo $fieldName;?>_line" id="hikashop_<?php echo $type.'_'.$oneExtraField->field_namekey; ?>">
to all the fields expect one called "test", you can do like that:
<?php if ($fieldName!='test'){ ?>
<tr class="hikashop_registration_<?php echo $fieldName;?>_line" id="hikashop_<?php echo $type.'_'.$oneExtraField->field_namekey; ?>">
<?php } ?>

If you know a bit of PHP, it's fairly easy. But again, even without changing anything there, I think that you should be able to achieve such display with CSS alone.

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

Time to create page: 0.054 seconds
Powered by Kunena Forum