Monday 7 March 2016

Create new store (website) using Hybris

In Hybris yaccelerator is a default out-of-box store but we want to create our own  by using Hybris multi-channel suite.Required to follow below steps for the same

Step1:- Go to cmd and hybris bin plateform directory and type >ant modulegen

Step2:- Choose extension template accelerator

Step 3:- Enter store name .Here given store name  "azmat"

Step 4:-  Enter package name.Here given package name "com.azmat"


After performing all above step , Below seven extension gets
(1)  azmatcockpits
(2)  azmatcore
(3)  azmatfacades
(4)  azmatfulfilmentprocess
(5)  azmatinitialdata
(6)  azmatstorefront
(7)  azmattest




Step 5:- Add all newly created extension to C:\dv\hybris\config/localextensions.xml

Step 6:- Do all the below step
              (a) Run ant clean all
              (b) Start the Hybris Server
              (c) Initialize extension from Hybris management console
              (d) Hit the URL http://localhost:9001/azmatstorefront/?site=apparel-uk



Some analysis from code perspective:-

Here are example:-
 Example 1:-
When we hit the URL http://localhost:9001/azmatstorefront/?site=apparel-uk , above given page gets displayed(Refer # home page). If we want to figure out which controller gets called

                When we hit this URL. 

   Step A:-   Refer blow entry in azmatstorefront\web\webroot\WEB-INF\config\spring-mvc-config.xml

                   <util:map id="defaultPreviewUrlResolverPageMappings">
                                <entry key="homepage" value="/"/>
                                <entry key="cartPage" value="/cart"/>
                                <entry key="search" value="/search"/>
                                <entry key="searchEmpty" value="/search"/>
                                <entry key="account" value="/my-account"/>
                  </util:map>

           Step B:-  Search text (@RequestMapping("/"))for the home page , By this way we  can get                               controller name. In this case coming  HomePageController.java
            From the controller, we can get information about page view .

Example 2:-
On  click of button “ADD TO BAG”, URL /azmatstorefront/en/cart/add gets called . For the same search for the text (“/cart/add”). In this case controller name is coming AddToCartController.java