AddOns in SAP Commerce [Hybris]

In this article, I explain in details about the AddOns in SAP Commerce and demonstrate how to create our own custom AddOn using ant extgen command based on yaddon template. 


AddOns are used to extend the functionality of SAP Commerce Accelerator[storefront] without modifying the core code base. AddOn is a type of extension that allow you to add front-end related files such as JSP, HTML, CSS and JavaScript files without modifying the storefront front-end files directly.

AddOns will never alter the core business logic rather it just enhances the existing storefront behaviour.

AddOns often refers to plug and play kind of extensions and anytime you can install or uninstall from the storefront without effecting core business functionality.

Generally, AddOns contains front-end related logic whereas extensions contain business logic.


Creating a custom AddOn:

        We can use same ant extgen command to create your own custom AddOn and need to provide template name as 'yaddon'. 

ant extgen -Dinput.template=yaddon -Dinput.name=mycustomaddon -Dinput.package=com.hybris.mycustomaddon


Installing an AddOn for a Specific Storefront:

        The addoninstall command can be used to install an AddOn for your storefront as shown below:

ant addoninstall -Daddonnames="mycustomaddon1,mycustomaddon2" -DaddonStorefront.yacceleratorstorefront="ElectronicsStorefront"



Uninstalling an AddOn for a Specific Storefront:

        The addonuninstall command can be used to remove an AddOn from the storefront as shown below:

ant addonuninstall -Daddonnames="mycustomaddon1,mycustomaddon2" -DaddonStorefront.yacceleratorstorefront="ElectronicsStorefront"



Advantages of the AddOns:

  • AddOn files are kept separate from the actual storefront related front-end files.
  • When you upgrade the Accelerator, it will not overwrite your files.
  • Since AddOns are plug and play, you can easily remove your AddOns without refactoring the code of your Accelerator extension.


If you have any questions or need further clarification on any of the steps, feel free to reach out to me at rameshvanka8@gmail.com. I’m happy to help and would love to hear your feedback!  

Happy Learning!🙂



Comments

Popular posts from this blog

Type System in SAP Commerce [Hybris]

Differences between Extension and AddOn in SAP Hybris

items.xml in SAP Commerce [Hybris]