Rank: Member
Groups: Developers, HelpDesk, Registered Joined: 11/1/2018(UTC) Posts: 29
|
Trying to update the Store Header Navigation and show a link to a content page IF a user is a member of a specific group. For example, if a member is in the "Staff" group, show the link. The view has the following: Code:
@if (user.IsAdmin)
{
(SHOW SOME CODE)
}
Not sure what the code would be to specify a member of a group. How can we display based on membership in a specific group? Code:
@if (user.IsMember)
{
(Show alternate code)
}
There does not appear to be any previous posts about this kind of topic. Help is appreciated!
|
|
|
|
Rank: Administration
Groups: Admin, Administrators, HelpDesk, System, Authorized User, Developers, Registered Joined: 10/5/2018(UTC) Posts: 175
Thanks: 8 times Was thanked: 17 time(s) in 15 post(s)
|
If you know your group ID, then you can use something like this Code:
@if (user.IsInGroup(1))
{
(SHOW SOME CODE)
}
where 1 needs to be replaced with group id of your group. You can found the group id through admin, visit People > User Groups page. Click the users count against the group name and copy the id from URL.
|
|
|
|
Rank: Member
Groups: Developers, HelpDesk, Registered Joined: 11/1/2018(UTC) Posts: 29
|
Thanks Mazhar, The next concern: In the BuyProductDialog content, I want to show members of my "Staff" group the option to view COGS under the Price. We used to be able to refer to COGS as a data point, but I don't see this in the code. Ideally, I'd like to have the following: Code:
@if (user.IsInGroup(XX))
{
<li><span>@GetResourceString("retail.buyproductdialog.cost")</span><span>@Model.Product.Cost</span></li>
}
Is there a data point for referencing the COGS in the product?
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
There is no property for COGs in the BuyProductDialog view model. You will need to update the controller code to add this field value in the view model class.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close