Jump to content

[SOLVED] Disable in "new adress" auto fill in "first name" and "last name"


GNDavid

Recommended Posts

Hi,

 

I have one page checkout . I already disable auto fil in "fast checkout" taking in file " order-opc-new-account.tpl " the code:

 

onblur="$('#lastname').val($(this).val());"

 

 

BUT  IN " new adress" when loged in i nead help to disable the auto fill in the fiels "firstname"  and  "lastname".

 

 

I go to the file "address.tpl" and dont see nothing about that.

 

 

note: I know that prestashop associate the email logged in with these fields , ok.  I just  dont want that when clients go adding new addresses have to delete  the name from auto fill to put the new firs tname and last name of the new address.

 

Version of Prestashop I have  1.6.1.1

 

 

HELP PLEASE

Edited by GNDavid (see edit history)
Link to comment
Share on other sites

Hi GNDavid,

 

{if $field_name eq 'firstname'}
                    <div class="required form-group">
                        <label for="firstname" class="col-sm-4 control-label">{l s='First name'} <sup>*</sup></label>
                        <div class="col-sm-6">
                            <input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" name="firstname" id="firstname" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{else}{if isset($address->firstname)}{$address->firstname|escape:'html':'UTF-8'}{/if}{/if}" />
                        </div>    
                    </div>
                {/if}
                {if $field_name eq 'lastname'}
                    <div class="required form-group">
                        <label for="lastname" class="col-sm-4 control-label">{l s='Last name'} <sup>*</sup></label>
                        <div class="col-sm-6">
                            <input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="lastname" name="lastname" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{else}{if isset($address->lastname)}{$address->lastname|escape:'html':'UTF-8'}{/if}{/if}" />
                        </div>    
                    </div>
                {/if}

Link to comment
Share on other sites

Hi GNDavid,

 

Go to themes -> your current theme -> address.tpl and in that file find the below codings

 

<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" name="firstname" id="firstname" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{else}{if isset($address->firstname)}{$address->firstname|escape:'html':'UTF-8'}{/if}{/if}" />

 

<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="lastname" name="lastname" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{else}{if isset($address->lastname)}{$address->lastname|escape:'html':'UTF-8'}{/if}{/if}" />

 

In the above two codings just empty the "value" attribute like below

 

 

<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" name="firstname" id="firstname" value="" />

 

<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="lastname" name="lastname" value="" />

  • Like 1
Link to comment
Share on other sites

I already try changing the code of value , but if I do what you say when I go to "update address" "firstname" and "lastname" would not be in the address to update.

 

Another problem too:

 

In "new address " when I save the "new address " if for example I forget to put the field "city " or another field diferent of  "firstname" or "lastname" when it give me the error message to complete the field I forgot to put, the information that I  put in "firstname" and "lastname" fields disappears.

 

Anyone can help me with a solution PLEASE.

Link to comment
Share on other sites

In themes -> your current theme -> address.tpl and in that file find the below codings


 


<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" name="firstname" id="firstname" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{else}{if isset($address->firstname)}{$address->firstname|escape:'html':'UTF-8'}{/if}{/if}" />


 


<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="lastname" name="lastname" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{else}{if isset($address->lastname)}{$address->lastname|escape:'html':'UTF-8'}{/if}{/if}" />


 


 


 


if i take out:


 


{if isset($smarty.post.lastname)}{$smarty.post.lastname}{else}..............................................{/if}


 


 


so left in " value "  only like this:


 


value="{if isset($address->lastname)}{$address->lastname|escape:'html':'UTF-8'}{/if}" />


 


resolve almoste the problem. STILL HAVE PROBLEM :


 


In "new address " when I save the "new address " if for example I forget to put the field "city " or another field diferent of  "firstname" or "lastname" when it give me the error message to complete the field I forgot to put, the information that I  put in "firstname" and "lastname" fields disappears dont persist like before and like all other fields.


 


 


HELP PLEASE

Link to comment
Share on other sites

[sOLVED]

 

 

Take out in  " controllers/front/AddressController.php " :




elseif (!Validate::isLoadedObject($this->_address) && Validate::isLoadedObject($this->context->customer)) {
            $_POST['firstname'] = $this->context->customer->firstname;
            $_POST['lastname'] = $this->context->customer->lastname;
            $_POST['company'] = $this->context->customer->company;
        }



so function  " public function postProcess() " will be only:

 public function postProcess()
    {
        if (Tools::isSubmit('submitAddress')) {
            $this->processSubmitAddress();
        }     }

I FIND OUT: Edited by GNDavid (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...