an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Using DotShoppingCart > Display/Hide Categories based on customer
Last Post 4/1/2010 1:13:42 PM By bansal_db. 11 replies.
Page 1 of 2 (12 posts) << First < Prev 1 2 Next > Last >> 
2/2/2010 7:29:22 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Display/Hide Categories based on customer
 Luke,
 
I am trying to hide/display categories based on customer. Whats the best way to go about it?
 
I created a table which would have the categoryid, userid and status. if status is active, customer should be able to see this category otherwise not.
 
I am not sure where all would i have to do changes in the code for this? Can you please give me some ideas?
 
Thanks
 
-D
2/2/2010 10:18:31 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Display/Hide Categories based on customer
You can modify the Category.GetCategories method to have an addtional user parameter. Then filter the result after it gets back from the database. Or you can pass user to the store procedure and do the filtering in the sproc level.
DotShoppingCart Staff
2/3/2010 8:59:34 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Display/Hide Categories based on customer
ok. I modified the stored procedure only to return allowed categories.
 
Only problem is, user can still access the category if he types the name in the url. Can i do some kind of check on the page load?
 
What would be the best way to do it?
 
Thanks
2/3/2010 12:42:15 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Display/Hide Categories based on customer
If you pass the current username to GetCategories method, how would it display the category that he is not authorized to view?
DotShoppingCart Staff
2/4/2010 8:40:16 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Display/Hide Categories based on customer
how do i modify the product count in productlistData?
 
Like when you click on the parent category, it lists all the products from the children categories. I modified the product list to show only allowed categories. but the count on the top is off.
 
You know where it says Showing 1 - 22 of 22 Results.
 
The count is from ProductListData i think but i am not sure how to modify that.
 
Thanks
2/4/2010 10:04:02 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Display/Hide Categories based on customer
Looks like you need to do the same thing to Product.GetProducts as well so that it returns only the products for that user.
DotShoppingCart Staff
2/4/2010 10:09:18 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Display/Hide Categories based on customer
I already did that. Only thing left is the count. Count is not coming from GetProducts.
2/4/2010 2:46:59 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Display/Hide Categories based on customer
It will be very complicated to get count right. You will need to feed in the username to the store procedure DSC_Category_GetDetail. I suggest you just disable showing the count.
DotShoppingCart Staff
2/8/2010 11:17:03 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Display/Hide Categories based on customer
I created an admin function that need to added to the admin menu tree on the left. How would i do that?
2/8/2010 11:48:25 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Display/Hide Categories based on customer
web.sitemap
DotShoppingCart Staff
4/1/2010 12:25:24 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Display/Hide Categories based on customer
Hi Luke,
 
The products from the hidden category show up in the search result. How do i modify the search result to show only allowed products?
 
Thanks
 
-D
 
 
Page 1 of 2 (12 posts) << First < Prev 1 2 Next > Last >>