cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Set a default Catalog (Navigation Node) after the Backoffice login

Former Member
0 Likes
1,201

My use case is like this:

  • We have catalogA and catalogB (both in readable catalogs for all usergroups).

  • If the user is member of userGroupA then after login the catalogA should be selected by default.

  • If the user is member of userGroupB then after login the catalogB should be selected by default.

So far, I found that the best way to do so is to override the method GenericInitAdvancedSearchController.createAdvancedSearchInitContext(NavigationNode navigationNode) wich takes a navigationNode in the arguments

My question is how can I define a new navigation node since the object is just passed by socket from the widget socketId = "nodeSelected", is there an initializer, a factory to generate one by catalog.

Thank you in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

The way I did it is by overriding the method initializeWithContext inside the FullTextSearchController, this method is called the first time a user logs in. That's when you can check the group of the logged user and add conditions to the solr query.

Answers (2)

Answers (2)

former_member625836
Active Contributor

Hi ,

There is a Advanced Search Engine Generic Initializer widget that allows adding any conditions you wish to the search. What I would do is:

  1. introduce two Explorer Tree configurations for different groups

  2. extend explorerTreeSelectionProxy multiplexer widget by introducing two virtual output sockets (let's call them catalogA and catalogB) and two settings (`catalogA_expression` and catalogB_expression); those two settings should provide a SpEL expression that returns true if apropriate node was passed as #root (i.e. #root.id EQ 'explorer-tree-nodes-catalogA' if node representing catalogA has id set to explorer-tree-nodes-catalogA)

  3. create new bean that implements com.hybris.backoffice.widgets.advancedsearch.AdvancedSearchInitializer and add proper conditions depending on selected node

  4. introduce new Advanced Search Engine Generic Initializer widget that points to bean created in previous step

  5. connect virtual sockets from explorerTreeSelectionProxywith initializer and initializer with advanced search

This way you would have those nodes working as expected.

When it comes to have those nodes selected by default, you can do it by following widget meshup change:

  1. Connect perspectiveSelected socket of PerspectiveContainer with Condition Evaluator that would check if it is hmc2

  2. Connect true socket of this Condition Evaluator with Property Extractor that would create new instance of com.hybris.backoffice.navigation.TreeNodeSelector

  3. Connect genericOutput of this Property Extractor with Explorer Tree's nodeIdSelected socket

The only problem with this solution is that it would select this node every time Administration Cockpit is opened.

Cheers, Jacek

former_member625836
Active Contributor
0 Likes

Hi ,

I don't really get what you want to achieve. My guess is:

  1. Explorer tree on the left of Administration Cockpit contains two additional nodes - each representing different catalog

  2. When user logs in, depending on which group he belongs to, a particular node is selected

  3. A selection is propagated to Advanced Search and eventually to Collection Browser which displays a list of Products assigned to selected catalog

Am I right? If so, then is user still able to change the catalog and freely manipulate with Advanced Search conditions? What version of SAP CX are you using?

Cheers, Jacek

Former Member
0 Likes

Hello , thank you for taking your time to comprehend my issue.

I am using Hybris 6.7, and we want to implement this in a custom backoffice extension. The second point that you mentioned is the one that I want to implement, I can't figure a way to select a default node for a user after the login process.

Right now, no node is selected which retrieves all the products, I do not want that to happen.

I'll explain further in the next comment (due to the limited amount of characters).

Former Member
0 Likes

I will simplify what I want to achieve with examples:

  • Imagine that we have two catalogs catalogA and catalogB (both readable catalogs for all usergroups).

  • If the user is member of userGroupA then after login only products from catalogA should be shown in the gridView/ListView (ie: catalogA Navigation Node should be selected ).

  • If the user is member of userGroupB then after login only products from catalogB should be shown in the gridView/ListView (ie: catalogB Navigation Node should be selected ).

Former Member
0 Likes

After debugging the login process I found that when users login to product cockpit, all products are shown by default (Because Hybris creates a SolrSearchQuery to retrieve all products by default), so is there a way to intercept and change that query to add conditions to it.

Thank you in advance for any help you can provide. Cheers.