View Single Post
  #2  
Old 11-14-2004, 06:29 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default Login on separate "My Account" page

Elab,

Here's what I have done:

1. Create a new template in the skin1/Help direcetory and call it Login.tpl. Put the following code in it, note the (3) template files that it referrences - they are customizations of the respective files, minus the "_mod" would equal the original template. Also, there are some languages that I used: see {$lng.txt_login_header_1} etc. for the Login.tpl:

Code:
{* $Id: Login.tpl,v 1.0 2004/11/14 16:03:50 mclap Exp $ *} {$lng.txt_login_header_1} {capture name=dialog} {if $login eq "" } <TABLE width="100%" cellpadding="0" cellspacing="0" border="0"> <TR><TD>{$lng.txt_login_header_2}</TD></TR> <TR> <TD>{ include file="auth_mod.tpl" }</TD> </TR> </TABLE> {else} <TABLE width="100%" cellpadding="0" cellspacing="0" border="0"> <TR> <TD width="50%">{ include file="menu_profile_mod.tpl" }</TD> <TD width="50%">{ include file="authbox_mod.tpl" }</TD> </TR></TABLE> {/if} {/capture} {include file="dialog.tpl" title=$lng.lbl_login_account content=$smarty.capture.dialog extra="width=100%"}
In order to referrence this page, you'll need to create referrences to it in the Help/index.tpl. Add something like the following and change whatever is currently the "if" section to be an "elseif":

Code:
{if $section eq "Login"} {include file="help/Login.tpl"} {elseif $section eq "Login_message"} {include file="help/Login_message.tpl"} {elseif $section eq "Login_error"} {include file="help/Login.tpl"}

By doing the last step, you will be able to call the Login page as: http://yourdomain.com/xcart/help.php?section=Login

Now what about the three templates referrenced as: auth_mod.tpl, menu_profile_mod.tpl and authbox_mod.tpl? They should all be located in the root skin1 directory, like their original files that I have modified.

First create additional templates with three names (like my "_mod" extension for the modified template) or some variation of the original templates, but be sure to change the name respectively in the created Login.tpl.

Now, what do you put in the three _mod files? Well, for starters, you'll need to modify the code to take it out of a menu template with the boxes and borders. I have made some additional changes to get the new templates to fit the new format and I'll put the files below. Keep in mind, you may need to adjust some of the html to get your desired table widths and check the "languages" referrenced. I created new language varaibles, like lng.txt_login_header_1 and others, so be sure to either use the original template variable or create a variable to your liking.

My three modified files are below, use them, tweak them as you wish. They are only a good starting point as I created them to fit within my site framework. I know that they will at least get you started.

For file auth_mod.tpl, insert the code:
Code:
{* $Id: auth_mod.tpl,v 1.39 2004/06/28 11:38:38 mclap Exp $ *} {capture name=menu} <TABLE border="0" cellpadding="0" cellspacing="1" 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"> <INPUT type="hidden" name="{$XCARTSESSNAME}" value="{$XCARTSESSID}"> {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> <TABLE width="100%" border="0" align="right"> <TR><TD align="right">{$lng.lbl_username}</TD><TD align="left"><INPUT type="text" name="username" size="16" value="{#default_login#}"></TD></TR> <TR><TD align="right">{$lng.lbl_password}</TD><TD align="left"><INPUT type="password" name="password" size="16" value="{#default_password#}"> <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="50"></TD> <TD height="50" align="left"> {if $js_enabled} {include file="buttons/login_menu.tpl"}[img]{$ImagesDir}/resources/dot_clear.gif[/img]{else} {include file="buttons/login_menu.tpl"} {/if} {/if} {* use_secure_login_page *} {if $usertype eq "C" or ($usertype eq "B" and $config.XAffiliate.partner_register eq "Y")} {include file="buttons/create_profile_menu.tpl"} {/if} </TD> </TR> {if $login eq ""} <TR> <TD></TD> <TD height="24" nowrap align="left"> {$lng.lbl_recover_password} </TD> </TR> {/if} </TD></TR></TABLE> {if $usertype eq "P" and $active_modules.Simple_Mode eq "Y" or $usertype eq "A"} <TR> <TD colspan="2"> <DIV align="left">{$lng.lbl_insecure_login} </DIV> </TD> </TR> {/if} {if $usertype eq "C"} <TR> <TD align="right" colspan="2"> {if $js_enabled} {$lng.txt_javascript_disabled} {else} {$lng.txt_javascript_enabled} {/if} </TD> </TR> {/if} </FORM> </TABLE> {/capture} { include file="menu_mod.tpl" menu_title=$lng.lbl_authentication menu_content=$smarty.capture.menu }

In the menu_profile_mod.tpl file, you'll need to remove the menu look that was originally used in the column-menu design. Also, you will see three language texts added: {$lng.txt_menu_profile_option1}, {$lng.txt_menu_profile_option2} and {$lng.txt_menu_profile_option3}. These show up in "My Account" after the user has logged in. I created the language text to say the following: {$lng.txt_menu_profile_option1} = "Change your password, billing or shipping addresses." {$lng.txt_menu_profile_option2} = "Need to remove or delete your current profile?" and {$lng.txt_menu_profile_option3} = "View, print or modify your (Company Name) orders." So change accordingly.

Here's my menu_profile_mod.tpl file:
Code:
{* $Id: menu_profile_mod.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *} {capture name=menu} <TABLE width="85%" align="center" border="0"> <TR><TD> {include file="buttons/button_vunc.tpl" button_title=$lng.lbl_modify_details href="register.php?mode=update"} {$lng.txt_menu_profile_option1} {include file="buttons/button_vunc.tpl" button_title=$lng.lbl_delete_profile href="register.php?mode=delete"} {$lng.txt_menu_profile_option2} {if ($usertype eq 'A' || ($usertype eq 'P' && $active_modules.Simple_Mode)) && $is_merchant_password eq 'Y'} {$lng.lbl_change_mpassword} {/if} {if $usertype eq "C"} {include file="buttons/button_vunc.tpl" button_title=$lng.lbl_orders_history href="orders.php"} {$lng.txt_menu_profile_option3} {if $user_subscription ne ""} {include file="modules/Subscriptions/subscriptions_menu.tpl"}</A> {/if} {/if} </TD></TR></TABLE> {/capture} { include file="menu_mod.tpl" menu_title=$lng.lbl_your_profile menu_content=$smarty.capture.menu }
Last, but not least - in the created authbox_mod.tpl file:
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></TD> <TD valign="top"> <h1>{$login}{$lng.txt_logged_in}</h1> {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 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_title=$lng.lbl_authentication menu_content=$smarty.capture.menu}
That should do it! If you follow all of these directions, you will be working with modified template files and your original ones will be unharmed (If not, be sure to backup prior to doing any modification). You can now add a speed bar link or other to "My Account" with the URL: help.php?section=Login

Let me know if you have any problems. This works well for me and I have referrenced in the functionality for the user to return to "My Account" at any time to Modify/Delete their profile, search for orders and of course Login/Logout. If anyone has any improvements of this work, I would love to see them here! Nothing is ever finished.

This is just one step that I have done to get the clunky X-Cart style menus reduced to their core: Products, products and products - that's all that should be in the category/side menus. Additional functionality should be achieved by using headers, footers and a good site map. The best way to prevent users from getting lost in your web city is just to take them their to begin with ...

- Mike
__________________
4.1.9
Reply With Quote