Install Hybris b2c accelerator step by step

Hybris featured image

1. Overview

In Hybris, an accelerator is a bunch of a ready to use extensions that comes with pre-built eCommerce key features, e.g. (Web Content Management, Product Details, Search and Navigation, Order Management, Payment, Checkout…).

There are a variety of Hybris accelerators, each one of them targets specific needs :

  • B2c accelerator
  • B2b accelerator
  • Telco accelerator
  • China accelerator
  • Travel accelerator

This is a simplified overview of the Hybris b2c architecture.

Accelerator architecture overview in Hybris

  • ystorefront: it’s the web tier layer of the accelerator, it is implemented using Spring MVC and Spring Security.
  • ycore: it is the business and data access layer of the accelerator,  it is often referred to as ServiceLayer.
  • yfacades: it is an abstraction and aggregation layer of the business layer, used to convert the data model objects to DTOs.
  • yfulfilmentprocess: contains the implementation of the business processes, e.g. Order process, Consignment process, Refund process…
  • ycockpits: used to customize the cockpits (product cockpit, cms cockpit…).
  • ytest: for integration test.

This article is a step by step guide on how to install a custom Hybris b2c accelerator.

2. Install b2c accelerator

2.1. Preparation

Download the Hybris Commerce Suite 6.x, for this example I will use the version 6.4.

Unzip the Hybris Commerce Suite package inside a directory, e.g. /Users/mouadelfakir/Desktop/hybris or C:/hybris.

The directory path to the hybris folder should not contain any whitespaces.

Unzip accelerator in hybris

Let’s agree on some terms before we go on :

  • <HYBRIS_HOME>: it’s is the root directory of Hybris (where you have unzipped the Hybris Commerce Suite).
  • <HYBRIS_BIN_DIR>: it’s the folder <HYBRIS_HOME>/hybris/bin.

2.2. Install sample b2c accelerator

To install the sample b2c accelerator (electronics accelerator), we will use the recipes installer.

Navigate to the <HYBRIS_HOME>/installer folder and run the following command.

$ ./install.sh -r b2c_acc

...

BUILD SUCCESSFUL
Total time: 2 seconds

2.3. Generate custom extensions

Navigate to the <HYBRIS_HOME>/hybris/bin/platform folder and set the Ant in the environment variables using the following command.

$ . ./setantenv.sh

Then run ant modulegen with your specific inputs, to generate the custom b2c accelerator extensions.

$ ant modulegen -Dinput.module=accelerator -Dinput.name=training -Dinput.package=com.stackextend.training -Dinput.template=develop 

...

BUILD SUCCESSFUL
Total time: 23 seconds
  • input.module=<module to generate>
  • input.name=<name of your project>
  • input.package=<your java package>
  • input.template=<generation mode>

2.4. Terminal output

[echo] 	
     [echo] 	Next steps:
     [echo] 	
     [echo] 1) Add your extension to your /Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/config/localextensions.xml
     [echo] 		
     [echo] <extension dir="/Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/bin/custom/training/trainingfulfilmentprocess"/>
     [echo] <extension dir="/Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/bin/custom/training/trainingcockpits"/>
     [echo] <extension dir="/Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/bin/custom/training/trainingcore"/>
     [echo] <extension dir="/Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/bin/custom/training/trainingfacades"/>
     [echo] <extension dir="/Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/bin/custom/training/trainingtest"/>
     [echo] <extension dir="/Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/bin/custom/training/traininginitialdata"/>
     [echo] <extension dir="/Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/bin/custom/training/trainingstorefront"/>
     [echo] 
     [echo] 2) Remove the following extensions from your /Users/mohamed/project/run/trainning/hybris-commerce-suite-6/hybris/config/localextensions.xml
     [echo] 		yacceleratorfulfilmentprocess,yacceleratorcockpits,yacceleratorcore,yacceleratorfacades,yacceleratortest,yacceleratorinitialdata,yacceleratorstorefront
     [echo] 
     [echo] 3) Make sure the applicationserver is stopped before you build the extension the first time.
     [echo] 	
     [echo] 4) Perform 'ant' in your hybris/platform directory.
     [echo] 
     [echo] 5) Restart the applicationserver
     [echo] 		
     [echo]

2.5. Config the localextensions.xml

Open the <HYBRIS_HOME>/hybris/config/localextensions.xml file using a text editor.

1 – Add the generated extensions to the localextensions.xml file.

<!-- custom extensions -->
<extension name="trainingfulfilmentprocess"/>
<extension name="trainingcockpits"/>
<extension name="trainingcore"/>
<extension name="trainingfacades"/>
<extension name="trainingtest"/>
<extension name="traininginitialdata"/>
<extension name="trainingstorefront"/>

2 – And delete the following extensions from localextensions.xml file.

<extension name="yacceleratorfulfilmentprocess"/> 
<extension name="yacceleratorcockpits"/> 
<extension name="yacceleratorcore"/>
<extension name="yacceleratorfacades"/>
<extension name="yacceleratortest"/>
<extension name="yacceleratorinitialdata"/>
<extension name="yacceleratorstorefront"/>

3 – Run ant on platform directory

$ cd hybris/bin/platform

$ ant

2.6. Install add-ons (Optional)

Install the following basic add-ons extensions to take advantage of all the features of the accelerator.

$ ant addoninstall -Daddonnames="liveeditaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="commerceorgsamplesaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="promotionenginesamplesaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="smarteditaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="textfieldconfiguratortemplateaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="assistedservicestorefront" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="assistedservicepromotionaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="customerticketingaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="orderselfserviceaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"
$ ant addoninstall -Daddonnames="adaptivesearchsamplesaddon" -DaddonStorefront.yacceleratorstorefront="trainingstorefront"

Might one or more of these extensions are deprecated so don’t worry about it just keep going.

2.7. Configure URLs mapping

Open the <HYBRIS_HOME>/hybris/config/local.properties file using a text editor, and the following key properties.

website.electronics.http=http://electronics.local:9001/trainingstorefront
website.electronics.https=https://electronics.local:9002/trainingstorefront

media.electronics.http=http://electronics.local:9001
media.electronics.https=https://electronics.local:9002

2.8. Config host file

Add the following line in your host file, e.g. /etc/hosts.

127.0.0.1 localhost electronics.local

2.9. Initialize Hybris

Run Ant initialize to initialize the databases with data, start syntonization of catalogs and execute indexation…

$ ant initialize
…

BUILD SUCCESSFUL
Total time: 21 minutes 1 second

2.10. Start Hybris server

Start the Hybris server using the following command.

$ ./hybrisserver.sh debug

…

INFO: Server startup in 364642 ms

If everything goes well you should be able to access to : http://electronics.local:9001/trainingstorefront

Electronics accelerator storefront in Hybris

 

5
Leave a Reply

avatar
4 Comment threads
1 Thread replies
4 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
JamesMohamed BELMAHIOjus KapoorMouad EL FakirAnna Nikonova Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of
Anna Nikonova
Guest
Anna Nikonova

Perfect! Thanks for such a detailed guide!

Ojus Kapoor
Guest
Ojus Kapoor

Hello!
Can we install and run hybris on MacBook Air with 4GB RAM and i5 (late 2013 model).
I know it requires 8GB RAM for windows PC but not sure about MacOS.

Thanks very much for your reply.

Mohamed BELMAHI
Admin
Mohamed BELMAHI

Post is updated, tutorial works fine with hybris 6.7.0.9

James
Guest

Very useful! Can we have multiple accelerators installed on a single Hybris system? Just curious,