Print Page | Close Window

display user account name on CustPref.asp

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=17
Printed Date: 29-September-2024 at 12:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: display user account name on CustPref.asp
Posted By: Nothing
Subject: display user account name on CustPref.asp
Date 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




Replies:
Posted By: Nothing
Date 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



Posted By: blackdesk
Date Posted: 10-April-2006 at 4:02pm
hi nothing -

can you tell me where you pasted the code?

thanks!
b


Posted By: netprofits
Date 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

http://www.nicwebdesign.com" rel="nofollow - Our Site


Posted By: Aeon
Date Posted: 03-July-2006 at 4:44am
How do I display the customer name on header.asp?
how do I reference to it?


Posted By: netprofits
Date 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

http://www.nicwebdesign.com" rel="nofollow - Our Site


Posted By: Aeon
Date 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>


Posted By: netprofits
Date 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

http://www.nicwebdesign.com" rel="nofollow - Our Site


Posted By: Rob-CFLHD
Date 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>



Posted By: BlackReefDesigns
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net