Publishing B2C Store in Hybris 5.6

Publishing B2C Store in Hybris 5.6
Publishing B2C Store in Hybris 5.6

Publishing B2C Store in Hybris 5.6

Synopsis

This blog post summarizes the steps involved in publishing an OOB B2C electronic accelerator (starter store) on hybris 5602 commerce suite, It
further describes the steps to publish a customized version of the store based on the OOB B2C Accelerator code template.

Setup and Build

Unzip the file to your preferred local folder and execute following from command prompt.
cd ~/hybris/bin/platform
. ./setantenv.sh
ant clean all
….
[input]  Press [Enter] to use the default value ([develop], production)
develop
all:
     [echo] Build finished on 3-October-2015 09:34:54.
     [echo]        
BUILD SUCCESSFUL
Total time: 43 seconds

At the end of this step you have a hybris commerce suit built using development template.

Setting up localextensions.xml

Unlike previous versions, localextensions.xml generated with development template is empty by default, you need to add the extensions that are relevant for your project.
Here is a sample localextensions.xml for publishing OOB B2C electronic store
  1. <?xml version=“1.0” encoding=“UTF-8”?>  
  2. <hybrisconfig xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“resources/schemas/extensions.xsd”>  
  3.     <extensions>  
  4.         <!–  
  5.                 All extensions located in ${HYBRIS_BIN_DIR}/platform/ext are automatically loaded.  
  6.                 More information about how to configure available extensions can be found here : https://wiki.hybris.com/x/nZVzC  
  7.         —>  
  8.                    
  9.         <path dir=“${HYBRIS_BIN_DIR}” />  
  10.                                  
  11.         <!– ext-platform –>  
  12.         <extension name=“admincockpit” />  
  13.         <extension name=“backoffice” />  
  14.         <extension name=“cockpit” />  
  15.         <extension name=“hmc” />  
  16.         <extension name=“mcc” />  
  17.         <extension name=“platformhmc” />  
  18.                                            
  19.         <!– ext-platform-optional –>  
  20.         <extension name=“ldap” />  
  21.         <extension name=“lucenesearch” />  
  22.         <extension name=“virtualjdbc” />  
  23.                                            
  24.         <!– ext-cockpit –>  
  25.         <extension name=“reportcockpit” />  
  26.                                            
  27.         <!– ext-commerce –>  
  28.         <extension name=“btg” />  
  29.         <extension name=“btgcockpit” />  
  30.         <extension name=“commercesearch” />  
  31.         <extension name=“commercesearchbackoffice” />  
  32.         <extension name=“commercesearchhmc” />  
  33.         <extension name=“commerceservices” />  
  34.         <extension name=“basecommerce” />  
  35.         <extension name=“payment” />  
  36.         <extension name=“promotions” />  
  37.         <extension name=“voucher” />  
  38.         <extension name=“customerreview” />  
  39.         <extension name=“ticketsystem” />  
  40.         <extension name=“solrfacetsearch” />  
  41.         <extension name=“solrfacetsearchhmc” />  
  42.         <extension name=“oci” />  
  43.         <extension name=“wishlist” />  
  44.         <extension name=“commercefacades” />  
  45.         <extension name=“commercewebservicescommons” />  
  46.                                       
  47.         <!– ext-content –>  
  48.         <extension name=“productcockpit” />  
  49.         <extension name=“cms2” />  
  50.         <extension name=“cms2lib” />  
  51.         <extension name=“cmscockpit” />  
  52.         <extension name=“bmecat” />  
  53.         <extension name=“bmecathmc” />  
  54.         <extension name=“importcockpit” />  
  55.         <extension name=“classificationsystems” />  
  56.         <extension name=“classificationsystemshmc” />  
  57.                                     
  58.         <!– ext-channel –>  
  59.         <extension name=“cscockpit” />  
  60.         <extension name=“mobileoptionals” />  
  61.         <extension name=“mobileservices” />  
  62.                                    
  63.         <!– ext-addon –>  
  64.         <extension name=“addonsupport” />  
  65.         <extension name=“b2ccheckoutaddon” />  
  66.   
  67.         <!– ext-print –>  
  68.         <extension name=“print” />  
  69.         <extension name=“printcockpit” />  
  70.         <extension name=“printhmc” />  
  71.   
  72.         <!– ext-template –>  
  73.         <extension name=“ycommercewebservices” />  
  74.         <extension name=“ycommercewebserviceshmc” />  
  75.                                         
  76.         <!– ext-accelerator –>  
  77.         <extension name=“acceleratorservices” />  
  78.         <extension name=“acceleratorfacades” />  
  79.         <extension name=“acceleratorcms” />  
  80.         <extension name=“acceleratorstorefrontcommons” />  
  81.           
  82.           
  83.         <extension name=“yacceleratorinitialdata” />  
  84.     <extension name=“yacceleratorcockpits” />  
  85.     <extension name=“yacceleratorfulfilmentprocess” />  
  86.     <extension name=“yacceleratorcore” />  
  87.     <extension name=“yacceleratorfacades” />  
  88.     <extension name=“yacceleratorstorefront” />  
  89.     <extension name=“electronicsstore” />  
  90.     <extension name=“apparelstore” />  
  91.     <extension name=“yacceleratortest” />  
  92.      
  93.     <extension dir=“${HYBRIS_BIN_DIR}/ext-addon/b2ccheckoutaddon”/>  
  94.     <extension dir=“${HYBRIS_BIN_DIR}/ext-addon/addonsupport”/>  
  95.     <extension dir=“${HYBRIS_BIN_DIR}/ext-content/liveeditaddon”/>  
  96.           
  97.         <extension dir=“${HYBRIS_BIN_DIR}/ext-addon/acceleratorwebservicesaddon”/>  
  98.           
  99.     </extensions>  
  100. </hybrisconfig>  
Perform a Build again
ant build all
./hybrisserver.sh
Got to Hybris Admin console and perform complete initialization
Adding Add On’s necessary for OOB B2C electronic store
# Include Add On
ant addoninstall -Daddonnames=”liveeditaddon” -DaddonStorefront.yacceleratorstorefront=”yacceleratorstorefront”
[echo] Adding addon ‘liveeditaddon’ to extensioninfo.xml for ‘yacceleratorstorefront’
BUILD SUCCESSFUL
If you don’t add this plugin it will result in following error while accessing the yaccelerator store, org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/views/desktop/pages/layout/landingLayout2Page.jsp at line 6
Perform a Build again
ant all
./hybrisserver.sh

Store Initialization

Got to Hybris Admin console and perform following steps.
Platform -> update
select only liveeditaddon and click on update.

Setting up custom Store
ant modulegen -Dinput.module=accelerator -Dinput.name=myb2cstore -Dinput.package=org.mystore
   [echo] Next steps:
     [echo] 
     [echo] 1) Add your extension to your /Users/hvadiv/hybris5602/hybris/config/localextensions.xml
     [echo] 
     [echo] <extension dir=”/Users/hvadiv/hybris5602/hybris/bin/custom/myb2cstore/myb2cstorefulfilmentprocess”/>
     [echo] <extension dir=”/Users/hvadiv/hybris5602/hybris/bin/custom/myb2cstore/myb2cstorecore”/>
     [echo] <extension dir=”/Users/hvadiv/hybris5602/hybris/bin/custom/myb2cstore/myb2cstoreinitialdata”/>
     [echo] <extension dir=”/Users/hvadiv/hybris5602/hybris/bin/custom/myb2cstore/myb2cstorefacades”/>
     [echo] <extension dir=”/Users/hvadiv/hybris5602/hybris/bin/custom/myb2cstore/myb2cstoretest”/>
     [echo] <extension dir=”/Users/hvadiv/hybris5602/hybris/bin/custom/myb2cstore/myb2cstorestorefront”/>
     [echo] <extension dir=”/Users/hvadiv/hybris5602/hybris/bin/custom/myb2cstore/myb2cstorecockpits”/>
     [echo]
     [echo] 2) Remove the following extensions from your /Users/hvadiv/hybris5602/hybris/config/localextensions.xml
     [echo] yacceleratorfulfilmentprocess,yacceleratorcore,yacceleratorinitialdata,yacceleratorfacades,yacceleratortest,yacceleratorstorefront,yacceleratorcockpits
     [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] 
BUILD SUCCESSFUL

Modified localextensions.xml file in my local setup is as follows.
  1. <?xml version=“1.0” encoding=“UTF-8”?>  
  2. <hybrisconfig xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“resources/schemas/extensions.xsd”>  
  3.     <extensions>  
  4.         <!–  
  5.                 All extensions located in ${HYBRIS_BIN_DIR}/platform/ext are automatically loaded.  
  6.                 More information about how to configure available extensions can be found here : https://wiki.hybris.com/x/nZVzC  
  7.         —>  
  8.                    
  9.         <path dir=“${HYBRIS_BIN_DIR}” />  
  10.                                  
  11.         <!– ext-platform –>  
  12.         <extension name=“admincockpit” />  
  13.         <extension name=“backoffice” />  
  14.         <extension name=“cockpit” />  
  15.         <extension name=“hmc” />  
  16.         <extension name=“mcc” />  
  17.         <extension name=“platformhmc” />  
  18.                                            
  19.         <!– ext-platform-optional –>  
  20.         <extension name=“ldap” />  
  21.         <extension name=“lucenesearch” />  
  22.         <extension name=“virtualjdbc” />  
  23.                                            
  24.         <!– ext-cockpit –>  
  25.         <extension name=“reportcockpit” />  
  26.                                            
  27.         <!– ext-commerce –>  
  28.         <extension name=“btg” />  
  29.         <extension name=“btgcockpit” />  
  30.         <extension name=“commercesearch” />  
  31.         <extension name=“commercesearchbackoffice” />  
  32.         <extension name=“commercesearchhmc” />  
  33.         <extension name=“commerceservices” />  
  34.         <extension name=“basecommerce” />  
  35.         <extension name=“payment” />  
  36.         <extension name=“promotions” />  
  37.         <extension name=“voucher” />  
  38.         <extension name=“customerreview” />  
  39.         <extension name=“ticketsystem” />  
  40.         <extension name=“solrfacetsearch” />  
  41.         <extension name=“solrfacetsearchhmc” />  
  42.         <extension name=“oci” />  
  43.         <extension name=“wishlist” />  
  44.         <extension name=“commercefacades” />  
  45.         <extension name=“commercewebservicescommons” />  
  46.                                       
  47.         <!– ext-content –>  
  48.         <extension name=“productcockpit” />  
  49.         <extension name=“cms2” />  
  50.         <extension name=“cms2lib” />  
  51.         <extension name=“cmscockpit” />  
  52.         <extension name=“bmecat” />  
  53.         <extension name=“bmecathmc” />  
  54.         <extension name=“importcockpit” />  
  55.         <extension name=“classificationsystems” />  
  56.         <extension name=“classificationsystemshmc” />  
  57.                                     
  58.         <!– ext-channel –>  
  59.         <extension name=“cscockpit” />  
  60.         <extension name=“mobileoptionals” />  
  61.         <extension name=“mobileservices” />  
  62.                                    
  63.         <!– ext-addon –>  
  64.         <extension name=“addonsupport” />  
  65.         <extension name=“b2ccheckoutaddon” />  
  66.   
  67.         <!– ext-print –>  
  68.         <extension name=“print” />  
  69.         <extension name=“printcockpit” />  
  70.         <extension name=“printhmc” />  
  71.   
  72.         <!– ext-template –>  
  73.         <extension name=“ycommercewebservices” />  
  74.         <extension name=“ycommercewebserviceshmc” />  
  75.                                         
  76.         <!– ext-accelerator –>  
  77.         <extension name=“acceleratorservices” />  
  78.         <extension name=“acceleratorfacades” />  
  79.         <extension name=“acceleratorcms” />  
  80.         <extension name=“acceleratorstorefrontcommons” />  
  81.           
  82.      <extension dir=“${HYBRIS_BIN_DIR}/custom/myb2cstore/myb2cstorefulfilmentprocess”/>  
  83.      <extension dir=“${HYBRIS_BIN_DIR}/custom/myb2cstore/myb2cstorecore”/>  
  84.      <extension dir=“${HYBRIS_BIN_DIR}/custom/myb2cstore/myb2cstoreinitialdata”/>  
  85.      <extension dir=“${HYBRIS_BIN_DIR}/custom/myb2cstore/myb2cstorefacades”/>  
  86.      <extension dir=“${HYBRIS_BIN_DIR}/custom/myb2cstore/myb2cstoretest”/>  
  87.      <extension dir=“${HYBRIS_BIN_DIR}/custom/myb2cstore/myb2cstorestorefront”/>  
  88.      <extension dir=“${HYBRIS_BIN_DIR}/custom/myb2cstore/myb2cstorecockpits”/>  
  89.         <!–extension name=“yacceleratorinitialdata” />  
  90.     <extension name=“yacceleratorcockpits” />  
  91.     <extension name=“yacceleratorfulfilmentprocess” />  
  92.     <extension name=“yacceleratorcore” />  
  93.     <extension name=“yacceleratorfacades” />  
  94.     <extension name=“yacceleratorstorefront” />  
  95.     <extension name=“yacceleratortest” /–>  
  96.   
  97.   
  98.     <extension name=“electronicsstore” />  
  99.     <extension name=“apparelstore” />  
  100.      
  101.     <extension dir=“${HYBRIS_BIN_DIR}/ext-addon/b2ccheckoutaddon”/>  
  102.     <extension dir=“${HYBRIS_BIN_DIR}/ext-addon/addonsupport”/>  
  103.     <extension dir=“${HYBRIS_BIN_DIR}/ext-content/liveeditaddon”/>  
  104.           
  105.         <extension dir=“${HYBRIS_BIN_DIR}/ext-addon/acceleratorwebservicesaddon”/>  
  106.           
  107.     </extensions>  
  108. </hybrisconfig>  
Perform a Build again
ant
./hybrisserver.sh

Store Initialization

Got to Hybris Admin console and perform following steps.
Platform -> update
and start initialization of the new store.
Adding Add On’s necessary for OOB B2C electronic store
ant addoninstall -Daddonnames=”liveeditaddon” -DaddonStorefront.myb2cstorestorefront=”myb2cstorestorefront”
ant all
./hybriserver.sh
Got to Hybris Admin console and perform following steps.
Platform -> update
select only liveeditaddon and click on update.
Temporary Fix
An issue with JSP compilation at runtime while accessing the home page seems to be a defect in 5602 version
Following fix will help resolve this error, watch out for an official fix in the next version
Navigate to generated source code for .\hybris\bin\custom\myb2cstore\myb2cstorestorefront\web\webroot\WEB-INF\common\tld\cmstags.tld
and replace the content with following.
The change is reverting de.hybris.liveeditaddon.cms.tags.LiveeditaddonCMSContentSlotTag back to de.hybris.platform.acceleratorcms.tags2.CMSContentSlotTag.
  1. <?xml version=“1.0” encoding=“UTF-8”?>  
  2.   
  3.   
  4. <taglib xmlns=“http://java.sun.com/xml/ns/javaee”  
  5.         xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”  
  6.         xsi:schemaLocation=“http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd”  
  7.         version=“2.1”>  
  8.   <tlib-version>1.2</tlib-version>  
  9.   <short-name>cms</short-name>  
  10.   <uri>http://hybris.com/tld/cmstags</uri>  
  11.   
  12.   
  13.   <tag>  
  14.   <description>Iterates over the components in a CMS content slot for a position in the current page</description>  
  15.   <name>pageSlot</name>  
  16.   <tag-class>de.hybris.platform.acceleratorcms.tags2.CMSContentSlotTag</tag-class>  
  17.   <body-content>JSP</body-content>  
  18.   <attribute>  
  19.   <description>the position of the content slot in the CMS page</description>  
  20.   <name>position</name>  
  21.   <required>true</required>  
  22.   <rtexprvalue>true</rtexprvalue>  
  23.   </attribute>  
  24.   <attribute>  
  25.   <description>the var name to access the content element</description>  
  26.   <name>var</name>  
  27.   <required>true</required>  
  28.   <rtexprvalue>false</rtexprvalue>  
  29.   </attribute>  
  30.   <attribute>  
  31.   <description>the limit on the number of components to render in this slot</description>  
  32.   <name>limit</name>  
  33.   <required>false</required>  
  34.   <rtexprvalue>true</rtexprvalue>  
  35.   </attribute>  
  36.   <attribute>  
  37.   <description>the HTML element to generate for this slot</description>  
  38.   <name>element</name>  
  39.   <required>false</required>  
  40.   <rtexprvalue>true</rtexprvalue>  
  41.   </attribute>  
  42.   <!– Any other attributes specified are written onto the element –>  
  43.   <dynamic-attributes>true</dynamic-attributes>  
  44.   </tag>  
  45.   
  46.   
  47.   <tag>  
  48.   <description>Iterates over the components in a CMS content slot given the UID of the slot</description>  
  49.   <name>globalSlot</name>  
  50.   <tag-class>de.hybris.platform.acceleratorcms.tags2.CMSContentSlotTag</tag-class>  
  51.   <body-content>JSP</body-content>  
  52.   <attribute>  
  53.   <description>the uid of content slot</description>  
  54.   <name>uid</name>  
  55.   <required>true</required>  
  56.   <rtexprvalue>true</rtexprvalue>  
  57.   </attribute>  
  58.   <attribute>  
  59.   <description>the var name to access the content element</description>  
  60.   <name>var</name>  
  61.   <required>true</required>  
  62.   <rtexprvalue>false</rtexprvalue>  
  63.   </attribute>  
  64.   <attribute>  
  65.   <description>the limit on the number of components to render in this slot</description>  
  66.   <name>limit</name>  
  67.   <required>false</required>  
  68.   <rtexprvalue>true</rtexprvalue>  
  69.   </attribute>  
  70.   <attribute>  
  71.   <description>the HTML element to generate for this slot</description>  
  72.   <name>element</name>  
  73.   <required>false</required>  
  74.   <rtexprvalue>true</rtexprvalue>  
  75.   </attribute>  
  76.   <!– Any other attributes specified are written onto the element –>  
  77.   <dynamic-attributes>true</dynamic-attributes>  
  78.   </tag>  
  79.   
  80.   
  81.   <!– The ‘slot’ tag is deprecated –>  
  82.   <!– <tag>  
  83.   <description>Iterates over a CMS content slot</description>  
  84.   <name>slot</name>  
  85.   <tag-class>de.hybris.platform.acceleratorcms.tags2.CMSContentSlotTag</tag-class>  
  86.   <body-content>JSP</body-content>  
  87.   <attribute>  
  88.   <description>the content slot</description>  
  89.   <name>contentSlot</name>  
  90.   <required>false</required>  
  91.   <rtexprvalue>true</rtexprvalue>  
  92.   </attribute>  
  93.   <attribute>  
  94.   <description>the uid of content slot</description>  
  95.   <name>uid</name>  
  96.   <required>false</required>  
  97.   <rtexprvalue>true</rtexprvalue>  
  98.   </attribute>  
  99.   <attribute>  
  100.   <description>the position of content slot</description>  
  101.   <name>position</name>  
  102.   <required>false</required>  
  103.   <rtexprvalue>true</rtexprvalue>  
  104.   </attribute>  
  105.   <attribute>  
  106.   <description>the var name to access the content element</description>  
  107.   <name>var</name>  
  108.   <required>true</required>  
  109.   <rtexprvalue>false</rtexprvalue>  
  110.   </attribute>  
  111.   <attribute>  
  112.   <description>the limit on the number of components to render in this slot</description>  
  113.   <name>limit</name>  
  114.   <required>false</required>  
  115.   <rtexprvalue>true</rtexprvalue>  
  116.   </attribute>  
  117.   </tag> —>  
  118.   
  119.   
  120.   <tag>  
  121.   <description>Renders a component by calling it’s controller</description>  
  122.   <name>component</name>  
  123.   <tag-class>de.hybris.platform.acceleratorcms.tags2.CMSComponentTag</tag-class>  
  124.   <body-content>JSP</body-content>  
  125.   <attribute>  
  126.   <description>the uid of the component</description>  
  127.   <name>uid</name>  
  128.   <required>false</required>  
  129.   <rtexprvalue>true</rtexprvalue>  
  130.   </attribute>  
  131.   <attribute>  
  132.   <description>the component</description>  
  133.   <name>component</name>  
  134.   <required>false</required>  
  135.   <rtexprvalue>true</rtexprvalue>  
  136.   </attribute>  
  137.   <attribute>  
  138.   <description>the parent component</description>  
  139.   <name>parentComponent</name>  
  140.   <required>false</required>  
  141.   <rtexprvalue>true</rtexprvalue>  
  142.   </attribute>  
  143.   <attribute>  
  144.   <description>Set to true in order to evaluate restrictions on this component, default value false. Note that restrictions are typically evaluated by the slot tag.</description>  
  145.   <name>evaluateRestriction</name>  
  146.   <required>false</required>  
  147.   <rtexprvalue>true</rtexprvalue>  
  148.   </attribute>  
  149.   <attribute>  
  150.   <description>the HTML element to generate for this component</description>  
  151.   <name>element</name>  
  152.   <required>false</required>  
  153.   <rtexprvalue>true</rtexprvalue>  
  154.   </attribute>  
  155.   <!– Any other attributes specified are written onto the element –>  
  156.   <dynamic-attributes>true</dynamic-attributes>  
  157.   </tag>  
  158.   
  159.   
  160. </taglib>  
Next Post Previous Post
No Comment
Add Comment
comment url
close