X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Use E-mail address instead of username 3.5.x & 4.0 (https://forum.x-cart.com/showthread.php?t=8809)

dfawdon 02-13-2006 01:02 PM

Has anyone got this working with 4.017 ?

bigmaggot 03-19-2006 07:16 AM

Seems to work fine on 4.0.17

xcell67 04-14-2006 04:25 PM

Hi,

I'm going to throw in my method for 4.1.0 rc4 in case some couldn't get the others to work.

include/register.php

find

Code:

$fillerror = (empty($uname) || !empty($error) || empty($passwd1) || empty($passwd2) || ($passwd1 != $passwd2));

replace with

Code:

$fillerror = (!empty($error) || empty($passwd1) || empty($passwd2) || ($passwd1 != $passwd2));

By deleting the error check for username, the cart will allow registrations without it.



Find
Code:

if (!@$error && $current_area == "C" && $active_modules["UPS_OnLine_Tools"]) {

Replace with
Code:

if (empty($uname)) $uname = $email;

if (!@$error && $current_area == "C" && $active_modules["UPS_OnLine_Tools"]) {


Since we're not allowing the customer to enter a username, the code above will automatically populate the username field with the email the customer supplies.

Find
Code:

$profile_values['email'] = $email;

Replace with
Code:

$profile_values['email'] = $email;
$profile_values['login'] = $email;


When the customer updates their email, their login will also reflect the change. There's only a slight problem with this. If the customer updates any of their other information, everything is fine. But when they update their email, they will get logged out. I don't know what causes the logout but their email/login still gets changed. What I did for my cart was add a little note "Note: If you change your email address, you will have to re-login for security purposes"

skin1/generate_required_fields_js.tpl

Delete this code to prevent check for uname

Code:

        ["uname", "{$lng.lbl_username|strip|replace:'"':'\"'}"],


skin1/main/register_account.tpl

You'll need to comment out the username fields:

Code:

{* Anonymous account *}
{*
<tr>
<td align="right">Email Address</td>
<td></td>
<td nowrap="nowrap">
<input type="text" name="uname" size="32" maxlength="32" value="{$userinfo.login}" />
</td>
</tr>
*}


Code:

{* NOT anonymous account *}

{*<tr>
<td align="right">Email Address</td>
<td class="Star">*</td>
<td nowrap="nowrap">
{if $userinfo.login ne "" || ($login eq $userinfo.uname && $login ne '')}
{$userinfo.login|default:$userinfo.uname}
{else}
<input type="text" id="uname" name="uname" size="32" maxlength="32" value="{if $userinfo.uname}{$userinfo.uname}{else}{$userinfo.login}{/if}" />
{if ($reg_error ne "" and $userinfo.uname eq "" and $userinfo.login eq "") or $reg_error eq "U"}<font class="Star">&lt;&lt;</font>{/if}
{/if}
</td>
</tr>
*}
<input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}" />


With the above code, I had to take <input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}" /> out of the commented out code block because xcart needs it to finish the registration process. You can leave everything else commented out.


All of the above satisfies your needs if you want the customer to use their email as their login. The extra stuff below will add in a second field for them to type their email twice for confirmation:

skin1/main/register_contact_info.tpl or wherever tpl you have your email field in

Add this under the intial email block:

Code:

<TR>
<TD align="right">Retype Email</TD>
<TD><font class=Star>*</font></TD>
<TD nowrap>
<input type="text" id="emailtwo" name="emailtwo" size=32 maxlength=128 value="{$userinfo.email}">
</TD>


skin1/check_email_script.js
Add this:

Code:

            if(document.registerform.emailtwo) {
      if(field.value==document.registerform.emailtwo.value){ }
    else{
        alert("Please reconfirm your email address. It does not match.");
        document.registerform.emailtwo.focus();
        document.registerform.emailtwo.select();
      err = true;
    }
  }


before return !err; at the end of the file

</TR> [/code]

2019 04-28-2006 03:37 PM

xcell67 did you tried for final ver 4.1.0?:roll:
thank you.

Callum 05-06-2006 02:52 PM

Works great in 4.0.18 - thanks!

taltos1 06-29-2006 07:49 AM

Hello all! I need some expert advice. I am trying to get this patch to work.

ALTER TABLE `xcart_customers` ADD UNIQUE (
`email`
);

it does seem to work (i patched through the xcart admin), however, when I try to create a account to test this, and use the same email as an existing account after i press submit I get this error on a blank white page:
Code:

INVALID SQL: 1062 : Duplicate entry 'email@hotmail.com' for key 3
SQL QUERY FAILURE: INSERT INTO xcart_customers ....


Also, there are not duplicate emails in the database.

then it goes to "user created" dialog message but upon checking in the admin the user is not actually created. Any insight about this error.

Any insight please let me know.. :-(

mrkenzie 06-29-2006 07:55 AM

Make sure you don't have the same email in the database for two different accounts.

taltos1 06-29-2006 08:09 AM

Nope, there are no duplicate emails. Any other ideas?

TL408 06-29-2006 08:40 AM

Quote:

Originally Posted by 2019
xcell67 did you tried for final ver 4.1.0?:roll:
thank you.

I would like to know as well. Anyone had a chance to test it yet?

Thanks.

2019 07-05-2006 03:36 AM

any1? :(


All times are GMT -8. The time now is 03:02 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.