Configuration properties and customizing platform code in SAP Commerce(Hybris)

Configuration Properties

SAP Commerce(Hybris) provides a flexible way to manage properties in our projects. It relies on three essential configuration files:

  1. project.properties file in the platform: it is located in ${HYBRIS_BIN_DIR}/platform and it contains the default global properties(settings) for the whole Hybris platform. It is not recommended(not good) to edit this file.
  2. project.properties files in each extension: each Hybris extension has its own configuration file. The properties defined here are available only for the extension, it belongs to. We define the properties, which are to be used only in this extension. Properties specified will be with higher priority than project.properties file in platform folder.
  3. local.properties: it is located in the ${HYBRIS_CONFIG_DIR} directory. It is working copy of the project.properties(platform) which allows us to override default the settings. The overridden values are common across all the extensions. Properties defined in this file will be with highest priority than properties defined in any other properties file.

Priority of SAP Commerce configuration properties

We can view all available properties and change them inside Hybris Administration Console->Platform->Configuration:

If we change properties in HAC, the changes will be lost after server reload because all changes are stored in memory:

Customizing platform code in SAP Commerce(Hybris) and ant customize

If we need to have some customization for an OOB class available in platform or any other extension but we can’t extend and add custom logic in any of its private methods which is the area of customization for satisfying the requirements, we can use “ant customize”. The steps are:

  1. Copy the original file that we want to customize in ${HYBRIS_CONFIG_DIR}/customize directory.
  2. Change the code in the file.
  3. Run ant customize.

Example: If we want to customize a java file de.hybris.platform.sap.sapordermgmtbol.transaction.header.businessobject.impl.HeaderSalesDocument.java we have to create a customized java file HeaderSalesDocument.java and put it inside the customize folder as the same directory structure it is defined. So we have to keep the customized java file in the directory as: config/customize/ext-integration/sap/synchronousOM/sapordermgmtbol/src/de/hybris/platform/sap/sapordermgmtbol/transaction/header/businessobject/impl/HeaderSalesDocument.java

Then we run ant customize and this will copy the files from customize folder to the target destination.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store