Page 1 of 1

Hiding categories?

Posted: Wed Jul 09, 2008 7:58 am
by jrib
We have certain custom printed materials that we only want to make available to certain users who we've certified. It looks like it would be easy enough to make a group then assign permissions to that group, but is there any to hide that whole category of products so that I doesn't appear on any search for regular users?

Re: Hiding categories?

Posted: Wed Jul 09, 2008 8:50 am
by jmestep
You should be able to set it to private (the ghost icon). Then it is accessible only by direct link.

Re: Hiding categories?

Posted: Wed Jul 09, 2008 9:17 am
by sohaib
Public, Private and Hidden categories

Re: Hiding categories?

Posted: Wed Jul 09, 2008 10:33 am
by nickc
With a couple of small tweaks, you can place your "hidden" category as a link on the left nav, and reveal it for only certain groups (the alternative is sending those users a direct link).

First, make a small change in SimpleCategoryList.ascx.cs from this:

Code: Select all

        CategoryList.DataSource = CategoryDataSource.LoadForParent(_CategoryId, true);
to this:

Code: Select all

        CategoryList.DataSource = CategoryDataSource.LoadForParent(_CategoryId, false);
Then, wrap an entry point to your hidden category with some Velocity markup in your sidebar.htm scriplet:

Code: Select all

#if ($customer.IsInGroup(2))
[[ConLib:Custom\SimpleCategoryList CategoryId="39" HeaderText="Consumer"]]
#end
CAVEATS:
Changing the SimpleCategoryList control will affect your site globally. If you use this control elsewhere, you'll also have to ensure that your hidden categories can't be descended to in the category tree by normal nav items. The easiest way of doing this would be to branch all hidden categories off a single top-tier category, and don't make an entry point below (i.e. don't use [[ConLib:Custom\SimpleCategoryList CategoryId="0" ]])

Re: Hiding categories?

Posted: Wed Jul 09, 2008 10:59 am
by jrib
Great input-- thanks to all! I'll be back the office where I can try this stuff out on the dev site. Looks like just what we need.

Re: Hiding categories?

Posted: Mon Jul 14, 2008 4:57 pm
by hattonpoint
Could this be applied to individual products inside of a category in a similar fashion?

Re: Hiding categories?

Posted: Mon Jul 14, 2008 6:31 pm
by nickc
Yes, but it would be ugly to maintain; category pages are rendered using repeaters, so logic would be better to be databound. Without knowing how many user groups, how many products... The "best" solution would be to establish 2 new properties in the Product class: a collection of user groups for which the product should be visible, a boolean property to determine if the product's visibility is user-bound; and a Product class method for inspecting the current state given Product id and User Id.

Re: Hiding categories?

Posted: Thu Jul 24, 2008 3:20 pm
by hattonpoint
Current I only have 1 group and good chance that's all I will have. Current situation calls for the quickest/easiest way to implement "product" level visibility/security as controlled by "user groups", but ideally it would be setup similar to how products can have different prices based on a user group.

That said, your explanation calls for creating new properties and a new class. Can you provide me with more detail on where exactly to start? Are there any examples out there of this being done before? I've searched through the API, WIKI, and Forums. Conceptually I understand the idea, but not how to implement within the AbleCommerce framework without requiring the modification of the source code.

Thanks!

Re: Hiding categories?

Posted: Tue Mar 30, 2010 3:17 pm
by jessthib
I am doing something similar with my site. Is it possible to not have hidden products show up in searches?

Thanks!

Re: Hiding categories?

Posted: Wed Mar 31, 2010 7:01 am
by mazhar
Hidden products don't appear in searches but accessible via a direct URL. For example if there is a product A having access URL www.xyz.xyz/a1.apx and its visibility is hidden. Then this will not appear in store searches or in category listing. But if some one supplies its direct link www.xyz.xyz/a1.apx then it will be displayed. In order to fully block the product turn its visibility to private.