Developer forum

Forum » Development » Manipulate navigation from code before rendering

Manipulate navigation from code before rendering

Gaetan Di Caro
Reply

Hi,

 

I am trying to hide certain groups from certain users in the navigation (menus, etc.). I could do it in javascript but it's not a very elegant solution. Therefore I'm looking for something like a ProductListBeforeRender extender, but for product groups, where I could have access to the list of groups and manipulate it before sending it to the front end.

Is that possible ? Is there another solution ?

 

Thanks !


Replies

 
Morten Snedker
Reply
This post has been marked as an answer

Hi Gaetan,

It is not possible out of the box. And there is no template extender for groups. The only work-around I can think of:

Instead of using Ecom navigation (if that is what you're actually doing), I'd go for using repository (indexing ecom) and use the index for displaying groups. Aside from that you'd need the information of which users are (dis)allowed to see certain groups. This would be custom table paring usersId's and groupId's. In a Razor template, having your groups loop, you would be able to make a look-up to this custom table, and decide wether or not to render the group. Depending on the size of your custom table you may want to do some caching.

If anyone have better ideas, I'd like to know as well - but this was my best bet.  :-)

 

Best regards
Morten Snedker

Votes for this answer: 1

 

You must be logged in to post in the forum