on ‎2019 May 21 9:37 PM
By default PCM Backoffice loads with all the products populated in the result area. We want to restrict it to only show the Staged catalogVersion products. What will be the right way to do this.
Basically we want a different Catalog Version selected by default in the Catalog Selector.
We use SOLR in our PCM Backoffice.
Request clarification before answering.
Hi ,
I'm afraid that there is no such feature ootb. What you could do it to either extend Catalog Selector widget and replace it or create a simple widget that would send a selection context on initialization to select specified catalog version. If so - please bear in mind that you have to send this message after all widgets are initialized! To be sure of it you should use com.hybris.cockpitng.util.UITools#postponeExecution.
Cheers, Jacek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jacek for your inputs.
I did some more digging and found that if I can get the reference of this class com.hybris.cockpitng.widgets.common.explorertree.ExplorerTreeController then I can call handleExternalNodeIdSelection() method by passing my required nodeId this.getTreeModel().getRoot().getId() + "_catalogs_" + catalog.getName() + catalogVersion.getVersion(). The nodeId will be something like _y_et_root__catalogs_Catalog NameStaged.
It would be interesting to know how can I get this reference and how can I call this method at the end when the page loads.
Thanks
Well... It may also work, yet I wouldn't go this way. May recommendation would be as mentioned above. Personally I would prefer creating simple widget that in initialize method searches for particular catalog, wraps it into selection context and then calls com.hybris.cockpitng.util.UITools#postponeExecution to eventually send this context via socket connected to selectionContext socket of Explorer Tree.
Cheers, Jacek
Well... It may also work, yet I wouldn't go this way. May recommendation would be as mentioned above. Personally I would prefer creating simple widget that in initialize method searches for particular catalog, wraps it into selection context and then calls com.hybris.cockpitng.util.UITools#postponeExecution to eventually send this context via socket connected to selectionContext socket of Explorer Tree.
Cheers, Jacek
Hi Jacek,
I tried your suggestion. Though I'm running out of luck here. The selection is not happening properly this way. Maybe the postpone event is not getting triggered at right time or I'm missing something. Just to let you know this below code is getting invoked properly within the flow, just that the selection is not happening.
Can you suggest me how can I send a selection context?
public class MyExplorerTreeController extends ExplorerTreeController
{
@Override
public void initialize(final Component comp)
{
super.initialize(comp);
UITools.postponeExecution(comp, new Executable()
{
@Override
public void execute()
{
final NavigationNode node = findNodeById(getTreeModel().getRoot(), "_y_et_root__catalogs_" + "ctlg_id : ver_id");
final Event event = new Event("manual selection event", null, node);
final Treeitem treeItem = new Treeitem("", node);
handleTreeSelection(event, treeItem);
}
});
}
}
I would expect it to work...
You would have to do the following:
1. Define completely new widget (let's call it sap.commerce.catalog.init.selector)
2. Put new widget in mesh-up (let's say under catalog-init id)
3. Widget should define one output socket of type com.hybris.backoffice.navigation.TreeNodeSelector (let's call it initialCatalogVersion)
4. A connection should be defined: catalog-init:initialCatalogVersion -> pcmbackoffice-collectionBrowser-catalogFilterTree:nodeIdSelected
5. In new widgets controller:
@Override
public void initialize(final Component comp)
{
super.initialize(comp);
UITools.postponeExecution(comp, new Executable()
{
@Override
public void execute()
{
final String nodeId = getTreeModel().getRoot(), "_y_et_root__catalogs_" + "ctlg_id : ver_id";
final TreeNodeSelector selector = new TreeNodeSelector(nodeId, true);
getWidgetInstanceManager().sendOutput("initialCatalogVersion", selector);
}
});
}
Cheers, Jacek
I followed your approach and it behaved the same way as to what I did. But your approach was clear and precise so I kept it.
I figured out the main culprit of why even after selecting the catalog version the search results were showing products from both catalogs.
"pcmbackoffice-search-init" widget was getting invoked at the time of login which was causing the results to display from all available catalogs. Since in hybris 6.7 I cannot remove the widget-connection, so I removed this widget itself and everything started working great.
I validated and it looks good. Let me know if you've any issues with this approach. I'm marking this thread as answered and thank you very much for the support.
Cheers Pratik
One question wouldn't restricting the read permissions for other catalogs (for certain usergroups) work either?
$productCatalog = SomeCatalog
$productCatalogVersion = SomeStagedVersion
$productCatalogVersionOnline = SomeOnlineVersion
# create test CatalogVersion
INSERT_UPDATE CatalogVersion; catalog(id)[unique = true]; version[unique = true]; active[default = false]; mnemonic; languages(isocode); readPrincipals(uid); writePrincipals(uid)
; $productCatalog ; $productCatalogVersion; ; Staged ; de,en,fr; admin,UserGroupForStagedOnly, UserGroupForStagedAndOnline ; admin,UserGroupForStagedOnly, UserGroupForStagedAndOnline
; $productCatalog ; $productCatalogVersionOnline ; TRUE ; Online ; de,en,fr ; admin,UserGroupForStagedAndOnline ; admin, UserGroupForStagedAndOnline
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.