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)

jgkiefer 04-18-2003 06:20 AM

Login Link
 
How would I create a link to the login page instead of using the auth box form?

ETInteractive.com 04-24-2003 07:07 AM

I have the same issue.

I tried creating a login.php, which calls Auth.tpl and it works, its just the page doesnt include the rest of the site...

it loses the header, footer, etc

what do i need to do to get this working?

B00MER 04-24-2003 07:10 AM

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 ;)

ETInteractive.com 04-24-2003 04:45 PM

AWESOME

Thnx Boomer :twisted:

Tye 04-30-2003 12:01 AM

Sorry Boomer you totally lost me in the middle somewhere!
 
I have done the following:

Added

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

to the [skin1]/common_templates.tpl file


I have cut the login form from auth.tpl and pasted it onto the customer/main/login.tpl

I have the php file you kindly supplied, but where do I put this and how do I call it?

Tye

groovico 05-04-2003 05:49 PM

Re: Sorry Boomer you totally lost me in the middle somewhere
 
Quote:

Originally Posted by Tye

I have the php file you kindly supplied, but where do I put this and how do I call it?

Tye



Php file goes in your /customer/ folder the one with the .php files in it (not the customer in skin folder) you just call it by going direct to mainlogin.php

eg http://www.youdomain.com/xcart/customer/mainlogin.php

Tye 05-05-2003 11:31 PM

Ahh! Got it!
 
Thanks

hzellers 06-06-2003 06:05 AM

Hi there! I added the code and it works fine, but all of my categories disappear when the login.php page loads. Any ideas where they went? They appear on all other pages, just not login.php.

Thanks!

Heather

blagarde 06-24-2003 07:34 AM

I see that you posted this question about 2 weeks back or so. If you didn't find the answer for this, it is suprisingly easy.

Your login.php file should read like this:
Code:

<?

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

$smarty->assign("main","mainlogin");
                       
require "../include/categories.php";

$smarty->display("customer/home.tpl");

?>


It was the ../include/categories.php that was missing. Also, now that we're at this point, don't forget to remove the if/else code in skin1/customer/home.tpl that calls "auth.tpl".

It might also be noted that by doing all of this, I had to change the paths in the original auth.tpl form to reflect a slightly different directory location, and then pasted into my new login.tpl page. at first the form action used "../../../include/login.php" and I had to change it to "../include/login.php"

hzellers 06-24-2003 08:38 AM

Thank you! The client didn't seem to care so I kept it on the hush-hush. :) But, I'll fix it with this lil' snippet. Thanks again!

Heather

elabdesigns 07-28-2003 05:43 AM

Can we take it a bit further..?
 
Does the link change if the customer logs in? For ex. if you put the link that says Sign In, does is say Sign Out once they have signed in?

If not, can we make it so that it does? The one good thing about the auth box is that it lets the customer know that they have successfully signed in by saying logoff. I know the customer can see on the login page that they have signed in but once you go to another page the customer may see the Sign in link and think that they are not signed in.

Also, does any one know of a "my account" mod where the wish list, profiles and the orders history links from the shopping cart have been moved onto a "my account" page?

Thanks,

elab

sarahnk 01-29-2004 07:56 AM

can anyone please tell me how I can make this work for version 3.5.3 ?

i get a 'parse error' on 'line 3'

anyone, please?

sarahnk 01-29-2004 08:38 AM

i figured it out myself...

login.php
Code:

<?

require "./auth.php";

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

?>


oziris 02-25-2004 03:19 PM

I tried this but placing changes in common_templates.tpl file disables webmaster mode functionality. ANy ideas?

I tried different approach and created login.php with this in it:

<?php
require "./auth.php";

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

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

?>

I copied login_incorrect code and created tpl file called login.tpl.

Now I get what I want: http://216.93.188.234/shopping/customer/login.php

But how do I get that to display within the regular page with header, footer etc...?

Thanks,
Predrag

SMDStudios 03-24-2004 01:42 PM

Getting the following error with this mod...

Warning: Smarty error: unable to read template resource: "shop/home.tpl" in /home/httpd/vhosts/shopgspot.com/httpdocs/Smarty-2.5.0/Smarty.class.php on line 1042


Can anyone help me out???

version: 3.5.4

domspe 03-29-2004 12:51 PM

I just get a blank page of nothingness!

Here is what my code looks like for my custom login.php
Code:

<?php

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

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

?>


help! 8O

laureon 03-29-2004 01:11 PM

Are you on v3.5.5 by any chance?

Try this:

<?

require "./auth.php";
require $xcart_dir."/include/categories.php";
$smarty->assign("main", "mainlogin");
$smarty->display("customer/home.tpl");

?>

You will need to have something like this in your 'common_templates' file:

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

hope this helps

domspe 03-29-2004 01:56 PM

Hiya!
i am somewhere between 3.5.4 & 3.5.5 - xcart is doing funky mods.

i did exactly as you said: results are here:
http://shop.mpartworks.com/login2.php
Code:

<?

require "./auth.php";
require $xcart_dir."/include/categories.php";
$smarty->assign("main", "mainlogin");
$smarty->display("customer/home.tpl");

?>

and here is my blank page of nothingness:
http://shop.mpartworks.com/login.php
Code:

<?php

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

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

?>


*grumble*
:)

laureon 03-29-2004 02:04 PM

I will post full code and instructions shortly.

laureon 03-29-2004 02:40 PM

Hi,

Creating a seperate 'Login' page:

Step 1 - Create a file named 'myaccount.php' in the folder '[xcart]/customer' in the root x-cart directory. i.e. NOT [skin1]/customer.

In the file 'myaccount.php' paste the following code, ensuring you leave no 'white spaces' at the bottom of the file.

Code:

<?
require "./auth.php";
require $xcart_dir."/include/categories.php";
$smarty->assign("main", "myaccount");
$smarty->assign("location",$location);
$smarty->display("customer/home.tpl");
?>


Step 2 - Creating a page to inform Smarty of which template to use:

In [skin1]/common_templates.tpl add the following after the
first if statement:

Code:

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


Step 3 - Creating the 'login' page

Create a new template 'myaccount.tpl' in [skin1]/customer/main. Then simply copy the login code from: '[skin1]/auth.tpl, inbetween the '{capture} and {/capture} tags as we don't want smarty to base the login page on the 'menu.tpl' template place it between the tags '
Code:

{include file="location.tpl"}
{capture name=dialog}

and
Code:

{include file="dialog.tpl" title="My Account" content=$smarty.capture.dialog extra="width=100%"}
which should give you something that looks like:

Code:

{assign var="last_location" value="My Account"}
{ include file="location.tpl" last_location=$last_location }
{capture name=dialog}
<TABLE border=0 cellPadding=0 cellSpacing=0 width=100%>
{if $config.General.use_https_login eq "Y"}

{assign var="form_url" value=$https_location}
{else}
{assign var="form_url" value=$current_location}
{/if}
<FORM action="{$form_url}/include/login.php" method=post name=authform>
{if $config.General.use_secure_login_page eq "Y"} {* use_secure_login_page *}
<tr>
<td>
{if $usertype eq "C"}
{assign var="slogin_url" value=$catalogs_secure.customer}
{elseif $usertype eq "P" and $active_modules.Simple_Mode eq "Y" or $usertype eq "A"}
{assign var="slogin_url" value=$catalogs_secure.admin}
{elseif $usertype eq "P"}
{assign var="slogin_url" value=$catalogs_secure.provider}
{elseif $usertype eq "B"}
{assign var="slogin_url" value=$catalogs_secure.partner}
{/if}
{include file="buttons/secure_login.tpl"}
</td>
</tr>
{else} {* use_secure_login_page *}
<tr>
<td class=VertMenuItems>
<font class=VertMenuItems>{$lng.lbl_username}</font>

<input type=text name=username size=16>

<font class=VertMenuItems>{$lng.lbl_password}</font>

<input type=password name=password size=16>

<input type=hidden name=mode value=login>
{if $active_modules.Simple_Mode ne "" and $usertype ne "C" and $usertype ne "B"}
<input type=hidden name=usertype value="P">
{else}
<input type=hidden name=usertype value="{$usertype}">
{/if}
<input type=hidden name=redirect value="{$redirect}">
</td></tr>
<tr>
<td height=24 class=VertMenuItems>
{if $js_enabled}
{include file="buttons/login_menu.tpl"}
{else}
{include file="buttons/login_menu.tpl"}
{/if}
</td>
</tr>
{/if} {* use_secure_login_page *}
{if $usertype eq "C" or ($usertype eq "B" and $config.Modules.partner_register eq "Y")}
<tr>
<td height=24 nowrap class=VertMenuItems>
{include file="buttons/create_profile_menu.tpl"}
</td>
</tr>
{/if}
{if $usertype eq "P" and $active_modules.Simple_Mode eq "Y" or $usertype eq "A"}

<tr>
<td class=VertMenuItems>


<div align=left>{$lng.lbl_insecure_login}
</div>
</td>
</tr>

{/if}
{if $usertype eq "C"}
<tr>
<td class=VertMenuItems>


<div align=right>
{if $js_enabled}
{$lng.txt_javascript_disabled}
{else}
{$lng.txt_javascript_enabled}
{/if}
</div>
</td>
</tr>
{/if}
</form>
</table>
{/capture}
{include file="dialog.tpl" title="My Account" content=$smarty.capture.dialog extra="width=100%"}


You will need to create a link to call 'myaccount.php' and that is pretty much it.

This has been tested on v3.5.5.

You can of course change modify the template to your liking and should form the basis of a 'seperate' login page.

Any comments appreciated!

B00MER 03-29-2004 02:54 PM

A much easier approach is to copy paste the <FORM>...</FORM> of the login source on your site and make small minor adjustments to images, and the action location of the form if need be, and paste it into a static page and just call it via pages.php?pageid=1 or such. :)

But this looks groovy :D

laureon 03-29-2004 04:21 PM

BOOMER, if you try my code, the navigation trail only shows the 'site name' and not 'sitename > My Account'. Am I missing something somewhere?

Cheers BOOMER

B00MER 03-30-2004 07:02 AM

Code:

{assign var="last_location" value="My Account"}
{ include file="location.tpl" last_location=$last_location }


:wink:

laureon 03-30-2004 07:15 AM

Thanks BOOMER - your code worked a treat!

domspe 03-30-2004 08:46 AM

I got this code here from x-cart - hopefully it can help someone else!
(amazing, they did something fast & free!!)

Code:

code for login.php

<?php
require_once "./auth.php";
$smarty->display("custom_login.tpl");
?>

Template (skin1/custom_login.tpl)

{* Smarty *}
{assign var="form_url" value=$current_location}
<TABLE border=0 cellPadding=0 cellSpacing=0 width=100%>
<FORM action="{$form_url}/include/login.php" method=post name=authform>
<tr>
<td class=VertMenuItems>
<font class=VertMenuItems>{$lng.lbl_username}</font>

<input type=text name=username size=16>

<font class=VertMenuItems>{$lng.lbl_password}</font>

<input type=password name=password size=16>

<input type=hidden name=mode value=login>
<input type=hidden name=usertype value="C">
<input type=hidden name=redirect value="{$redirect}">
</td></tr>
<tr>
<td height=24 class=VertMenuItems>
{if $js_enabled}
{include file="buttons/login_menu.tpl"}
{else}
{include file="buttons/login_menu.tpl"}
{/if}
</td>
</tr>
</form>
</table>


domspe 03-31-2004 10:51 AM

FYI - i'd use the script by laureon

x-cart's version left much to be desired after i implemented laureon's version.

just an FYI for everyone! :)

jburdi 04-07-2004 07:17 AM

this is all good stuff, but is there anyway to have a button that says login if the user isnt logged in and logout if the user is logged in, kinda like the way it works on the real auth box.

this would make the mod perfect.

any information would be greatly appreciated.

laureon 04-07-2004 07:53 AM

If you insert this code: {if $login eq "" } before the table tags as below:

{capture name=dialog}
{if $login eq "" }
<TABLE border=0 cellPadding=0 cellSpacing=0 width=100%>
{if $config.General.use_https_login eq "Y"}

then paste this code after the closing </table> tag and just above '{/capture}
{include file="dialog.tpl" title="My Account" content=$smarty.capture.dialog
extra="width=100%"}'

Code:

{else}
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<form action="{$xcart_web_dir}/include/login.php" method=post name=loginform>
<tr>
<td></td>
<td class=VertMenuItems valign="top">
{$login}
{$lng.txt_logged_in}



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




</td>
</tr>
{if $usertype eq "C"}
<tr>
<td class=VertMenuItems colspan=2>


<div align=right>
{if $js_enabled}
{$lng.txt_javascript_disabled}
{else}
{$lng.txt_javascript_enabled}
{/if}
</div>
</td>
</tr>
{/if}
<input type=hidden name=mode value=logout>
<input type=hidden name=redirect value="{$redirect}">
</form>
</table>
{/if}


Hope this helps.

P.S - Tested and working on 3.5.6

B00MER 04-07-2004 08:57 AM

Just wanted to add those running 3.5.5+ can just use the link customer/secure_login.php if they have a secure HTTPS server, its secure and a seperate login from customer/home.tpl.

Kudos.

domspe 04-10-2004 11:36 AM

Thanks B00mer! 8)
wish i woulda known that earlier :lol:

ronp 05-12-2004 06:34 PM

Separate Login Page help please
 
I would love to have a separate login page as well but I get a Runtime Error when I try to login from the new page. Login from old method which still is using auth.tpl works fine. I know this looks very simple but I can't figure it out. Any help appreciated.

New PHP file customer_login.php in my Customer folder (not skin1/customer):

<?
require "./auth.php";
require $xcart_dir."/include/categories.php";
$smarty->assign("main", "customer_login");
$smarty->assign("location",$location);
$smarty->display("customer/home.tpl");
?>

**************************************************

New .tpl file customer_login.tpl in my skin1/customer/main folder:

{* $Id: customer_login.tpl Exp $ *}

{assign var="last_location" value="My Account"}
{ include file="location.tpl" last_location=$last_location }
{capture name=dialog}

<TABLE border=0 cellPadding=0 cellSpacing=0 width=100%>
<FORM action="{$xcart_web_dir}/include/login.php" method=post name=authform>

<tr>
<td class=VertMenuItems colspan=2>
<font class=VertMenuItems>{$lng.lbl_username}</font>

<input type=text name=username size="14" style="font-family: Verdana; font-size: 9px; border: 1px solid #0099CC; background-color: #FFFFFF; color:#000000">

<font class=VertMenuItems>{$lng.lbl_password}</font>

<input type=password name=password size="14" style="font-family: Verdana; font-size: 9px; border: 1px solid #0099CC; background-color: #FFFFFF; color:#000000">
{if $js_enabled}
{include file="buttons/go.tpl" style="button" type="input"}
{else}
{include file="buttons/go.tpl" style="button" type="input" align="middle"}
{/if}
<input type=hidden name=mode value=login>
{if $active_modules.Simple_Mode ne "" and $usertype ne "C" and $usertype ne "B"}
<input type=hidden name=usertype value="P">
{else}
<input type=hidden name=usertype value="{$usertype}">
{/if}
<input type=hidden name=redirect value="{$redirect}">

</td></tr>

{if $usertype eq "C" or ($usertype eq "B" and $config.Modules.partner_register eq "Y")}
<td height=24 align=left nowrap class=VertMenuItems><font size="0">Register

{$lng.lbl_recover_password}</font></td>
</tr>
{/if}

</td>
</form>
</table>

{/capture}
{include file="dialog.tpl" title="Returning Customer Login" content=$smarty.capture.dialog extra="width=100%"}

************************************************** ****

Change made to common_templates.tpl:
{elseif $main eq "customer_login"}
{include file="customer/main/customer_login.tpl"}

*************************************
The error I get is A Runtime Error Has Occurred...
Line: 0
Error: Object doesn't support this property or method

Running x-cart 3.5.1

pungu 09-02-2004 12:55 PM

Secure_login.php
 
Quote:

Originally Posted by B00MER
Just wanted to add those running 3.5.5+ can just use the link customer/secure_login.php if they have a secure HTTPS server, its secure and a seperate login from customer/home.tpl.

Kudos.


Thanks for this "shortcut"

Problem is I after I log in, the page still displays the "secure login form"

How do I get rid of that.

My site: https://www.hrpolicyanswers.com/xstore/home.php

Click on "Your Account"

elabdesigns 11-01-2004 01:25 PM

Help, I get an error
 
I am using x-cart 4.0.6 GOLD and when I follow the steps that laureon has given I get the following error:

ERROR: Can not initiate application! Please check configuration.

Can anyone explain, or fix the script to run with my version?

Thank you

laureon 11-01-2004 05:42 PM

Hello,

I believe that my walk-through may need to be adjusted to work on v4.x.x. I am currently using v4.x.x so might have a look at this myself at somepoint in the near future.

Cheers,
Leon

elabdesigns 11-02-2004 06:14 AM

You anyone be interested in getting this to work? Or if it could be purchased? I need this asap. Someone on here must be able to get this to work

B00MER 11-02-2004 06:32 AM

Why not use customer/secure_login.php or customer/error_message.php?login_incorrect

Either that or just copy the form into a static page. vwhalla ;)

elabdesigns 11-02-2004 06:39 AM

If use the customer/secure_login.php... how can I make it so that its not secure, or both?

Can you post the code that I would need to place into a page? Can I make a myaccount.php page and past the code from the login form?


*note: I don't have a customer/secure_login.php page?

B00MER 11-02-2004 07:19 AM

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 /

elabdesigns 11-02-2004 08:06 AM

My hair is starting to fall out. Maybe, I'm just being stupid, but I am running out of time here.

This is what I am trying to do.

I copied the code from the home.tpl and made a myaccount.tpl:

Code:

{* $Id: home.tpl,v 1.15 2004/07/13 13:35:42 svowl Exp $ *}
{ config_load file="$skin_config" }
<HTML>
<HEAD>
<TITLE>
{if $config.SEO.page_title_format eq "A"}
{section name=position loop=$location}
{$location[position].0|escape}
{if not %position.last%} :: {/if}
{/section}
{else}
{section name=position loop=$location step=-1}
{$location[position].0|escape}
{if not %position.last%} :: {/if}
{/section}
{/if}
</TITLE>
{ include file="meta.tpl" }
<LINK rel="stylesheet" href="{$SkinDir}/{#CSSFile#}"></HEAD>
<BODY leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
{ include file="rectangle_top.tpl" } { include file="head.tpl" }

<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
                <td></td>
               
    <td width="657"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td background="http://www.pariscape.com/images/border_left_bg.gif">[img]http://www.pariscape.com/images/spacer.gif[/img]</td>
          <td height="10" align="left" valign="top" bgcolor="#FFFFFF">[img]http://www.pariscape.com/images/spacer.gif[/img]</td>
          <td background="http://www.pariscape.com/images/border_right_bg.gif">[img]http://www.pariscape.com/images/spacer.gif[/img]</td>
        </tr>
        <tr>
          <td width="10" background="http://www.pariscape.com/images/border_left_bg.gif">[img]http://www.pariscape.com/images/spacer.gif[/img]</td>
          <td align="left" valign="top" bgcolor="#FFFFFF">
                  <TABLE border="0" width="100%" cellpadding="0" cellspacing="0" align="center">
              <TR>
                <TD width="150" valign="top">{include file="customer/side_menu.tpl"}
                <TD width="20"></TD>
                <TD valign="top">
                 
{include file="location.tpl"} {include file="dialog_message.tpl"}                 
{include file="customer/login_form.tpl"}
                 
                  </TD>
                <TD width="20"></TD>
              </TR>
            </TABLE> </td>
          <td width="10" background="http://www.pariscape.com/images/border_right_bg.gif">[img]http://www.pariscape.com/images/spacer.gif[/img]</td>
        </tr>
      </table></td>
                <td></td>
          </tr>
        </table>
{ include file="bottom_customer.tpl" }
</BODY>
</HTML>


Then I made a myaccount.php file and copied some code from the home.php file

Code:

<?php

require "./auth.php";

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


I made a login_form.tpl to include the login form.

I when I do this I can't get the location to display or the categories, why?

Its this to intense? Can I just make a myaccount.php page, copy the code
from the home.tpl and change some stuff?

[/code]

pengrus 05-13-2005 10:08 PM

Has someone made Leon's mod work with 4.013?

I got openning failed errors...


All times are GMT -8. The time now is 08:18 PM.

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