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)
-   -   Login Link (https://forum.x-cart.com/showthread.php?t=2355)

TanyaG 04-23-2008 04:05 AM

Re: Login Link
 
Thanks a lot. Great idea!

boomobile 07-03-2008 11:27 AM

Re: Login Link
 
Quote:

Originally Posted by B00MER
edit [skin1]/common_templates.tpl and add something similar:

Code:

{elseif $main eq "mainlogin"}
{include file="customer/main/login.tpl"}

Note, place your login form from, auth.tpl in customer/main/login.tpl

Now just create the login.php file, with something like:

Code:

<?

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";

$smarty->assign("main","mainlogin");
$smarty->display("customer/home.tpl");

?>


Should do the trick ;)



I want to combine three templates into one page. I can't figure out how they are called. I don't need to edit the templates themselves, just have them all on the same page.
Here's specifics:

I have 3 separate pages as follows
login = secure_login_form.tpl
registration = register.tpl
recover lost password = change_password.tpl

these all come up on separate pages, I want them all on one.

My home_main.tpl includes this:

{elseif $main eq "register"}
{include file="customer/main/register.tpl"}

{elseif $main eq "secure_login_form"}
{include file="customer/main/secure_login_form.tpl"}

{elseif $main eq "change_password"}
{include file="customer/main/change_password.tpl"}

I'm not sure what file I need to modify.

neaisha 07-10-2008 11:16 AM

Re: Login Link
 
i couldnt get this to work. so what i did was duplicate this page - xcart/error_message.php?need_login. i'm not sure what unnecessary code can/should be removed from the duplicated file beyond what i've already removed so that it continues to work but...

create a file called myaccount.php and insert the following code

Code:

<?php

require "./auth.php";
require $xcart_dir."/include/categories.php";

#
# Assign login information
#
x_session_register("login_antibot_on");
x_session_register("antibot_err");
x_session_register("username");
$smarty->assign("main","myaccount");
$smarty->assign("username", $username);
$smarty->assign("login_antibot_on", $login_antibot_on);
if ($antibot_err) {
    $smarty->assign("antibot_err", $antibot_err);
    $antibot_err = false;
}


# Assign the current location line
$smarty->assign("location", $location);

func_display("customer/home.tpl",$smarty);
?>



then upload it to /xcart directory.



then in skin1/common_templates.tpl add the following...

Code:

{elseif $main eq "myaccount" or $main eq "antibot_error" or $main eq "disabled"}
{assign var="is_remember" value="Y"}
{include file="main/error_login_incorrect.tpl"}


then add the link to your page http://www.mysite/xcart/myaccount.php where you want it to appear.

neaisha 07-10-2008 01:04 PM

Re: Login Link
 
if it helps anyone, here's how i displayed the login link if logged out and vice versa...

Code:


{if $login ne ""}

<form action="/store/include/login.php" method="post" name="loginform"><img src="{$ImagesDir}/spacer.gif" width="10" height="1" alt="" /><a href="javascript: document.loginform.submit();">log out</a>
<input name="mode" value="logout" type="hidden">
<input name="redirect" value="customer" type="hidden">
</form>


{else}

<a href="mysite/xcart/myaccount.php">login</a>

{/if}


JWait 07-19-2008 08:43 AM

Re: Login Link
 
Quote:

Originally Posted by boomobile
I have 3 separate pages as follows
login = secure_login_form.tpl
registration = register.tpl
recover lost password = change_password.tpl

these all come up on separate pages, I want them all on one.

My home_main.tpl includes this:

{elseif $main eq "register"}
{include file="customer/main/register.tpl"}

{elseif $main eq "secure_login_form"}
{include file="customer/main/secure_login_form.tpl"}

{elseif $main eq "change_password"}
{include file="customer/main/change_password.tpl"}

I'm not sure what file I need to modify.


I don't really understand why you would want them all on the same page, particularly since they do different things.

"Register" does just that, registers new customers.
"Secure Login" will login current customers using https.
"Change Password" will allow current customers to change their password, and is part of "modify profile".

"recover lost password = change_password.tpl" as you state is incorrect. "Recover Password" allows a current customer to retrieve their login information via email and has nothing to do with changing their password (unless of course you require them to change it at their next logon).

Anyway, to get more than one template on a page, just call it...

{elseif $main eq "whatever_you_want_to_name_your_page"}
{include file="customer/main/register.tpl"}
{include file="customer/main/secure_login_form.tpl"}
{include file="customer/main/change_password.tpl"}

You need to include the "requires" on "whatever_you_want_to_name_your_page.tpl"

drubarth 12-17-2008 04:55 PM

Re: Login Link
 
I'm running X-cart 4.1.11 and to get a login page, I just link to secure_login.php. Ideally you should use https, but either way. I'm not sure how long this program has been part of X-cart.

ChristineP 01-30-2009 05:24 AM

Re: Login Link
 
I've copied updated Laureon's mod with your code above. Now, I need to remove the previous {if $login ne ""} info and include what you have posted. Can you direct me where this should go in the myaccount.tpl?

I will also be adding a 'password protect' register login for this new login page. Any suggestions are welcome.

Christine


Quote:

Originally Posted by neaisha
if it helps anyone, here's how i displayed the login link if logged out and vice versa...

Code:


{if $login ne ""}

<form action="/store/include/login.php" method="post" name="loginform"><img src="{$ImagesDir}/spacer.gif" width="10" height="1" alt="" /><a href="javascript: document.loginform.submit();">log out</a>
<input name="mode" value="logout" type="hidden">
<input name="redirect" value="customer" type="hidden">
</form>


{else}

<a href="mysite/xcart/myaccount.php">login</a>

{/if}



ChristineP 01-30-2009 12:14 PM

Re: Login Link
 
Boomer,

I've tried both your code and Laureon's, but I'm not having any luck. When I used your suggestion to copy the code from my site login_form.tpl <form> </form>, I could see the code and no way to submit. When I used your code and corrected any portion that points to your /lab/, then the login page shows, but still no submit button. Any suggestions?

Christine


Quote:

Originally Posted by B00MER
Here is mine from cart-lab [3.5.5]

Code:

If you already have an account, you can authenticate yourself by filling in the form below. The fields marked with <font class="TableCenterCustomerFormOrange">*</font> are mandatory.


 
<table border=0>
<form action="/lab/include/login.php" method=post name=errorform>
<tr>
<td height="10" width="78" class=FormButton>Login</td>
<td width="10" height="10"><font class=Star>*</font></td>
<td width="282" height="10">
<input type="text" name="username" size="30">
</td>
</tr>
<tr>
<td height="10" width="78" class=FormButton>Password</td>
<td width="10" height="10"><font class=Star>*</font></td>
<td width="282" height="10">
<input type="password" name="password" size="30">
<input type="hidden" name="usertype" value="C">
<input type="hidden" name="redirect" value="customer">
<input type=hidden name=mode value=login>
</td>
</tr>
<tr>
<td height="10" width="78" class=FormButton></td>
<td width="10" height="10"></td>
<td width="282" height="10" class=ErrorMessage>
</td>
</tr>
<tr>
<td height="10" width="78" class=FormButton></td>
<td width="10" height="10" class=FormButton></td>
<td width="282" height="10">
[img]/lab/skin1/images/buttons/submit.gif[/img]
</td>
</tr>
</form>
</table>


 
If you do not have an account, you can easily
<font class=TableCenterCustomerform>register here</font>




secure_login.php in 4.0.x is in the root /


robertswww 02-03-2009 12:56 PM

Re: Login Link
 
Hi Christine,

In the sample code you posted it is showing a link to: skin1/images/buttons/submit.gif

I believe you will find no such file in your 4.1.x version of X-Cart.

There is now a skin1/buttons/ folder and inside you will find submit.tpl (TPL not GIF).

In place of the submit button, you may be able to use:

{include file="buttons/login_menu.tpl"}



Also, compare the source code on one of your existing web site login pages.

The customer login page uses this template: customer/main/secure_login_form.tpl

And here is part of the Submit Button code from that template:

{if $js_enabled}
{include file="buttons/submit.tpl" href="javascript:document.secureform.submit()" js_to_href="Y"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_submit}
{/if}
</td>
</tr>
</form>

The above code shows how they are including the file: buttons/submit.tpl if Javascript is enabled, else include submit_wo_js.tpl


Both submit.tpl and login_menu.tpl then include file="buttons/button.tpl" to create the Submit button image.

One of those methods should work for you. Just work on a copy of the file and a test site (if you have one available).

Robert

ChristineP 02-03-2009 04:27 PM

Re: Login Link
 
Thanks for your reply. I've made some progress with the login page, but I am having trouble with the submit-login button. I tried your code and your suggestion using {include file="buttons/login_menu.tpl"} with my original code from auth.tpl. Tonight the link is working in IE7, but earlier today it didn't work in Safari or Firefox. Do you have any suggestions for me to password protect register.php?

Christine



Quote:

Originally Posted by robertswww
Hi Christine,

In the sample code you posted it is showing a link to: skin1/images/buttons/submit.gif

I believe you will find no such file in your 4.1.x version of X-Cart.

There is now a skin1/buttons/ folder and inside you will find submit.tpl (TPL not GIF).

In place of the submit button, you may be able to use:

{include file="buttons/login_menu.tpl"}



Also, compare the source code on one of your existing web site login pages.

The customer login page uses this template: customer/main/secure_login_form.tpl

And here is part of the Submit Button code from that template:

{if $js_enabled}
{include file="buttons/submit.tpl" href="javascript:document.secureform.submit()" js_to_href="Y"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_submit}
{/if}
</td>
</tr>
</form>

The above code shows how they are including the file: buttons/submit.tpl if Javascript is enabled, else include submit_wo_js.tpl


Both submit.tpl and login_menu.tpl then include file="buttons/button.tpl" to create the Submit button image.

One of those methods should work for you. Just work on a copy of the file and a test site (if you have one available).

Robert



All times are GMT -8. The time now is 12:59 PM.

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