Search code examples
sap-commerce-cloudbackoffice

How to set List View as default view in Hybris PCM Backoffice


I am a bit new to the Hybris platform. I am working with the Backoffice PCM on Hybris 6.7.

I would like to change the default browser display when using the PCM Backoffice. Currently the default behavior renders Grid View but I would like to use List View instead. I will like to either remove entirely the grid view option (or disable it) and automatically open products in list view instead.

enter image description here


Solution

  • You have to customize the xml to obtain the desired behavior. The best approach is creating a new extension from template ybackoffice to consolidate your changes.

    Basically, the original extension have these lines:

    <context type="Product" component="pcmbackoffice-assortment-collection-browser" >
        <cb:collection-browser xmlns:cb="http://www.hybris.com/cockpitng/config/collectionbrowser">
            <cb:available-molds default-mold="grid-view">
                <cb:mold spring-bean="listViewCollectionBrowserMoldStrategy"/>
                <cb:mold spring-bean="gridViewCollectionBrowserMoldStrategy"/>
            </cb:available-molds>
        </cb:collection-browser>
    </context>
    

    Just copy and paste in your new extension in the file <myextension>-backoffice-config.xml and remove the line correspondent to the grid view (for removing the option), eg.:

    <context type="Product" component="pcmbackoffice-assortment-collection-browser" >
        <cb:collection-browser xmlns:cb="http://www.hybris.com/cockpitng/config/collectionbrowser">
            <cb:available-molds default-mold="list-view">
                <cb:mold spring-bean="listViewCollectionBrowserMoldStrategy"/>
            </cb:available-molds>
        </cb:collection-browser>
    </context>
    

    Do ant clean all, and after HAC update in your extension.

    Ps.: You can apply these changes through orchestrator to see the result in live, before create the new extension.