ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - display user account name on CustPref.asp
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

display user account name on CustPref.asp

 Post Reply Post Reply
Author
Message
Nothing View Drop Down
Newbie
Newbie
Avatar

Joined: 02-November-2005
Location: Canada
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nothing Quote  Post ReplyReply Direct Link To This Post Topic: display user account name on CustPref.asp
    Posted: 02-November-2005 at 4:18am

hello all.

i'm trying to display the user's account name when they enter the CustPref.asp page.

I'm trying to say "welcome back <%=session("customerName")%>", but this only works if they visit the "edit Personal Information" page to set the session customerName.

any ideas?
thanks!

n0thing

Back to Top
Nothing View Drop Down
Newbie
Newbie
Avatar

Joined: 02-November-2005
Location: Canada
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nothing Quote  Post ReplyReply Direct Link To This Post Posted: 02-November-2005 at 7:20am

got it.
not the cleanest code, but it works for now.

<%
dim conntemp, mysql, rs, ttk
ttk=session("idCustomer")
call openDb()
mysql="SELECT name FROM customers WHERE idCustomer=" &ttk
set rs=conntemp.execute(mySQL)
session("customerName")=rs("Name")
call closeDb()
%>

i added the above code to the CustPref.asp page and used "<%=session("customerName")%>" to display the account name where needed.

later!
n0thing

Back to Top
blackdesk View Drop Down
Newbie
Newbie


Joined: 23-November-2005
Location: United States
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote blackdesk Quote  Post ReplyReply Direct Link To This Post Posted: 10-April-2006 at 4:02pm
hi nothing -

can you tell me where you pasted the code?

thanks!
b
Back to Top
netprofits View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers


Joined: 05-January-2006
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote netprofits Quote  Post ReplyReply Direct Link To This Post Posted: 18-May-2006 at 6:59am

Custvb.asp is called from custva.asp which is where a customer logs in. In Custvb.asp, around line 114, the customer login has been validated and the customer name is loaded in the record set. You could just add a line like:

Session("CustomerName") = rsCustObj("name") & " " & rsCustObj("lastName")

Then you can use Session("CustomerName") to display the customer's name in other pages. To be safe, you could test that Session("CustomerName") is not null before displaying a message with the name.

NetProfits Internet Consulting

Certified ProductCart Developer

Our Site
Back to Top
Aeon View Drop Down
Newbie
Newbie
Avatar

Joined: 18-June-2006
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aeon Quote  Post ReplyReply Direct Link To This Post Posted: 03-July-2006 at 4:44am
How do I display the customer name on header.asp?
how do I reference to it?
Back to Top
netprofits View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers


Joined: 05-January-2006
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote netprofits Quote  Post ReplyReply Direct Link To This Post Posted: 03-July-2006 at 8:40am

First the customer has to login so you can set the session variables as described in the posts above. Once the session variables are set, you can display them anywhere. You would need to check if the values are set before trying to display them. In the header.asp file, use code like:


If Len(Session("CustomerName")) > 0 Then Response.Write(Session("CustomerName"))

NetProfits Internet Consulting

Certified ProductCart Developer

Our Site
Back to Top
Aeon View Drop Down
Newbie
Newbie
Avatar

Joined: 18-June-2006
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aeon Quote  Post ReplyReply Direct Link To This Post Posted: 09-July-2006 at 11:50pm
I still can't figure it out. How do I make it appear on header.asp?
This is my current code

<div id="myAccount">Hi
                <% 
                ' Display Name of customer if logged in
              if session("idCustomer")="0" or session("idCustomer")="" then%>
                Guest,&nbsp;&nbsp;
                <% else %>
                <strong><%=session("customerName")%></strong& gt;,&nbsp;&nbsp;<a href="custPref.asp">Your Account</a>
                <% end if %>
                <%
                ' If the customer is not an affiliate and is not logged in
                ' show a link to the registration page.
                if session("idCustomer")="0" or session("idCustomer")="" then%>
                    <a href="custPref.asp">Login</a>&nbsp;&nbsp;&l t;span style="color: #FF0000">/</span>&nbsp;&nbsp;<a href="custPref.asp">Register</a></div>
                <% else
                ' If the Wish List feature is active, show a link to it
                    if (scWL="-1") or ((scBTO=1) and (iBTOQuote=1)) then%>
                        <a href="custPref.asp">My Account</a>&nbsp;&nbsp;<span style="color: #FF0000">/</span>&nbsp;&nbsp;<a href="Custquotesview.asp">Wishlist</a>&nbsp;&am p;nbsp;<span style="color: #FF0000">/</span>&nbsp;&nbsp;<a href="CustLO.asp">Log Out</a></div>
                    <% end if %>
                <% end if %>
        <!-- End My Account -->
    </div>
Back to Top
netprofits View Drop Down
Certified ProductCart Developers
Certified ProductCart Developers


Joined: 05-January-2006
Location: United States
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote netprofits Quote  Post ReplyReply Direct Link To This Post Posted: 10-July-2006 at 7:57am
You header.asp code looks correct. Are you setting session("customerName") in the routine where a customer logs in as described in the post above from May 18th? Are you getting an error or is it just not displaying the name?
NetProfits Internet Consulting

Certified ProductCart Developer

Our Site
Back to Top
Rob-CFLHD View Drop Down
Newbie
Newbie


Joined: 20-April-2007
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rob-CFLHD Quote  Post ReplyReply Direct Link To This Post Posted: 20-April-2007 at 9:53am

I got this to work, but only after the user visits their information page.  it will just say Hi and not show a name until they visit their information page.  It seems that it is querying the pages, not the database for the user name.  How could this be fixed?  

 

<div id="myAccount">
  <font face="Arial, Helvetica, sans-serif" size="-1" color="#024d90">
  <b>Hello</b>
                 <% 
                 ' Display Name of customer if logged in
               if session("idCustomer")="0" or session("idCustomer")="" then%>
        <b>Guest</b>&nbsp;&nbsp;<br></f ont>
                 <% else %>
                 <b><%
    if (Session("CustomerName"))>"0" Then Response.Write(Session("CustomerName"))%></b>&n bsp;&nbsp;<br>
                 <% end if %>
                 <%
                 ' If the customer is not an affiliate and is not logged in
                 ' show a link to the registration page.
                 if session("idCustomer")="0" or session("idCustomer")="" then%>
                     <a href="custPref.asp"><font face="Arial, Helvetica, sans-serif" size="-1" color="#024d90">Login</font></a>&nbsp;&am p;nbsp;|&nbsp;&nbsp;<a href="custPref.asp"><font face="Arial, Helvetica, sans-serif" size="-1" color="#024d90">Register</font></a>&nbsp; &nbsp;</div>
                 <% else
                 ' If the Wish List feature is active, show a link to it
                     if (scWL="-1") or ((scBTO=1) and (iBTOQuote=1)) then%>
                          <a href="custPref.asp"><font face="Arial, Helvetica, sans-serif" size="-1" color="#024d90">My Account</font></a>&nbsp;&nbsp;|&nbsp ;&nbsp;<a href="Custwlview.asp"><font face="Arial, Helvetica, sans-serif" size="-1" color="#024d90">Wishlist</font></a>&nbsp; &nbsp;|&nbsp;&nbsp;<a href="CustLO.asp"><font face="Arial, Helvetica, sans-serif" size="-1" color="#024d90">Log Out</font></a>&nbsp;&nbsp;</div>
                     <% end if %>
                 <% end if %>
        <!-- End My Account -->
    </div>

Back to Top
BlackReefDesigns View Drop Down
Newbie
Newbie


Joined: 28-May-2008
Location: San Diego, CA
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote BlackReefDesigns Quote  Post ReplyReply Direct Link To This Post Posted: 09-April-2010 at 5:48am
I wonder how difficult this would be to setup first name only?

ex: instead of 'Welcome Back Jeff Schwartz | Logout'

It simply says 'Welcome Jeff | Logout

Here is the current code I am using:

Quote <% if session("idCustomer")="0" or session("idCustomer")="" then %>
            <a href="CustPref.asp">Create  Account</a>
            <% else %>
            <%response.write(dictLanguage.Item(Session("language")&"_CustPref_10") & session("pcStrCustName") & "!")%>
            <% end if %>
            <% if session("idCustomer")="0" or session("idCustomer")="" then %>
            | <a href="custpref.asp" >Log In</a>
            <% else %>
            | <a href="default.asp?action=clear">Log Off</a>
            <% end if %>

Joe S.
BlackReef.net
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.070 seconds.