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)
-   -   Two authboxes causing javascript error (https://forum.x-cart.com/showthread.php?t=17253)

DanUK 10-13-2005 06:56 AM

Two authboxes causing javascript error
 
OK, experimenting with two authentication boxes (authbox.tpl) on the page, but the strange thing is that when I click the "Logoff" text next to the "Go" button, it results in a javascript error "Object does not support this method". Alternatively, if I click the "Go" button it does actually logoff. This behaviour only happens when the two authboxes are present on the page.

I've seen this mentioned once before on the forum but no solution or reason as to why it happens. The button code on the authbox is (which I gather is default X-Cart):

Code:

{if $js_enabled}
{include file="buttons/logout_menu.tpl"}
{else}
{include file="buttons/logout_menu.tpl"}
{/if}


and the button/logout_menu.tpl is:

Code:

<FONT class="VertMenuItems">{$lng.lbl_logoff} </FONT><INPUT type="image" { include file="buttons/go_image_menu.tpl" }>

Any ideas?

Dan

DanUK 10-13-2005 08:09 AM

Worked it out. X-Cart/Javascript doesn't seem to like the two forms having the same name. I've made a second (copied) authbox.tpl and changed the "name" of the form from:
Code:

<FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform">

to:

Code:

<FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform2">

then I updated the a href tag of the button to reference this form:


I now have the original authbox.tpl on the side menu and the doctored authbox.tpl (authbox_mod.tpl) within the page. It now logs off regardless of what's pressed!

Dan

rcg 06-19-2006 09:04 PM

I'm getting errors on this topic... I created a "Your Account" page which can display the login so I end up with 2 login boxes (one on the menu left and the "account" page I created).

I'm clear about the first part of your mod but where do I modify the button hyperlink you reference in the last entry of your mod?

My issue is login in only not logout. I only display one logout button on the side menu.

Thanks

DanUK 06-19-2006 11:31 PM

Hi,

In my modified auhtbox (authbox_mod.tpl) I have:

Code:


{if $js_enabled}
{include file="buttons/button.tpl" style="button" button_title=$lng.lbl_logoff href="javascript:document.loginform2.submit()"}
{else}
{include file="buttons/logout_menu.tpl" style="button" href="javascript:document.loginform2.submit()"}
{/if}



which is the button code.

Dan

rcg 06-20-2006 07:01 AM

so you are adding the above code or modifying the existing code? Here is my version as of right now.



Code:

{* $Id: authbox_mod.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *}
{capture name=menu}
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform">
<tr>
<TD width="1%"></TD>
<TD width="99%">
<font color="#333333" size="4">{$login}{$lng.txt_logged_in}</font>
</TD>
</tr>
{if $usertype eq "C"}
{/if}
<INPUT type="hidden" name="mode" value="logout">
<INPUT type="hidden" name="redirect" value="{$redirect}">
</FORM>
</TABLE>
{/capture}

{include file="menu_mod.tpl" menu_title=$lng.lbl_authentication menu_content=$smarty.capture.menu}


DanUK 06-20-2006 07:21 AM

My opening form tag is:

Code:

<FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform2">

and then the bottom of my file looks like:

Code:

{if $user_subscription ne ""}
 {include file="modules/Subscriptions/subscriptions_menu.tpl"}</a>

 {/if}
 {/if}

 



{if $js_enabled}
{include file="buttons/button.tpl" style="button" button_title=$lng.lbl_logoff href="javascript:document.loginform2.submit()"}
{else}
{include file="buttons/logout_menu.tpl" style="button" href="javascript:document.loginform2.submit()"}
{/if}


</TD>
</TR>
{if $usertype eq "C"}
<TR>
<TD colspan="2" align="right">


{if $js_enabled}
{$lng.txt_javascript_disabled}
{else}
{$lng.txt_javascript_enabled}
{/if}
</TD>
</TR>
{/if}
<INPUT type="hidden" name="mode" value="logout">
<INPUT type="hidden" name="redirect" value="{$redirect}">
</FORM>
</TABLE>
{/capture}
{ include file="menu_mod.tpl" menu_content=$smarty.capture.menu }


so long as the button code I gave is within the form tags it should work, so you may want to try something like:


Code:

{* $Id: authbox_mod.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *}
{capture name=menu}
<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
<FORM action="{$xcart_web_dir}/include/login.php" method="post" name="loginform2">
<tr>
<TD width="1%"></TD>
<TD width="99%">
<font color="#333333" size="4">{$login}{$lng.txt_logged_in}</font>

 
{if $js_enabled}
{include file="buttons/button.tpl" style="button" button_title=$lng.lbl_logoff href="javascript:document.loginform2.submit()"}
{else}
{include file="buttons/logout_menu.tpl" style="button" href="javascript:document.loginform2.submit()"}
{/if}


</TD>
</tr>
{if $usertype eq "C"}
{/if}
<INPUT type="hidden" name="mode" value="logout">
<INPUT type="hidden" name="redirect" value="{$redirect}">
</FORM>
</TABLE>
{/capture}

{include file="menu_mod.tpl" menu_title=$lng.lbl_authentication menu_content=$smarty.capture.menu}


which is the code you gave me and my button code inserted......that might work :?

Dan

rcg 06-20-2006 02:58 PM

other than authbox_mod are there any other files which need modification?

Thanks for thi shelp it's been driving me insane!

DanUK 06-20-2006 11:13 PM

No, all I did was make a copy of the authbox and then adjust the opening form tag (to read loginform2) and the button code.

Dan


All times are GMT -8. The time now is 04:33 AM.

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