registration form customization

  • Posts: 29
  • Thank you received: 0
13 years 2 months ago #25142

Hey,

I would like hide the Name field in the registration process and fill it with First Name & Last name, as no one wants to fill out their name twice.

I understand this might be possible with simplified registration, however I want my user to be able to choose their own password.

any ideas on how to do this?

I have found this code for the address information (first name & last name) but unsure on where the "template" actually is.

<tr class="hikashop_registration_address_info_line">
<td colspan="2" height="40">
<?php echo JText::_( 'ADDRESS_INFORMATION' ); ?>
</td>
</tr>
<?php
$this->type = 'address';
echo $this->loadTemplate();
?>
<tr class="hikashop_registration_required_info_line">
<td colspan="2" height="40">
<?php echo JText::_( 'HIKA_REGISTER_REQUIRED' ); ?>
</td>
</tr>


I'm guessing I need to do something like this:

<input type="text" id="register_email" name="data[register]" value="<?php echo $this->escape($this->mainUser->get( 'email' ));?>" class="inputbox required validate-email" maxlength="100" onchange="document.getElementById('register_username').value = this.value"/> * which I have for the username/email part, but as the address form is loaded via a template(?) I don't know what the first name & last name fields are called I would also have to combine the two fields (first & last name) into one document.getElementById to put into the name field. Many thanks! :)[email]" value="<?php echo $this->escape($this->mainUser->get( 'email' ));?>" class="inputbox required validate-email" maxlength="100" onchange="document.getElementById('register_username').value = this.value"/> *


which I have for the username/email part, but as the address form is loaded via a template(?) I don't know what the first name & last name fields are called

I would also have to combine the two fields (first & last name) into one document.getElementById to put into the name field.


Many thanks! :)

Last edit: 13 years 2 months ago by sepyh.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 2 months ago #25145

Hi,

The registration layout is located in the file "registration" of the view "user" that you can edit via the menu Display->Views. The address fields are displayed by the file "custom_fields" of the same view.
The address lastname and firstname fields have the ids address_lastname and address_firstname

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

  • Posts: 29
  • Thank you received: 0
13 years 2 months ago #25162

thanks nick, that did help me understand a little (the fact that address is loaded through the custom fields, doh!)

i've come up with this:

<input class="inputbox required validate-password" type="password" id="register_password" name="data[register][password]" value="" onchange="document.getElementById('register_name').value = address_firstname.value + ' ' + address_lastname.value"/> *

while it works, it could pose a problem if the user changes their first and last name after they've put in a password. would you have any idea of a better way of doing it, maybe on submitting the form somehow? would it dupe the fields before checking if name was empty?

cheers

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 2 months ago #25163

In that case, you could do your javascript in the displayButton function call which display the "register" button at the end of the "registration" file.

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

  • Posts: 29
  • Thank you received: 0
13 years 2 months ago #25164

okay thanks, it's actually your JS that i modified from an old post along with:

<tr class="hikashop_registration_name_line" style="display:none;">

:)

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

  • Posts: 29
  • Thank you received: 0
13 years 2 months ago #25167

pretty tough,

i've done this but getting syntax errors :(

echo $this->cartClass->displayButton(JText::_('HIKA_REGISTER'),'register',$this->params,'','if(hikashopCheckChangeForm(\'register\',\''.$this->form_name.'\') && hikashopCheckChangeForm(\'user\',\''.$this->form_name.'\') && hikashopCheckChangeForm(\'address\',\''.$this->form_name.'\')'.$additional_check.'){ var button = document.getElementById(\'login_view_action\'); if(button) button.value=\'register\'; document.'.$this->form_name.'.submit(); document.getElementById('register_name').value = address_firstname.value + ' ' + address_lastname.value; } return false;');

i'm not great with JS :( any help highly appreciated

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 2 months ago #25168

First, you need to escape your quotes are your js is into a php string.
So it should be:
document.getElementById(\'register_name\').value = address_firstname.value + \' \' + address_lastname.value;


also, you should put it before the form submit: document.'.$this->form_name.'.submit();
Otherwise, the form is submitted before your javascript is done.

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

  • Posts: 29
  • Thank you received: 0
13 years 2 months ago #25173

thanks great help, one last thing, is it possible to style/CSS the custom fields ?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 2 months ago #25175

Sure. Each custom field has an id as you just saw, so you can do like that:

#address_firstname{
width: 350px;
}

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

  • Posts: 29
  • Thank you received: 0
13 years 2 months ago #25177

cool, thanks.

is it essential to upgrade to hikashop business if i want my own custom step in my workflow? (ideally customer enters email only on first step like amazon)

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 2 months ago #25178

Well, adding a custom step file means that you also need to add the corresponding code in the controller which
1. is not easy to do as the code is complex
2. means that you'll have to modify core files of HikaShop.

It's not related to the edition of HikaShop you're using.

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

  • Posts: 29
  • Thank you received: 0
13 years 2 months ago #25179

i see. well i tried editing fields.php by adding the code:

<?php
$this->setLayout('custom_fields');
$this->type = 'user';
echo $this->loadTemplate();


?>

but it doesn't work. Is this an Hikashop edition lock (not allowed) or what?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 2 months ago #25189

I'm not following you ?

There is no lock on that respect.

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

Time to create page: 0.075 seconds
Powered by Kunena Forum