AddOn Concept

AddOn Concept

AddOns are built on top of the existing SAP Hybris Commerce to extend the functionality of the SAP Hybris Commerce Accelerator. AddOns are a type of extension that allow you to add front end files(such JSP, HTML, CSS and JavaScript files, as well as images) from within your own AddOn, Instead of modifying the storefront-end files directly.

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

  1. AddOn file kept separate from the rest of the front-end files.
  2. When you upgrade the Accelerator, it will not overwrite your files.
  3. You can easily remove your AddOns without refactoring the code of your whole extension.

Creating AddOns

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.

navigatetoplatform

2.Now run the setantenv.bat file. Do not close the command prompt.

setantenv

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)

before creation of addon

Now Run the following command from platform

create addon

After running the above command you can see your custom AddOn inside hybris/bin/custom folder.

hybris diary addon

4.Configure localextension.xml file

Add your custom extension (AddOn) to <%HYBRIS_HOME_DIR%>/hybris/config/localextensions.xml

localextenstion.xml
localextensions.xml

now rebuild the Hybris system by running ant clean all .

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

  1. Before running ant addoninstall command ensure that addonsupport extension is listed in localextensions.xml file.
addonsupport extension in localextension.xml
localextensions.xml

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"

addoninstall

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"

addonuninstall

When addonuninstall has finished running successfully, rebuild the Hybris system by running ant clean all .

 

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s