Using AddOns, you can extend the functionality of Hybris Commerce Accelerator without editing the core code base. The core code base in this context means Hybris Platform, and all additional extension delivered with Hybris Commerce Accelerator. An AddOn is a regular extension that may or may not provided additional front-end components to Hybris Commerce Accelerator.
Advantages of AddOn Concept
- AddOn file kept separate from the rest of the front-end files.
- When you upgrade the Accelerator, it will not overwrite your files.
- You can easily remove your AddOns without refactoring the code of your whole extension.
To create your custom AddOn follow the following steps:
1.Open the command prompt and
navigate to the <%HYBRIS_HOME_DIR%>hybris/bin/platform directory.
2.Now run the setantenv.bat file. Do not close the command prompt.
3.Run the following command to create your custom AddOn
ant extgen -Dinput.template=yaddon -Dinput.name=myaddon -Dinput.package=com.myapp
Before running above command you can observe that inside hybris/bin/custom folder only single extension(bitbyte)
Now Run the following command from platform
After running the above command you can see your custom AddOn inside hybris/bin/custom folder.
4.Configure localextension.xml file
Add your custom extension (AddOn) to <%HYBRIS_HOME_DIR%>/hybris/config/localextensions.xml
now rebuild the Hybris system by running ant clean all .
Installing an AddOn for specific storefront
The addoninstall tool allow you to configure an AddOn for a specific storefront. It also adds the AddOn to the extensioninfo.xml file of the storefront, and generates the relevant project.properties file for the AddOn.
Now follow the following steps to install AddOn
- Before running ant addoninstall command ensure that addonsupport extension is listed in localextensions.xml file.
Also ensure that the AddOn and storefront extension that you want to install are listed in localextensions.xml file.
2.Now run the following command to install the AddOn
ant addoninstall -Daddonnames="addonname" -DaddonStorefront.<storefrontTemplateName>="StoreFront"
3. When addoninstall has finished running successfully, rebuild the Hybris system by running ant clean all .
Uninstalling an AddOn for a specific storefront
The addonuninstall tool can be used to remove an AddOn from the storefront.
Now run the following command to uninstall the AddOn
ant addonuninstall -Daddonnames="addonname" -DaddonStorefront.<storefrontTemplateName>="StoreFront"
When addonuninstall has finished running successfully, rebuild the Hybris system by running ant clean all .