Overview
In this step we are going to create a completely new storefront.
Create the accelerator code base for the project
The accelerator templates are delivered as source code. When you develop a project using the accelerator you actually change this code.
Instead of changing it directly, the correct way to work is to separate your project code base from that of the accelerator. To do this we replicate
the yaccelerator* extensions into our project namespace. In this trail we are developing a merchandise shop, so we will adapt the code base
using modulegen.
Stop the server. Run 'modulegen' task from your platform build.xml: ant modulegen
<span style="color:#333333;">modulegen: [input] [input] Please choose a template for generation. [input] Press [Enter] to use the default value ([accelerator], b2baccelerator, telcoaccelerator, commercewebservices) accelerator [input] [input] Please choose the name of your module extension. It has to start with a letter followed by letters and/or numbers. [input] Press [Enter] to use the default value [training] merchandise [input] [input] Please choose the base package name of your extensions. It has to fulfill java package name convention. Each extension in the module will add its name to this package. [input] Press [Enter] to use the default value [org.training] de.hybris.merchandise
All steps in this trail assume that you have chosen de.hybris.merchandise package in above step therefore all code snippets
attached to followingtrail pages have this package included.
If you've chosen different package then it's great! You will learn much more by investigating carefully the attached code snippets but
at the same time this trail will take you more time.
After this step you should have 7 custom extensions in custom folder, that have been adopted to your project's namespace.
<pre name="code" class="html">/custom/merchandise/merchandisecockpits
/custom/merchandise/merchandisecore
/custom/merchandise/merchandisefacades
/custom/merchandise/merchandisefulfilmentprocess
/custom/merchandise/merchandiseinitialdata
/custom/merchandise/merchandisestorefront
But with one exception! Please don't add the merchandisetest extension to localextensions.xml -- in version 5.7.0.3, it contains a large data set for example storefronts (electronics and apparel) which would significantly lengthen the time needed for initialization. So removing it from localextensions.xml will save you a lot of time during the entire commerce trail.
It's more convenient to add extension by name rather than by dir (as instructed in the modulegen output above).
...
<extension name="merchandisestorefront" />
<extension name="merchandiseinitialdata" />
<extension name="merchandisecockpits" />
...
After the build is complete, your hybris/config/localextensions.xml extension listing would be like this:
config/localextensions.xml
<hybrisconfig xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='../bin/platform/resources/schemas/extensions.xsd'>
<extensions>
<path dir='${HYBRIS_BIN_DIR}' autoload='false' />
<extension name='mcc' />
<extension name='backoffice' />
<extension name='commercesearchbackoffice' />
<extension name='commerceservicesbackoffice' />
<extension name='solrfacetsearchbackoffice' />
<extension name='solrserver' />
<extension name='yacceleratorcockpits' />
<extension name='yacceleratorinitialdata' />
<extension name='yacceleratorfulfilmentprocess' />
<extension name='yacceleratorstorefront' />
<extension name='yaddon' />
<extension name='ycommercewebservices' />
<extension name='electronicsstore' />
<extension name='apparelstore' />
<extension name='liveeditaddon' />
<extension name='acceleratorwebservicesaddon' />
</extensions>
</hybrisconfig>
Now we will configure localextensions.xml file for this trails needs. We should remove the y extentions
(except yaddonandycommercewebservices) and add the merchandise extensions (except merchandisetestextension). Edit hybris/config/localextensions.xml and copy over the following content:
config/localextensions.xml
<hybrisconfig xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='../bin/platform/resources/schemas/extensions.xsd'>
<extensions>
<path dir='${HYBRIS_BIN_DIR}' autoload='false' />
<extension name='mcc' />
<extension name='backoffice' />
<extension name="btg"/>
<extension name="btgcockpit"/>
<extension name='commercesearchbackoffice' />
<extension name='commerceservicesbackoffice' />
<extension name='solrfacetsearchbackoffice' />
<extension name='solrserver' />
<extension name='yaddon' />
<extension name='ycommercewebservices' />
<extension name='liveeditaddon' />
<extension name='acceleratorwebservicesaddon' />
<!-- custom-ext -->
<extension name='merchandisecore'/>
<extension name='merchandisefacades'/>
<extension name='merchandisestorefront'/>
<extension name='merchandisefulfilmentprocess'/>
<extension name='merchandiseinitialdata'/>
<extension name='merchandisecockpits'/>
</extensions>
</hybrisconfig>
We can define a custom webroot for the store, since store is easier to read and type than merchandisestorefront.
Modify this in/merchandisestorefront/extensioninfo.xml
.
local.properties
to override properties defined in merchandisestorefront:
Now rebuild the code base (ant clean all
) and restart the hybris server. Navigate to http://localhost:9001 then Platform -> Update and do a project data update on the merchandise core extension, as shown in the following screenshot: