X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Impossible to register new account, please help (https://forum.x-cart.com/showthread.php?t=48137)

retrtrtrytrutru 06-17-2009 06:40 AM

Impossible to register new account, please help
 
Hi everyone,

Somehow it has become impossible to register a new account on our website. Please see https://www.qualitylamps.eu/register.php. If you enter your details and press the button, nothing happens. In Google Chrome I get an error "uncaught exception ReferenceError: _getById is not defined". Strange thing is, when you place an order and go through the checkout, everything is fine.

Here's my skin1/main/register_account.tpl

PHP Code:

{* $Idregister_account.tpl,v 1.19.2.5 2006/12/25 13:32:08 max Exp $ *}

{if 
$is_areas.S eq 'Y'}{if $hide_account_section ne "Y"}{if $hide_header eq ""}{/if}

{if 
$anonymous ne "" and $config.General.disable_anonymous_checkout ne "Y"}                        {* ANONYMOUS ACCOUNT *}
<
tr>
    <
td height="20" colspan="3">
<
script type="text/javascript">
<!--
{
literal}
function 
RegAccountOpen() {
    var 
obj document.getElementById('RegAccount');
    var 
box document.getElementById('reg_box');
    if (!
obj || !box)
        return;
    
box.style.display obj.checked "" "none";
}
{/
literal}
-->
</
script>
    
    <
br />
    <
table cellpadding="0" cellspacing="0">
    <
tr>
        <
td><label for="RegAccount" class="RegSectionTitle"><b>{$lng.create_account}</b></label></td>
        <
td>&nbsp;</td>
        <
td><input type="checkbox" id="RegAccount" name="RegAccount" value="Y" onclick="javascript: RegAccountOpen();"{if $RegAccountchecked="checked"{/if} /></td>
    </
tr>
    </
table>
    <
hr size="1" noshade="noshade" />
    </
td>
</
tr>
<
tbody id="reg_box">
<
tr><td colspan="3">{$lng.txt_anonymous_account_msg}</td></tr>
{/if}

{if 
$userinfo.login eq $login and $login and $userinfo.usertype ne "C"}

{* 
Display membership level *}

<
tr style="display: none;">
<
td>
<
input type="hidden" name="membershipid" value="{$userinfo.membershipid}/>
<
input type="hidden" name="pending_membershipid" value="{$userinfo.pending_membershipid}/>
</
td>
</
tr>

{else}

{if 
$config.General.membership_signup eq "Y" and ($usertype eq "C" or ($active_modules.Simple_Mode ne "" and $usertype eq "P") or $usertype eq "A" or $usertype eq "B") && $membership_levels}
{include 
file="admin/main/membership_signup.tpl"}
{/if}

{if 
$usertype eq "A" or ($usertype eq "P" and $active_modules.Simple_Mode ne "") && $membership_levels}
{include 
file="admin/main/membership.tpl"}
{/if}

{* /
Display membership level *}

{/if}

{if 
$anonymous ne "" and $config.General.disable_anonymous_checkout ne "Y"}

{* 
Anonymous account *}

<
tr>
<
td align="right" nowrap="nowrap">{$lng.lbl_username}</td>
<
td>&nbsp;</td>
<
td nowrap="nowrap">
<
input type="text" id="uname" name="uname" size="32" maxlength="32" value="{if $userinfo.uname}{$userinfo.uname}{else}{$userinfo.login}{/if}" onFocus="this.className='selected';" onblur="this.className='';" />
{if (
$reg_error ne "" && $reg_error ne 'A' && $userinfo.uname eq "" && $userinfo.login eq "") || $reg_error eq "U"}<font class="Star">&lt;&lt;</font>{/if}
</
td>
</
tr>

<
tr>
<
td align="right" nowrap="nowrap">{$lng.lbl_password}</td>
<
td>&nbsp;</td>
<
td nowrap="nowrap"><input type="password" name="passwd1" size="32" maxlength="64" value="{$userinfo.passwd1}onFocus="this.className='selected';" onblur="this.className='';" />
</
td>
</
tr>

<
tr>
<
td align="right" nowrap="nowrap">{$lng.lbl_confirm_password}</td>
<
td>&nbsp;</td>
<
td nowrap="nowrap"><input type="password" name="passwd2" size="32" maxlength="64" value="{$userinfo.passwd2}onFocus="this.className='selected';" onblur="this.className='';" />
</
td>
</
tr>

{* /
ANONYMOUS ACCOUNT *}

{else}

{* 
NOT ANONYMOUS ACCOUNT *}

<
tr>
    <
td height="20" colspan="3">
    <
br />
    <
table cellpadding="0" cellspacing="0">
    <
tr>
        <
td><label for="RegAccount" class="RegSectionTitle"><b>{$lng.lbl_username_n_password}</b></label></td>
    </
tr>
    </
table>
    <
hr size="1" noshade="noshade" />
    </
td>
</
tr>

<
tr>
<
td align="right" nowrap="nowrap">{$lng.lbl_username}</td>
<
td class="Star">*</td>
<
td nowrap="nowrap">
{if 
$userinfo.login ne "" || ($login eq $userinfo.uname && $login ne '')}
<
b>{$userinfo.login|default:$userinfo.uname}</b>
<
input type="hidden" name="uname" value="{$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}" onFocus="this.className='selected';" onblur="this.className='';" />
{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>

<
tr>
<
td align="right" nowrap="nowrap">{$lng.lbl_password}</td>
<
td><font class="Star">*</font></td>
<
td nowrap="nowrap"><input type="password" id="passwd1" name="passwd1" size="32" maxlength="64" value="{$userinfo.passwd1}onFocus="this.className='selected';" onblur="this.className='';" />
{if 
$reg_error ne "" and $userinfo.passwd1 eq ""}<font class="Star">&lt;&lt;</font>{/if} 
</
td>
</
tr>

<
tr>
<
td align="right" nowrap="nowrap">{$lng.lbl_confirm_password}</td>
<
td class="Star">*</td>
<
td nowrap="nowrap"><input type="password" id="passwd2" name="passwd2" size="32" maxlength="64" value="{$userinfo.passwd2}onFocus="this.className='selected';" onblur="this.className='';" />
{if 
$reg_error ne "" and $userinfo.passwd2 eq ""}<font class="Star">&lt;&lt;</font>{/if} 
</
td>
</
tr>

{* / 
NOT ANONYMOUS ACCOUNT *}

{/if}

{if ((
$active_modules.Simple_Mode ne "" and $usertype eq "P") or $usertype eq "A") and ($userinfo.uname && $userinfo.uname ne $login or !$userinfo.uname and $userinfo.login ne $login)}

{if 
$userinfo.status ne "A"}{* only for non-anonymous users *}
<
tr valign="middle">
<
td align="right">{$lng.lbl_account_status}:</td>
<
td>&nbsp;</td>
<
td nowrap="nowrap">
<
select name="status">
<
option value="N"{if $userinfo.status eq "N"selected="selected"{/if}>{$lng.lbl_account_status_suspended}</option>
<
option value="Y"{if $userinfo.status eq "Y"selected="selected"{/if}>{$lng.lbl_account_status_enabled}</option>
{if 
$active_modules.XAffiliate ne "" and ($userinfo.usertype eq "B" or $smarty.get.usertype eq "B")}
<
option value="Q"{if $userinfo.status eq "Q"selected="selected"{/if}>{$lng.lbl_account_status_not_approved}</option>
<
option value="D"{if $userinfo.status eq "D"selected="selected"{/if}>{$lng.lbl_account_status_declined}</option>
{/if}
</
select>
</
td>
</
tr>

{if 
$display_activity_box eq "Y"}
<
tr valign="middle">
<
td align="right">{$lng.lbl_account_activity}:</td>
<
td>&nbsp;</td>
<
td nowrap="nowrap">
<
select name="activity">
<
option value="Y"{if $userinfo.activity eq "Y"selected="selected"{/if}>{$lng.lbl_account_activity_enabled}</option>
<
option value="N"{if $userinfo.activity eq "N"selected="selected"{/if}>{$lng.lbl_account_activity_disabled}</option>
</
select>
</
td>
</
tr>
{/if}

{/if}{* 
$userinfo.status ne "A" *}

<
tr valign="middle">
    <
td colspan="2">&nbsp;</td>
    <
td nowrap="nowrap">

<
table>
<
tr>
    <
td><input type="checkbox" id="change_password" name="change_password" value="Y"{if $userinfo.change_password eq "Y"checked="checked"{/if} /></td>
    <
td><label for="change_password">{$lng.lbl_reg_chpass}</label></td>
</
tr>
</
table>

    </
td>
</
tr>

{/if}

{else}
<
tr style="display: none;">
<
td>
<
input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}/>
<
input type="hidden" name="passwd1" value="{$userinfo.passwd1}/>
<
input type="hidden" name="passwd2" value="{$userinfo.passwd2}/>
</
td>
</
tr>

{* 
AANGEPAST 20080922 *}
{/if}
{if !
$RegAccount}
<
tr style="display: none;">
    <
td>
<
script type="text/javascript">
<!--
if (
document.getElementById('reg_box'))
    
document.getElementById('reg_box').style.display 'none';
-->
</
script>
    </
td>
</
tr>
{/if}
</
tbody>
{* 
EINDE AANGEPAST 20080922 *}

{/if} 

Any ideas? The registration box is displayed on the normal register page but hidden on the checkout page, this might have something to do with it I suspect. Thanks a lot for any help!

pauldodman 06-17-2009 07:47 AM

Re: Impossible to register new account, please help
 
Well it doesn't work in IE - a javascript error appears only when you are in the Invoice address section - so the clue is in there somewhere. Looks like a customised form - any ideas what you've done, or who did it for you?

retrtrtrytrutru 06-17-2009 10:25 PM

Re: Impossible to register new account, please help
 
Actually the registration button has always worked fine until we moved servers. I also changed the way the page loads up. The top part of the website was moved all the way down in the source code to let the search engines read the important content first. That's the only thing that has changed, no changes were made to the registration routine :( But I suspect that now that the top of the page is loaded last this is causing JavaScript errors because there was another script that gave an error. The form was custimised, correct, but it worked fine before. So strange and difficult to figure out what's triggering this error. Thanks for the help!

retrtrtrytrutru 06-17-2009 10:49 PM

Re: Impossible to register new account, please help
 
Hmm, using Chrome's error message "_getById is not defined" I can see that in check_required_fields_js.js in the skin1 folder there is the following code:

Code:

var obj = _getById(lFields[x][0]);
This is the only reference so far I have found that uses this element _getById.. Strange thing is, when you use the cart to register a new account it works fine, I will compare the two to see what's different.

retrtrtrytrutru 06-17-2009 11:42 PM

Re: Impossible to register new account, please help
 
Oh yeah, I did it :) In customer/home.tpl there was a typo in "{include file="meta.tpl"}" which prevented the file from being included. This meant common.js was not loaded on the registration page and from this script the element _getById could not be loaded. Simple.. but took me ages to figure out.

pauldodman 06-18-2009 12:20 AM

Re: Impossible to register new account, please help
 
Great - thanks for posting an update!


All times are GMT -8. The time now is 10:35 PM.

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