Addons Overview
​
Addons refers to modular extensions or plugins that can be added to the core Hybris platform to extend its functionality or customize its features. Addons allow developers to tailor the platform to meet specific business requirements without modifying the core codebase, making it easier to maintain and upgrade the system.
SAP Commerce is built on a modular architecture. The core platform provides essential e-commerce functionalities, and additional features can be added using add-ons. This modular approach allows businesses to customize their e-commerce solution according to their unique needs.
Key features of Addons:
-
Addon is also a kind of extension which is generally used to extend Accelerator StoreFront functionality. For example, suppose you want to create a new CMS component and want to use it in your storefront but you don't want to touch the code base then the best way is to create an addon.
-
They are built on top of the existing Hybris functionality to extend the functionality of the Accelerator.
-
Addons are a form of extension which allows us to add front-end files e.g. JSP, CSS, and JS.
-
Instead of editing the core code of Hybris we will do the changes in the addon code which is best practice.
-
You can safely upgrade your core SAP Hybris code without the need for excessive development.
-
We can add and remove the Addon at will without refactoring or rewriting code.
​
​
Addons Installation
We have divided the add on installation steps as following:
Step 1: Open the hybris/bin/platform folder in the code.
​
​
​
​
​
​
​
​
Step 2: Run the command setantenv.sh (Linux) or setantenv.bat (Windows)
Step3: Run the following command:
ant extgen -Dinput.template=yaddon -Dinput.name=customHybrisAddon -Dinput.package=com.custom.addon
​
​
​
​
​
Step 4: Check add on customHybrisAddon is created in your hybris/bin/custom folder.
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
Step 5: Modify your localextension.xml file to include the extension you just created. Add the following line in localextension.xml file.
<extension name=”customHybrisAddon” />
​
Step 6: Installing customHybrisAddon Addon to "trainingstorefront".
​
ant addoninstall -Daddonnames="customHybrisAddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
​
Step 7: Now do the customization on the top of the add on code in controller, jsp and xml file.
​
​
​
​
Addons Customization
​
We use the OOTB Add On on the storefront to achieve the plug in functionality. Sometimes it is required that we might need to do some minor customization’s or changes in the addon code to satisfy the business requirement of the client. Hybris provided addons in the package are property of Hybris and should not be modified we need to do it in a different way by Cloning. By cloning you create a new addon extension of OOB addon.
Following are the steps to clone an AddOn:
Step 1: Add below entry to the extensioninfo.xml file of the addon you need to clone. It makes the extension to be used as a template.
<meta key="extgen-template-extension" value="true"/>
Step 2: Copy extgen.properties from any extension to addon which we are closing. We have to copy the file extgen.properties at same path as extensioninfo.xml file.
Step 3: Replace the content in the file as below based on addon to customize:
​
​
​
​
​
​
​
​
​
Step 4: ​Now invoke ant extgen task, you will see the addon you want to customize available as a template. Choose it and proceed with the steps.
​Step5: Your new custom addon will be available under Custom folder.
​
​
​
​
​
​
​
​



