You are on page 1of 5

Addon or Extension?

When it comes to choose between add-on or extension, it becomes a tricky situation. Because we don’t
know actually, which one is preferable over another?

Extensions are basically a collection of related functionality, like we have promotion or a store front. It is
a larger artefact, in terms of complexity and purpose it solves.

On the other hand, add ons, as their name suggests, are introduced to garnish a existing functionality.
They are like toppings over your meal (extensions). For example, a Captcha addon.

When we need functionality, which is used across multiple store fronts, like captcha; we can go for a
addon. We need not to write a separate extension for that. But we can not go for an addon, if we need
multiple sites, for multiple country or language. In that case, we need to create separate extension for
that.

Suppose, you are working with a legacy system, where you cannot modify the code base, but you want
to modify the look and feel of it’s store front, in that case we can go for a add on.

How to extend existing storefront functionality? i.e add new


java controller or jsp, css?
Addons provide new functionality. It may extend existing functionality or create new set of
functionality. Based on the complexity, there could be 2 options available

a. Create WCMS component


b. Create copy of the base controllers; create new mappings and copy of individual jsps and tags.

Let’s check respective solutions. We will consider new feature “Shop the Look” to evaluate above
solution approach.

About Shop the Look

Retailer: Using this functionality, retailer can group products to create one sellable “Fashion Outfit”, for
example under shop the look one can club Shirt, Pant, Belt, Cap, Socks, sweater and sell it as one look.

Customer: Customer can view individual shop the look items and then they can purchase some or all
items from that look.
a. Create WCMS Component

Under this approach, we will create custom “ShopTheLook” component. This would bean
combination of a “ShowLook” button and modal displaying items configured as shop the look,
along with individual selection option.

Advantage

1. This solution is not dependent on the accelerator’s PDP structure or PDP logic.
2. This way in future, one need to make very minimal changes in the addon logic to make sure
addon is in sync with the accelerator code.
3. Being Data driven, it is very easy to disable component’s visibility on the accelerator pages.

b. Copy of the accelerator code base.

- Create copy of the existing ProductPageController.java and move it in the


acceleratoraddon/src of the addon.
- Create copy of the layout jsps and tag files (which would be updated in the addon) and
move it to the acceleratoraddon/web/webroot/WEB-INF/….

-
-
-
-
-
-
-
-
-
-
-
- Create new mapping for the controller which we moved
- If there are any new configs or spring beans to be added, then add them in the xmlfile and
add them in the project.properties.template (of addon)
-

Advantage

1. Easier to implement.

Disadvantage

1. Since we are copying existing controllers, one needs to make sure addon codes gets
upgraded with Hybris version upgrades.
2. It may end up creating redundant code.
3. Even for the smallest change, one needs to copy more files.

How to extend existing UI / Display logic in addon?

1. Create new controller and mapping so that at the end of the controller, we can land on the
newly designed UI.
2. You may use existing ui logic to generate new UI, in that case, accelerator’s ui files (jsps, tags,
css, js) needs to be copied from accelerator to accleratoraddon/web/webroot…. And respective
folders.
How to add security related config files in the addon?

1. Create a xml file following security filename conventions, addonname-security-config.xml under


folder addon > resources >
2. Place security related setting in that file.
3. Add new config time in the project.properties.template file of the addon

How to configuration in the addon?


1. Add new configurations in the project.properties.template file.
2. After build, configuration defined in the template file becomes part of the storefront’s
project.properties file.

Addons functionality extensions guide lines?


If new functionality involves minor changes for example , changing AddToCart controller logic, then
use accelerator code base and copy it to addon and then modify it.

For very comple functionality, having it done via WCMs component way would e helpful.

You might also like