Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Lock Customer Profile Details Rate Topic   - - - - -

 

Posted 25 August 2016 - 07:21 AM #1

Hello,

 

Is any way to lock some customer profile fields (email, name, lastname) after a customer sign in on our website? 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 25 August 2016 - 07:26 AM #2

Hello,

 

Is any way to lock some customer profile fields (email, name, lastname) after a customer sign in on our website? 

 

What do you mean by "lock"? They should not be editable?


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 

Posted 25 August 2016 - 07:29 AM #3

What do you mean by "lock"? They should not be editable?

Exactly, if customers need to change their email they must need to contact us and not have the ability to change the field.



 
  • galtinbaeva
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 06-Dec 13
  • 3303 posts

Posted 25 August 2016 - 07:50 AM #4

Exactly, if customers need to change their email they must need to contact us and not have the ability to change the field.

 

To disable e-mail you need to find design/themes/YOUR_THEME/templates/views/profiles/components/profiles_account.tpl and replace this code: 

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" />
</div>

with this one:

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" disabled="disabled"/>
</div>

and clear cache.


Simtech Development | sales@simtechdev.com | www.simtechdev.com
CERTIFIED CS-CART PARTNER | LICENSES | DEVELOPMENT | ADD-ONS | DESIGN | UPGRADE

Google Analytics Enhanced Ecommerce - get advanced ecommerce analytics


 

Posted 25 August 2016 - 08:57 AM #5

To disable e-mail you need to find design/themes/YOUR_THEME/templates/views/profiles/components/profiles_account.tpl and replace this code: 

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" />
</div>

with this one:

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" disabled="disabled"/>
</div>

and clear cache.

Thanks it works for email field, do you know in which file can i make the same for fields like name, lastname?



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 25 August 2016 - 02:18 PM #6

design/themes/YOUR_THEME/templates/views/profiles/components/profile_fields.tpl
 
replace
 

<input {if $field.autocomplete_type}x-autocompletetype="{$field.autocomplete_type}"{/if} type="text" id="{$id_prefix}elm_{$field.field_id}" name="{$data_name}[{$data_id}]" size="32" value="{$value}" class="ty-input-text {if !$skip_field}{$_class}{else}cm-skip-avail-switch{/if} {if $smarty.foreach.profile_fields.index == 0} cm-focus{/if}" {if !$skip_field}{$disabled_param nofilter}{/if} />

with
 

{$additional_params = ''}
{if $auth.user_id}
    {if $data_id == 'firstname' || $data_id == 'lastname' || $data_id == 's_firstname' || $data_id == 's_lastname' || $data_id == 'b_firstname' || $data_id == 'b_lastname'}
        {$additional_params = "disabled=\"disabled\""}
    {/if}
{/if}
<input {if $field.autocomplete_type}x-autocompletetype="{$field.autocomplete_type}"{/if} type="text" id="{$id_prefix}elm_{$field.field_id}" name="{$data_name}[{$data_id}]" size="32" value="{$value}" class="ty-input-text {if !$skip_field}{$_class}{else}cm-skip-avail-switch{/if} {if $smarty.foreach.profile_fields.index == 0} cm-focus{/if}" {if !$skip_field}{$disabled_param nofilter}{/if} {$additional_params nofilter} />

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • galtinbaeva
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 06-Dec 13
  • 3303 posts

Posted 25 August 2016 - 02:22 PM #7

 

design/themes/YOUR_THEME/templates/views/profiles/components/profile_fields.tpl
 
replace
 

<input {if $field.autocomplete_type}x-autocompletetype="{$field.autocomplete_type}"{/if} type="text" id="{$id_prefix}elm_{$field.field_id}" name="{$data_name}[{$data_id}]" size="32" value="{$value}" class="ty-input-text {if !$skip_field}{$_class}{else}cm-skip-avail-switch{/if} {if $smarty.foreach.profile_fields.index == 0} cm-focus{/if}" {if !$skip_field}{$disabled_param nofilter}{/if} />

with
 

{$additional_params = ''}
{if $auth.user_id}
    {if $data_id == 'firstname' || $data_id == 'lastname' || $data_id == 's_firstname' || $data_id == 's_lastname' || $data_id == 'b_firstname' || $data_id == 'b_lastname'}
        {$additional_params = "disabled=\"disabled\""}
    {/if}
{/if}
<input {if $field.autocomplete_type}x-autocompletetype="{$field.autocomplete_type}"{/if} type="text" id="{$id_prefix}elm_{$field.field_id}" name="{$data_name}[{$data_id}]" size="32" value="{$value}" class="ty-input-text {if !$skip_field}{$_class}{else}cm-skip-avail-switch{/if} {if $smarty.foreach.profile_fields.index == 0} cm-focus{/if}" {if !$skip_field}{$disabled_param nofilter}{/if} {$additional_params nofilter} />

 

I agree, but there is a moment: fields are still editable at the Shipping address block for some reason.


Simtech Development | sales@simtechdev.com | www.simtechdev.com
CERTIFIED CS-CART PARTNER | LICENSES | DEVELOPMENT | ADD-ONS | DESIGN | UPGRADE

Google Analytics Enhanced Ecommerce - get advanced ecommerce analytics


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 25 August 2016 - 02:42 PM #8

I agree, but there is a moment: fields are still editable at the Shipping address block for some reason.

 

Works ok for me on the local installation


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 

Posted 25 August 2016 - 04:15 PM #9

 

design/themes/YOUR_THEME/templates/views/profiles/components/profile_fields.tpl
 
replace
 

<input {if $field.autocomplete_type}x-autocompletetype="{$field.autocomplete_type}"{/if} type="text" id="{$id_prefix}elm_{$field.field_id}" name="{$data_name}[{$data_id}]" size="32" value="{$value}" class="ty-input-text {if !$skip_field}{$_class}{else}cm-skip-avail-switch{/if} {if $smarty.foreach.profile_fields.index == 0} cm-focus{/if}" {if !$skip_field}{$disabled_param nofilter}{/if} />

with
 

{$additional_params = ''}
{if $auth.user_id}
    {if $data_id == 'firstname' || $data_id == 'lastname' || $data_id == 's_firstname' || $data_id == 's_lastname' || $data_id == 'b_firstname' || $data_id == 'b_lastname'}
        {$additional_params = "disabled=\"disabled\""}
    {/if}
{/if}
<input {if $field.autocomplete_type}x-autocompletetype="{$field.autocomplete_type}"{/if} type="text" id="{$id_prefix}elm_{$field.field_id}" name="{$data_name}[{$data_id}]" size="32" value="{$value}" class="ty-input-text {if !$skip_field}{$_class}{else}cm-skip-avail-switch{/if} {if $smarty.foreach.profile_fields.index == 0} cm-focus{/if}" {if !$skip_field}{$disabled_param nofilter}{/if} {$additional_params nofilter} />

 

Thanks, this works fine with fields name, lastname



 

Posted 25 August 2016 - 04:18 PM #10

To disable e-mail you need to find design/themes/YOUR_THEME/templates/views/profiles/components/profiles_account.tpl and replace this code: 

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" />
</div>

with this one:

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" disabled="disabled"/>
</div>

and clear cache.

 

It works OK when a customer is logged in but it was a problem when someone want to register to our website the field email is not be editable too. Is any way to fix this?



 
  • galtinbaeva
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 06-Dec 13
  • 3303 posts

Posted 25 August 2016 - 04:58 PM #11

It works OK when a customer is logged in but it was a problem when someone want to register to our website the field email is not be editable too. Is any way to fix this?

 

Please replace that code with this one:

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" {if $auth.user_id} disabled="disabled"{/if}/>
</div>

Simtech Development | sales@simtechdev.com | www.simtechdev.com
CERTIFIED CS-CART PARTNER | LICENSES | DEVELOPMENT | ADD-ONS | DESIGN | UPGRADE

Google Analytics Enhanced Ecommerce - get advanced ecommerce analytics


 

Posted 25 August 2016 - 05:04 PM #12

 

Please replace that code with this one:

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" {if $auth.user_id} disabled="disabled"{/if}/>
</div>

 

This works. Thank you for your help.



 

Posted 26 August 2016 - 07:33 AM #13

 

Please replace that code with this one:

<div class="ty-control-group">
    <label for="email" class="ty-control-group__title cm-required cm-email cm-trim">{__("email")}</label>
    <input type="text" id="email" name="user_data[email]" size="32" maxlength="128" value="{$user_data.email}" class="ty-input-text cm-focus" {if $auth.user_id} disabled="disabled"{/if}/>
</div>

Hello again, is any way to put an if statement for fields name and lastname when they are null?



 

Posted 26 August 2016 - 08:06 AM #14

Hello again, is any way to put an if statement for fields name and lastname when they are null?


Hello again, is any way to put an if statement for fields name and lastname when they are null?

My problem is that when someone put something in his cart and then goes to checkout and check register and fill the fields email and password and click register, in the second step the fields name and lastname are not editable because {if $auth.user_id} is true. Is any way to pass this and make the fields name - lastname not editable only when the register is complete with all the fields complete?



 
  • galtinbaeva
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 06-Dec 13
  • 3303 posts

Posted 26 August 2016 - 08:52 AM #15

Hello again, is any way to put an if statement for fields name and lastname when they are null?

 

Please replace this condition

{if $auth.user_id}

with this

{if $auth.user_id && !empty($value)}

Simtech Development | sales@simtechdev.com | www.simtechdev.com
CERTIFIED CS-CART PARTNER | LICENSES | DEVELOPMENT | ADD-ONS | DESIGN | UPGRADE

Google Analytics Enhanced Ecommerce - get advanced ecommerce analytics


 

Posted 26 August 2016 - 09:30 AM #16

 

Please replace this condition

{if $auth.user_id}

with this

{if $auth.user_id && !empty($value)}

 

I think now is ok. 

Something else, do you know how can i put for  field "phone" something to check the unique of value? Like email field work now in cscart?



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 26 August 2016 - 10:59 AM #17

app/functions/fn.users.php

 

Try to replace:

 $condition = db_quote(" (?p ?p) ", (!empty($user_data['email']) ? db_quote('email = ?s', $user_data['email']) : '0'), (empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login'])));

with

 $condition = db_quote(" (?p ?p ?p) ", (!empty($user_data['email']) ? db_quote('email = ?s', $user_data['email']) : '0'), (empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login'])), (empty($user_data['phone']) ? '' : db_quote(" OR phone = ?s", $user_data['phone'])));

(!) Not tested


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 

Posted 26 August 2016 - 11:27 AM #18

app/functions/fn.users.php

 

Try to replace:

 $condition = db_quote(" (?p ?p) ", (!empty($user_data['email']) ? db_quote('email = ?s', $user_data['email']) : '0'), (empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login'])));

with

 $condition = db_quote(" (?p ?p ?p) ", (!empty($user_data['email']) ? db_quote('email = ?s', $user_data['email']) : '0'), (empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login'])), (empty($user_data['phone']) ? '' : db_quote(" OR phone = ?s", $user_data['phone'])));

(!) Not tested

 

I try this but it not working.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19044 posts

Posted 26 August 2016 - 02:16 PM #19

Do you use phone in the contact information or address section?


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 

Posted 26 August 2016 - 02:17 PM #20

Do you use phone in the contact information or address section?

 

I use phone in the billing and shipping section.