cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide prices if user not logged in to webtools

Former Member
0 Kudos

Hi

Our client has a requirement whereby he would like to hide the prices in the partdetail if a user is not logged into the site.

Once they have logged in they can then view the prices in the part list and part detail sections.

Could someone please advise on how to achieve this?

Thanks you

Regards

Ashvin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

try something like this

for partlistpage:

add this to partlistblock.ascx and change for this colunm with price only.


protected override void OnPreRender(EventArgs e)
    { 
              string userID = ((NPBasePage)Page).UserID;
          
            if (userID != "") {
             PartsListGrid.Columns[7].Visible = true;
             PartsListGrid.Columns[8].Visible = true;
            } else {
             PartsListGrid.Columns[7].Visible = false;
             PartsListGrid.Columns[8].Visible = false;
             PartsListGrid.Columns[9].Visible = false;
             PartsListGrid.Columns[10].Visible = false;
            }
}

for part details page i suggest in catalogpartdetail.master

	
    private void Page_Load(object sender, System.EventArgs e) {
            string userID = ((NPBasePage)Page).UserID; 
             
            
            if (userID != "") {
                partprice.Visible = true;
               
            } else {
                partprice.Visible = false;
           
            }}

try the same with search page...

regards Greg.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you so much Greg

That solved the problem.

Regards

Ash

Former Member
0 Kudos

Hello Ash,

There are a couple ways I can think of solving this issue.

1) Create a separate "view-only" catalog that has $0 for all prices and associate it with a theme. Upon logging in, the customers will see the real prices.

2) Create a Javascript or ASP.NET piece of code that sets the visibility on or off based on whether the user is logged in.

3) Block out unregistered users completely, but then publish a static page of products and descriptions or use a plug in that advertises different products on the home page.

James