Restricting Content to User Group (Newb)

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
SethGGA
Ensign (ENS)
Ensign (ENS)
Posts: 3
Joined: Thu Nov 18, 2010 9:36 am

Restricting Content to User Group (Newb)

Post by SethGGA » Wed Jan 26, 2011 11:01 am

I am a total newb to web development and have been working to customize our AbleCommerce store. One feature that is very important for us to incorporate is content that will only be viewable by our magazine subscribers.

I have the subscriptions set to add the subscriber to a custom group, but have been unable to successfully restrict the content (I am hoping to create it as a top-level page on the horizontal nav bar). I found a few posts touching on this topic, but all lacked sufficient info for my low-level ability.

Can anyone help?

Thank you in advance for your time.

User avatar
triplw
Commander (CMDR)
Commander (CMDR)
Posts: 144
Joined: Sat Jan 12, 2008 5:34 pm
Contact:

Re: Restricting Content to User Group (Newb)

Post by triplw » Wed Jan 26, 2011 1:25 pm

You can wrap the link to the content for subscriber's only with a conditional statement in the scriptlet.
For example:
in Admin/Website/Content and Layout there is the scriptlet for the Standard Header
It has a horizontal menu with links something like this:

Code: Select all

<td class="navigation" colspan="3">
			<div class="content" style="float:left;">
				<a href="~/Default.aspx" class="tab">Home</a>

				if ($store.Currencies.Count > 1 ) 
					<a href="~/Currencies.aspx" class="tab">Currencies</a>
				#end				<a href="~/FAQ.aspx" class="tab">FAQ's</a>
				<a href="~/Service.aspx" class="tab">Contact Us</a>
			</div>
		</td>
.......

See how there is a conditional statement for foreign currencies?

You could do something similar for your special category. Make the category "hidden" and use a statement like this:
#If ($customer.IsInGroup(x))
<a href="your_Link.aspx">Subscriber Only Category</a>
#end

You would put the number assigned to the group where I have an x.

One way to find the Group number is:
Admin/People/UserGroups

Hover on an icon to the right of the group then look at the URL at the bottom of the screen. You will see GroupId=x at the end. That is the id assigned to the group.

Hope this helps.

User avatar
SethGGA
Ensign (ENS)
Ensign (ENS)
Posts: 3
Joined: Thu Nov 18, 2010 9:36 am

Re: Restricting Content to User Group (Newb)

Post by SethGGA » Wed Jan 26, 2011 2:33 pm

Success! Worked perfectly.

Thank you! Thank you! Thank you!

Hopefully this will be a help to others with the same question.
For reference, I also used this thread on how to add a top-level page:
viewtopic.php?f=42&t=9473

Post Reply