Create an account to edit articles | See Formatting Syntax for Wiki syntax | We look forward to your contribution!
You are here: The ProductCart Encyclopedia » How To's » How to show different content if a customer has logged in
How to show different content if a customer has logged in
What if you wanted to show a “Log in” link only to customers that have not already logged into their account? Or what if you wanted to show an entire “Customer Service” menu only to customers that have logged in?
On a ProductCart-powered storefront you can use a simple IF statement (about conditional statements) to show code only to customers that have already logged into the storefront.
<% if session("idCustomer")="0" or session("idCustomer")="" then %>
<p>This part of my page will be shown when customers are not logged in.</p>
<% else %>
<p>This part of my page will be shown after the customer has logged in.</p>
<% end if %>
For example, let's put this to work and show a customer service menu only to a customer that has logged into the store. Customers that have not already logged in will see a simple link to log in. This could go - for example - in a left or right-side column of your store design, within your pc/header.asp file.
<% ' If the customer is not logged in ' show a link to the registration page. if session("idCustomer")="0" or session("idCustomer")="" then %> <div><a href="custPref.asp">Register/Login</a></div> <% else ' Otherwise show the customer service links %> <div> <a href="custPref.asp">Account Home</a><br /> <a href="CustviewPast.asp">Previous Orders</a><br /> <a href="login.asp?lmode=1">Billing Address</a><br /> <a href="CustSAmanage.asp">Shipping Addresses</a><br /> <% ' If the Wish List feature is active, show a link to it if (scWL="-1") or ((scBTO=1) and (iBTOQuote=1)) then %> <a href="Custquotesview.asp">Saved Products</a><br /> <% end if %> <a href="CustLO.asp">Log Out</a><br /> <% end if %>
Trace: » Google Analytics: Adjusting for Canceled or Returned Orders » Enabling Conflict Management » Installing ProductCart on your desktop » ProductCart v4 - Patch #1 » Preparing for Batch Processing Sub-Products » Configuring BTO as a Request For Quote system » Troubleshooting the Apparel Add-on Installation » Using Google Analytics with your ProductCart-powered store » ProductCart's default storefront » How to show different content if a customer has logged in