After a customer logs into their account, the login text changes from "Login" to "You're logged in as: Joe Smith (Allow Terms/PO) Logout".

The "Allow Terms/PO" is based on the Customer's Level. I don't want this to display. How can I change it so it doesn't display?

Ultimately, I would like to have a simple "Login" text to change to "Welcome: Joe Smith" when logged in. Hovering over "Welcome Joe Smith" would trigger a drop-down menu showing the links to the customer's account info (Address Book, Invoices, Orders, My Account, etc).

Any thoughts on how to accomplish this?

Thanks
in ML by (380 points)

1 Answer

0 votes
In your template.master, you'll have something like this :-
 
<div id="login">
   <span id="userName">
      <asp:Literal ID="ltrUserName" runat="server" Text='<%$ Tokens:UserName %>' />
   </span>
   <span
      id="loginText">
      <a href='<asp:Literal ID="Literal1" runat="server" Text="<%$ Tokens:SignInOut_Link %>" />'>
         <asp:Literal
            ID="ltrSignInOutText" runat="server" Text='<%$ Tokens:SignInOut_Text %>' />
      </a>
   </span>
</div>

 

 
I replaced that with a reference to an xmlpackage, that contains code like this :-
 
<xsl:choose>
   <xsl:when test="/root/System/CustomerFirstName!=''">
      <li>
         Welcome 
         <strong>
            <xsl:value-of select="/root/System/CustomerFirstName" />
         </strong>
      </li>
      <li><a href="account.aspx" title="My Account">My Account</a></li>
      <li><a href="signout.aspx">Sign out</a></li>
   </xsl:when>
   <xsl:otherwise>
      <li>
         <xsl:value-of select="$loginlink" disable-output-escaping="yes" />
      </li>
      <li><a href="createaccount.aspx?checkout=False">Register</a></li>
   </xsl:otherwise>
</xsl:choose>

 

 
For the dropdown - you can just add html/css/js intop the xmlpackage.
by (1.1k points)
edited by

So I've created the XML document and I'm trying to call it using (!XmlPackage Name="CustomerLogin.xml" !). This gives me the following error:

Exception=Error in XmlPackage(.Load), Package=[CustomerLogin.xml], Msg=[The XmlPackage file could not be found. The search tree is: skins/skin_{activeskinid}/XmlPackages and then the /XmlPackages folders in your web site. Please make sure that you have FTP'd the file up to the server!]

I've saved the CustomerLogin.xml in my skins/skin_id/XmlPackages.

Obviously, I'm doing something wrong, I'm just not sure what that is.

Here is my xml code:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:choose>
    <xsl:when test="/root/System/CustomerFirstName !="">
        <li>Welcome
            <strong>
                <xsl:value-of select="/root/System/CustomerFirstName" />
            </strong>
        </li>
        <li><a href="account.aspx" title="My Account">My Account</a></li>
        <li><a href="signout.aspx">Sign out</a></li>
    </xsl:when>
    
    <xsl:otherwise>
        <li><xsl:value-of select="$loginlink" disable-output-escaping="yes"/></li>
        <li><a href="createaccount.aspx?checkout=False">Register</a></li>
    </xsl:otherwise>
</xsl:choose>


here is a snippet of my template code:
  <div id="contact" style="width: 100%;">
    <ul id="loginMenu">
        <li><a href="t-RequestPricing.aspx">Request Info/Pricing</a></li>
        <li><a href="dist_locator.aspx">Locate Distributor</a></li>
        <li><a href="t-contact.aspx">Contact Us</a></li>
        <li>(!XmlPackage Name="CustomerLogin.xml" !)</li>

</ul>
</div>

 

 

Try (!XmlPackage Name="CustomerLogin"!) or (!XmlPackage Name="CustomerLogin.xml.config"!) instead...

 

Also - you need to ensure that you use the xmlpackage format (copy another to use as a starting point) rather than a pure xmldocument.

 

TTFN

BFG

I finally got it working! Thanks for your BFG. It would have taken me forever to figure this out on my own.
...