How to Show Different Content to Logged In vs. Logged Out Customers

Last Updated: Dec 17, 2018 05:22PM EST
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 %>


Menu

647e99095133bd6d1ae916f97dc7f92f@productcart.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete