Tuesday, February 28, 2017

HTTP2 Support in Apache HTTP Server

The http2 support is there from Apache Http Server 2.4.17 or higher with the help of mod_http2 module
Once http server is enabled with http2 it can serve hybris that is running on an http 1.1 protocol so that the end user always get the http2 protocol. Apche can be front end with any web application via following the blog HTTP Server mod_jk configuration to load balance Tomcat instances
Steps to enable http2 protocol are given below
  • Load the http2 module via adding the following lines in httpd.conf file
         LoadModule http2_module modules/mod_http2.so
  • Add the protocol h2 in VirtualHost for ssl  virtual host area(assumption:already ssl is enabled)
         <VirtualHost *:443>
             ......
             Protocols h2 http/1.1
             .........
        </VirtualHost
Restart the http server and access the ssl page so that you can see the server is enabled with http2

HTTP2 Support in Tomcat

From Tomcat version 9 on wards the server support http2
Http2 protocol works only on the ssl pages and hence need to enable ssl in tomcat first via doing the following steps
Create the ssl certificate openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out ../conf/localhost.crt -keyout ../conf/localhost.key -config ../conf/openssl.cnf
Add the following session in the server.xml file
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/certificate/localhost.key"
                         certificateFile="conf/certificate/localhost.crt"
                          type="RSA" />
        </SSLHostConfig>
    </Connector>
Restart the server and go to https://localhost:8443/ the protocol used is http2
To check whether the server is returning back using http2 the following methods can be applied
  • Go to the tomcat's access log file and you can see "GET / HTTP/2.0" 200
  • Open chrom's developer tool and right click on the header and select protocol as well in the network tab. The protocol column shows h2 instead of http/1.1 

  • Install the chrome http2/SPDY plugin to check whether the site supports http2

Monday, February 27, 2017

HTTP Server mod_jk configuration to load balance Tomcat instances in Hybris

The following configuration can be applicable to any web application that is running in tomcat proxied with Apache http server

Assumption is that already ssl is enabled in Apache refer the blog  HTTP Server Proxy Configuration for Hybris
Download the mod_jk module for the corresponding OS from http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/
Put the mod_jk.so file in the modules directory of
Create a file named workers.properties in the conf directory of apache with the following contents
worker.list=loadbalancer
worker.loadbalancer.port=8009
worker.loadbalancer.host=electronics.local
worker.loadbalancer.type=ajp13
If you are having two servers that you need to load balance then the contents of workers.properties is given below
worker.list=loadbalancer,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=node1.electronics.local
worker.node1.type=ajp13
worker.node1.ping_mode=A
worker.node1.lbfactor=1
# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.port=8009
worker.node2.host=node2.electronics.local
worker.node2.type=ajp13
worker.node2.ping_mode=A
worker.node2.lbfactor=1
# Load-balancing behavior
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.sticky_session=1
# Status worker for managing load balancer
worker.status.type=status

Add the following to the httpd.conf file
LoadModule jk_module modules/mod_jk.so
<IfModule jk_module>
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogStampFormat "[%b %d %Y - %H:%M:%S] "
JkRequestLogFormat "%w %V %T"
JkLogLevel info
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

<Location /*/WEB-INF/*>
deny from all
</Location>

JkMount / loadbalancer
JkMount /* loadbalancer
</IfModule>
 Add the following to the node that is there in httpd-ssl.conf file
JkMount /* loadbalancer
Open the tomcat's server.xml and add/change the AJP connector port with the following
<Connector protocol="AJP/1.3" port="8009" proxyPort="80" redirectPort="443" useIPVHosts="${tomcat.ajp.useipv}" connectionTimeout="10000" keepAliveTimeout="10000" /> 
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node1">
jvmRoute="node1" will add node1 to the jsessionid so that the request can be correctly identified from which node it is coming from
Restart http server
Restart tomcat
Open the following urls(assumption is that electronics.local is already mapped to the host file)

HTTP Server Proxy Configuration for Hybris

The following configuration can be applicable to any web application that is running in tomcat proxied with apache http server. But mod_jk perform better than http proxy and mod_jk provide more flexibility than http proxy

The following step to access electronics store and admin tools using apache http server
Uncomment the following modules from the httpd.conf file
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Enable https via uncommenting the followin from httpd.conf file
Include conf/extra/httpd-ssl.conf
LoadModule ssl_module modules/mod_ssl.so
Generate ssl certificate via running the command
\bin>openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out ../conf/server.crt -keyout ../conf/server.key -config ../conf/openssl.cnf
The file httpd-ssl.conf file is having reference to the conf/server.crt and conf/server.key files
Add the following lines to httpd-ssl.conf file
SSLProxyEngine on
Add the following lines to httpd.conf file
ProxyPass         /  https://electronics.local:9002/
ProxyPassReverse  /  https://electronics.local:9002/
ProxyPass         /hmc  http://localhost:9001/hmc
ProxyPassReverse  /hmc  http://localhost:9001/hmc
ProxyPass         /mcc  http://localhost:9001/mcc
ProxyPassReverse  /mcc  http://localhost:9001/mcc
ProxyPass         /backoffice  http://localhost:9001/backoffice
ProxyPassReverse  /backoffice  http://localhost:9001/backoffice
Open the tomcat's server.xml and add proxyPort="80" to the node for 9001 and proxyPort="443" for 9002
Restart http server
Restart tomcat
Open the following urls(assumption is that electronics.local is already mapped to the host file)
https://electronics.local/theworksstorefront/electronics/en/
http://electronics.local/hmc

Thursday, February 23, 2017

Solr Clustering and Replication in Hybris

Steps to create a solr cluster

  • Make the following properties to make sure that the solr server does not start when hybris started

           solrserver.instances.default.autostart=false

           solrserver.instances.standalone.autostart=false

  • Copy the contents of directory hybris\bin\ext-commerce\solrserver\resources\solr to master, slave1 &amp; slave2
  • Make the following change in the file master\server\solr\configsets\default\conf\solrconfig.xml

<requestHandler name="/replication" class="solr.ReplicationHandler" > 

<lst name="master">

<str name="replicateAfter">commit</str>
<str name="replicateAfter">startup</str>
<str name="confFiles">schema.xml,stopwords.txt</str>

</lst>

</requestHandler > 

  • Make the following change in the file slave1\server\solr\configsets\default\conf\solrconfig.xml &amp; slave2\server\solr\configsets\default\conf\solrconfig.xml

<requestHandler name="/replication" class="solr.ReplicationHandler" > 

<lst name="slave">


<str name="masterUrl">http://localhost:18984/solr/${solr.core.name}/replication</str>
<str name="pollInterval">00:00:60</str>


</lst>

</requestHandler> 

  • Go to master\bin directory and start the master solr server giving the command solr.cmd/solr.sh start -p 18983
  • Go to slave1\bin directory and start the slave solr server giving the command solr.cmd/solr.sh start -p 18984
  • Go to slave2\bin directory and start the slave solr server giving the command solr.cmd/solr.sh start -p 28984
  • Update the Solr server configuration using the Back office Administration Cockpit

 

The most important attributes you should consider are:

 

    • Mode: set it to standalone.
    • Endpoint URLs: should contain a single master URL with the the following values http://:18983/solr and list of slave urls http://:18984/solr, http://:28984/solr

 

Points to Note

 

  • When you are adding a new solr cluster slave to the cluster after making the changes in the SolrConfiguration from the back office you can do a reindex so that the new added node will be having the solr index details copied otherwise the cores from master will not be copied to the newly added slave.
  • Apache Solr does not have a built-in security mechanism. As a consequence, any Solr server must not be reached from the outside world and hence must be placed in a DMZ behind a firewall.
  • There are 4 solr index operations and the IndexType object contains the different index queries
    • FULL: recreates the index, all items will be indexed based on a FULL index query;
    • UPDATE: updates some documents in the index. Items to be indexed/updated are typically selected by an UPDATE query;
    • PARTIAL_UPDATE: similar to the UPDATE operation but allows to select the fields to be updated (for faster updates);
    • DELETE: deletes documents from the index. Items to be deleted are typically selected by a DELETE query.
  • There are 2 indexing mode for the FULL Operation
    • DIRECT: indexing occurs directly on the live index. New and updated documents are marked and old ones are removed after a successful operation;
    • TWO_PHASE: indexing occurs on a temporary index. After a successful operation, the temporary index replaces the current live one.

Tuesday, February 21, 2017

Hybris - Promotions

The following are the list of OOB promotion in hybris
Order level
  • Order threshold Change delivery mode - eg. Get free next day delivery when u spend 100 or more
  • Order threshold fixed discount - eg. Get 50 discount when you spend 200
  • Order threshold free gift - eg.Get a free product when you spend 200
  • Order threshold free voucher -eg. Get a $5 voucher when you spend 200
  • Order threshold perfect partner - Get a product for a specific price when you spend 200
Product Level
  • Bundle - Buy product a, b & c together for a specific price 
  • BOGO - Buy one Get one free
  • Fixed Price - Fixed price for product/category
  • Multi Buy - Buy any 3 for fixed price 
  • Percentage Discount - 15% off for product
  • One to one perfect partner - Buy X and Y together for $50
  • Perfect Partner - Buy X and Y together and get Y for fixed price
  • Perfect Partner Bundle - Buy X together with n number of Y together for $50
  • Stepped Multi-buy - Buy any 3 for $30, buy 4 for $35,buy 5 for $50
Steps to create and activate a promotion
  • Using hmc the business user will be able to create any of the above promotions
  • Open hmc
  • Select Marketing->Promotions
  • Right click on Promotions and press the context menu Create
  • That will give all the above promotions as context menu
  • Select the type of the promotion from the menu to create
  • That will open the promotion edit screen
  • Enter the details with enable check box as true
Step to Create a new Promotion Type(https://wiki.hybris.com/pages/viewpage.action?pageId=294094365)
  • Create the promotion type xml definition 
  • Create the property file for localization
  • Run ant all will generate the jalo classes. In the ant console you will get an error because of missing abstract method implementation
  • You need to implement evaluate and getResultDescription abstract methods
  • Evaluate method contains the evaluation logic and getResultDescription returns message fired or message could have fired
  • Ant all to build the environment
  • Using admin console do an update
  • Now if you are opening hmc you will be able to see the new promotion type

Change Context root of the Store in Hybris

  1. Go to the storefront's extensioninfo.xml file and change the following entry 
  2. The following entries in the project.properties files in the store front extension
    samplestorefront.webroot=/samplestorefront
    storefrontContextRoot=/samplestorefront
    website.apparel-uk.http=http://apparel-uk.local:9001/samplestorefront
    website.apparel-uk.https=https://apparel-uk.local:9002/samplestorefront
    or
    website.apparel-uk.http=http://localhost:9001/samplestorefront?site=apparel-uk
    website.apparel-uk.https=https://localhost:9002/samplestorefront?site=apparel-uk

Step-by-Step installation of JRebel for Hybris


  • Download the current version of JRebel here: http://www.zeroturnaround.com/jrebel/current/ (Select the Generic ZIP archive version, as we are not going to use the installer.)
  • Extract the zip to a directory of your choice. This manual will refer to this directory as JREBEL_HOME(say C:/jrebel) directory
  • Create a conf directory inside the JREBEL_HOME directory Download the JRebel configuration property file : jrebel.properties (attaching the contents of the file here )to the JREBEL_HOME/conf directory
  • To install JRebel for Eclipse, open the Eclipse Marketplace Client (Help -> Eclipse Marketplace…). Select “Eclipse Marketplace” and search for “JRebel”. Then just click the “Install” button next to it. (Installation steps are there in http://www.zeroturnaround.com/jrebel/eclipse-jrebel-tutorial/ )
  • Select features and finishing the Install Process
  • After restarting the IDE, if you do now have JRebel license installed yet, the plugin will notify you about registration/acitvation. Click on the link in the red pop-up and proceed with the license setup. By clicking on the link the plugin will take you to the JRebel activation window where you will have to select which license you would like to apply for
  • Place the license in the activation text area and press evaluate
  • Enable “Build Automatically” mode in eclipse
  • Right click on the project and select the context menu JRebel->Add JRebel Nature for all the projects where you are planning to create/change classes. For eg. samplecore & samplestorefront
  • Open project.properties file in the platform folder and add the(-javaagent:"C:/jrebel/jrebel.jar=de.hybris.tomcat.HybrisWebappClassLoader60" -Drebel.log=true) to the tomcat.debugjavaoptions & tomcat.generaloptions. That means that you now got the following in the file
          tomcat.debugjavaoptions=-Xverify:none -      javaagent: "C:/jrebel/jrebel.jar =   
         de.hybris.tomcat.HybrisWebappClassLoader60" -Drebel.log=true -Xmx1G -Xdebug 
         -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n

         tomcat.generaloptions=-Xverify:none -javaagent:"C:/jrebel/jrebel.jar= 
        de.hybris.tomcat.HybrisWebappClassLoader60" -Drebel.log=true -Xmx1G 
        -XX:MaxPermSize=300M -ea -Dcom.sun.management.jmxremote 
        -Dcom.sun.management.jmxremote.authenticate=false 
        -Dcom.sun.management.jmxremote.ssl=false 
        -Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true 
        -Djava.endorsed.dirs="%CATALINA_HOME%/lib/endorsed" 
        -Dcatalina.base=%CATALINA_BASE% -Dcatalina.home=%CATALINA_HOME% 
        -Dfile.encoding=UTF-8 -Dlog4j.configuration=log4j_init_tomcat.properties 
        -Djava.util.logging.config.file=jdk_logging.properties 
        -Djava.io.tmpdir="${HYBRIS_TEMP_DIR}"
  • Restat the hybris server

New Addon creation in Hybris

Steps for creating a new addon
Run ant extgen
Select yaddon as the template and provide a name (name should be followed by word ‘addon’. Eg: testaddon)
Give the package name (eg: org.test)
Add on will be created, and follow the below steps
Add the entry to the localextensions.xml file
Copy testaddon-web-spring.xml from web/webroot/WEB-INF to resources\testaddon\web\spring\testaddon-web-spring.xml to resolve classpath issue
Rename the project.properties in the custom/testaddon directory to project.properties.template
Add the following line to the project.properties.template files
tpinkstorefront.additionalWebSpringConfigs.testaddon=classpath:/ testaddon /web/spring/ testaddon -web-spring.xml
Add/Uncomment the entry if it is already not there
Run the below command to install add on to storefront(let the storefront extension name be samplestorefront )
ant addoninstall -Daddonnames="testaddon" -DaddonStorefront.yacceleratorstorefront="samplestorefront"
This will create an entry of the addon, in the extensioninfo.xml of samplestorefront
Ant clean all, and restart server

Instructions to copy files that need modification to new addon
All the front end related files (controllers, constants, jsps, tag files etc) that need modification related to a particular functionality will go inside the path “testaddon\acceleratoraddon” inside respective folders, and will be copied to samplestorefront after a build
All other files to be modified (facades and services)will go inside the path “testaddon\src” folder
In case of moving jsp/tag files from samplestorefront to addon, we should move any file including these jsp files also to addon and give the new path created in samplestorefront for the included files
Add addonsupport extension , and any other dependent extensions, in extension info for new addon, and also in eclipse, and correct build errors of the new files copied
Remove the entry of any unwanted add-on from extensioninfo.xml of samplestorefront for removing the reference to old addons
For redirecting to the new controllers copied in addon(over writing), we need to give entry in resources\testaddon\web\spring\testaddon-web-spring.xml
For redefining beans, need to give entries in resources\testaddon-spring.xml

Step-by-Step Instructions to create a new theme in Hybris


  • Create a new theme directory in the store front project’s web/webroot/_ui/desktop with name theme- for eg. theme-orange. Or you can copy an existing theme directory and modify it
  • Create web/webroot/WEB-INF/messages/theme--desktop.properties file and add all the image names. See an existing theme property to find the property key values
  • Register the theme in the db via impex files(themes.impex & themes_en.impex) in the directory resources//import/common/ which is there in the core project
  • To add stylesheets for some google webfonts, modify web/webroot/WEB-INF/tags/desktop/template/styleSheets.tag to add a link to some nicer font (just before the last tag in the file): for eg.
          <%-- google webfonts --%>
          <link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
          <cms:previewCSS cmsPageRequestContextData="${cmsPageRequestContextData}" />
  • Change CSS file web/webroot/_ui/desktop/theme-/css/changes.css to use the above font(Lato)
  • Update essentialdata or import the two impex files from above manually in the hac
  • After update go to hmc
  • Select WCMS/website
  • Select the site
  • Change the theme to new value
  • Open the storefront file in a browser and you can see the new theme applied

Hotfolder Data Importing in Hybris

The following property values refers to the import and export directories

acceleratorservices.batch.impex.basefolder=${HYBRIS_DATA_DIR}/acceleratorservices/import
acceleratorservices.export.basefolder=${HYBRIS_DATA_DIR}/acceleratorservices/export

The following are the default file name conventions(--.csv

base_product-.csv(base_product-en-1.csv,base_product-en-2.csv etc..)
stock-.csv
price-.csv
merchandise-.csv
media-.csv
customer-.csv
external_tax- .csv

Deconstructing the electronics store hot folder configuration
The hot folder configurations are there in the files hot-folder-store-electronics-spring.xml and hot-folder-spring.xml files.

  1. First step to configure the hot folder details are there(hot-folder-store-electronics-spring.xml) in the inbound-channel-adapter(with id batchFilesElectronics) and that contains the polling interval and the file pattern.
  2. The second step(hot-folder-store-electronics-spring.xml) is to define the outbound-gateway with request channel as the inbound channel adapter id from pervious step (batchFilesElectronics)
  3. The third step(hot-folder-store-electronics-spring.xml) is to configure the service-activator with input channel that is defined in the outbound-gateway's reply-channel(batchFilesElectronicsProc) and output-channel as the batchFilesHeaderInit which is defined in the hot-folder-spring.xml file. Check the hot-folder-spring.xml file for other sequences. Each steps output will be the input for the next step

<file:inbound-channel-adapter id="batchFilesElectronics" directory="#{baseDirectoryElectronics}"
filename-regex="^(.*)-(\d+)\.csv" comparator="fileOrderComparator">
<int:poller fixed-rate="1000" />
</file:inbound-channel-adapter>

<file:outbound-gateway request-channel="batchFilesElectronics" reply-channel="batchFilesElectronicsProc"
directory="#{baseDirectoryElectronics}/processing" delete-source-files="true" />
<int:service-activator input-channel="batchFilesElectronicsProc" output-channel="batchFilesHeaderInit"
ref="electronicsHeaderSetupTask" method="execute" />
<bean id="electronicsHeaderSetupTask" class="de.hybris.platform.acceleratorservices.dataimport.batch.task.HeaderSetupTask">
<property name="catalog" value="electronicsProductCatalog" />
<property name="net" value="false" />
<property name="storeBaseDirectory" ref="baseDirectoryElectronics" />
</bean>

<int:service-activator input-channel="batchFilesHeaderInit" output-channel="batchFilesHeader" ref="headerInitTask"
method="execute" />
<bean id="headerInitTask" class="de.hybris.platform.acceleratorservices.dataimport.batch.task.HeaderInitTask">
<property name="sequenceIdParser" ref="batchSequenceIdParser"/>
<property name="languageParser" ref="batchLanguageParser"/>
<property name="fallbackLanguage" value="en" />
</bean>
<int:service-activator input-channel="batchFilesHeader" output-channel="batchFilesTran" ref="batchTransformerTask"
method="execute" />
<bean id="batchTransformerTask"
class="de.hybris.platform.acceleratorservices.dataimport.batch.task.ImpexTransformerTask"
init-method="initConvertersMap">
<property name="fieldSeparator" value="," />
<property name="encoding" value="UTF-8" />
<property name="linesToSkip" value="0"/>
<property name="cleanupHelper" ref="cleanupHelper" />
</bean>
<int:service-activator input-channel="batchFilesTran" output-channel="batchFilesImp" ref="batchRunnerTask"
method="execute" />
<bean id="batchRunnerTask" class="de.hybris.platform.acceleratorservices.dataimport.batch.task.AbstractImpexRunnerTask">
<property name="sessionService" ref="sessionService" />
<property name="importService" ref="importService" />
<lookup-method name="getImportConfig" bean="importConfig" />
</bean>
<int:service-activator input-channel="batchFilesImp" ref="batchCleanupTask" method="execute" />
<bean id="batchCleanupTask" class="de.hybris.platform.acceleratorservices.dataimport.batch.task.CleanupTask">
<property name="cleanupHelper" ref="cleanupHelper" />
</bean>


The inbound-channel-adapter represents the org.springframework.integration.file.FileReadingMessageSource class. Each 1000 milliseconds the receive() method will be called and the following sequence will be called in the following sequence

file:inbound-channel-adapter id="batchFilesElectronics"
file:outbound-gateway request-channel="batchFilesElectronics" reply- channel="batchFilesElectronicsProc"
int:service-activator input-channel="batchFilesElectronicsProc" output-channel="batchFilesHeaderInit"
int:service-activator input-channel="batchFilesHeaderInit" output-channel="batchFilesHeader"
int:service-activator input-channel="batchFilesHeader" output-channel="batchFilesTran"
int:service-activator input-channel="batchFilesTran" output-channel="batchFilesImp"
int:service-activator input-channel="batchFilesImp" ref="batchCleanupTask"

Wednesday, February 15, 2017

Adding a new basic attribute to solr and show that in Hybris storefront end

Add the attribute to the product via changing the items.xml file
Build and update the system to generate the persistence details of the new added attribute
Add the new attribute to SolrIndexedProperty via impex
Add the value of the added attributes for the products using impex
Add the newly added property to the product DTO (ProductData) via changing the facades-beans.xml file
Do a build
Update the populator class(*ProductPopulator) to populate the new attribute to ProductData dto
Change the productDetailsPanel.tag file to show the new attribute in the front end
Build and update the system
Run the build index operation and now the new added attribute is available in the search pages of the storefront

Making a product as hero product in Hybris

The hero product works only for the category search profile not for the free text search profile.
Go to backoffice and select the commerce search perspective
Select a category from the categories box, the products belongs to the category will be shown in result list area with greyed star against each product
Click on the grey star of the product that we need to make it as hero product
Go to the storefront and select the category, we can see that the hero prouduct is coming as top
For achieving this hybris add the bq=(code_string:^1000000.0) to the solr query 
The solr log will be there in the solrserver\resources\solr\server\logs\solr.log file to see the solr query

Tuesday, February 14, 2017

Advanced personalisation in Hybris

Via enabling the advanced personalisation feature there can be a performance degradation in the site depends on the configuration
Personalisation is achieved with the help of the following extensions
   btg - for personalisation
   btgcockpit - for personalisation management via WCMS cockpit
It can be enabled with the help of storefront.btg.enabled property. Upto version 6.0 the extensions are included as part of base accelerator and enabled but the btgcockpit extension is not included.
Along with the above, the following changes need to be added to the web.xml

BTGSegmentFilter
de.hybris.platform.store.web.servlets.BTGSegmentFilter

       
BTGSegmentFilter
/view/*

From version 6.1 onwards btg is not coming up as default feature instead it provided as an add on named b2cbtgaddon
The customer segments can be viewed and edited using the Customer Segment perspective in WCMS cockpit

Step by Step
  1. Open the WCMS Cockpit with Advanced Personalization tool(localhost:9001/cmscockpit)
  2. Select the Customer Segments link from the top left corner (Customer segments normally contains a rules and output action)
  3. Create a new customer segment with name Viewed Beacon Jacket 300441355
    1. Select the catalog version as the staging catalog
    2. Select the store as Apparel Site UK
    3. Select the scope as (Session(D)/Persistent)
    4. Select the mode(Optimized Processing(D)/Full Processing)
  4. Now you will see the Customer segment screen
  5. Add a Customer Segement rule via pressing the + button on right hand side of the Customer Segment Rules session in the screen
    1. Select the type of the Rule(Order Rule/Cart/Customer/Website). We are selecting Website rule
    2. Select the left operand type as 'Has Viewed Products' from first combo box and choose operator as 'contains any'  from second combo box and  type '300441355' in the product text box and select the staging version of the product and press next and press done
  6. Next step is to add the output action
    1. Press the + button on the right hand side of the Output Actions session in the screen
    2. You can select the action(Add user to Group/Show or hide a WCMS Item). We are selecting Show or hide a WCMS Item
    3. Type Mini Cart - APP-S in in the WCMS Component and press next
    4. Select the 'should not see this WCMS Component' radio button and press next and done
  7. Press the Customer Segments Tab and you will see the newly created customer segement
  8. This is created in the staging area and press the synchronize button(a red button just left above to the customer segment) to synchronize the catalog
  9. Once you press synchronize the system create another customer segment on online version
  10. Now go to front end and select any product or any other page. You will see the mini basket
  11. As soon as you press the Glazier jacket product view the min basket component disappear from the page

Visibility of a product for a customer in Hybris store front

The product will be visible only after finishing and satisfying the following valdiations

  1. Catalog url pattern matches
  2. Catalog version active
  3. Category visibility
  4. Date range matches
  5. Product approved(check and unapproved product will not be shown)

Step 1 & 2 will be checked at the start of the session and all other steps are checked on each mouse click

Creating a new Store in Hybris


  • Using modulegen create the corresponding accelerator module (For eg. if we are choosing the b2caccelerator).
  • The above step creates the customised extension for yacceleratorcore,yacceleratorfacade,yacceleratorinitialdata,yacceleratorstorefront,yacceleratortest and yacceleratorcockpit
  • Apparelstore and electronicstore extensions hold the sample store data. We could remove these extensions if we don't need them
  • Identify the changes required in the existing hybris product model for the customer's product model. Apply the changes in the items.xml file from the core extension
  • Create the impex script for product catalog, catalog versions, category taxonomy, classification structure(if applicable) etc. and put it in the initialdata extension
  • Configure solr index