sap-commerce-cloudsmartedit

SmartEdit for 1 shop with multiple base stores each with difference product catalog


I am using SAP Commerce 2011 and I have a WCMS site with 4 base stores, each having a different product catalog. I have also logic that lets the user select which base store he wants to see. Selecting a base store sets the related catalog version in session, using

DefaultCMSSiteService.setCurrentCatalogVersion.

This works well, but not in SmartEdit. The CMSSiteFilter calls the method getContextInformationLoader().initializePreviewRequest with every request. This gets the default product catalog of the WCMS site and set its active version in session, overriding my logic above. Therefore, I can not open the PDP in smartedit as a wrong catalog version is referenced.

I wonder why smartedit does not support such a standard scenario of having multiple base stores, eahc with different product catalog!

Any idea how to solve this?


Solution

  • It turns out, that smart edit code does not consider the case of having multiple base stores per site and a product catalog per base store. The workaround I implemented is the following:

    Disable the ActiveBaseSitePreviewStrategy.

    Explanation: The method getContextInformationLoader().initializePreviewRequest calls 3 strategies to initialize the preview request. The above is one of them. It sets in the session the active site together with other things, among which is the default catalog version.

    We want only to set the active site. This and also the other things set by this strategy, they are set in other places in the code. So this strategy is not necessary.

    So in a custom extension xxx-spring.xml add the following

    <alias name="defaultPreviewRequestStrategiesList" alias="previewRequestStrategiesList" />
    <util:list id="defaultPreviewRequestStrategiesList">
        <ref bean="catalogVersionsPreviewStrategy" />
        <ref bean="uiExperienceLevelPreviewStrategy" />
    </util:list>
    

    defaultPreviewRequestStrategiesList represents the list of strategies injected in ContextInformationLoader (see acceleratorcms-spring). I just removed ActiveBaseSitePreviewStrategy from it.