Customizing the B2C Accelerator to Support both B2B and B2C storefronts
In my previous blog after initialize and build we got ootb b2b and b2c two
storefronts yacceleratorstorefront,yb2bacceleratorstorefront but if we want to
do any customization we cannot do directly in those extensions its not a good
practice
So we need to create our own custom extensions
website.electronics.http=http://localhost:9001/samplestorefront website.electronics.https=https://localhost:9002/samplestorefront
website.apparel-uk.http=http://localhost:9001/samplestorefront
website.apparel-uk.https=https://localhost:9002/samplestorefront
website.apparel-de.http=http://localhost:9001/samplestorefront
website.apparel-de.https=https://localhost:9002/samplestorefront
website.powertools.http=http://localhost:9001/sampleb2bstorefront
website.powertools.https=https://localhost:9002/sampleb2bstorefront
media.powertools.http=http://localhost:9001
media.powertools.https=https://localhost:9002
https://localhost:9002/samplestorefront/?site=electronics
https://localhost:9002/sampleb2bstorefront/?site=powertools
https://localhost:9002/samplestorefront/?site=apparel-uk&clear=true for more infomartion please click on https://help.sap.com/docs/SAP_COMMERCE/4c33bf189ab9409e84e589295c36d96e/6b3c400939a046cd9ff4b80bf6ab6d80.html
So we need to create our own custom extensions
Step 1: Remove yb2bacceleratorstorefront from localextensions.xml file and custom folder.
Because if we run ant modulegen directly ,build get fails we get below error so to solve this follow step1Step 2: Run ant modulegen command in platform
Please select the template(default template : accelerator),enter name sample ,enter package com.hybris.sampleStep 3: After Build Sucessful Add the new custom extensions and comment/remove yaccelerator* extensions in the localextensions.xml file as mentioned below
Save it and do ant clean all in platformStep 4: Build got failed because duplication ConsignmentProcess.done attribute in yacceleratorordermanagement and samplefulfilmentprocess.
Comment or Remove ConsignmentProcess item in samplefulfilmentprocess-items.xml Do ant clean all again , it will get build sucessfulStep 5: define extgen.properties E:\HybrisSuite\CX2211\hybris\bin\custom\custom\samplestorefront to tell extgen tool to use samplestorefront as Template for creating new extension
extgen.properties consists It consists of Tokens which include naming convention,package structure,class prefixes and other details about extension. Here we are using samplestorefront as template for creating sampleb2bstorefrontStep 6:Run E:\HybrisSuite\CX2211\hybris\bin\platform>ant extgen
select template: samplestorefront ,name: sampleb2bstorefront ,package: com.hybris.sampleb2bNote: After Build Sucessful ,Add sampleb2bstorefront in localextensions.xml file
Step 7:To enable core functionalites of B2B in sampleb2bstorefront install below addons in platform
ant addoninstall -Daddonnames="b2bacceleratoraddon" -DaddonStorefront.samplestorefront="sampleb2bstorefront" ant addoninstall -Daddonnames="commerceorgaddon" -DaddonStorefront.samplestorefront="sampleb2bstorefront"Step 8:Change site channel filters E:\HybrisSuite\CX2211\hybris\bin\custom\sampleb2bstorefront\web\webroot\WEB-INF\config\spring-filter-config.xml
Replace B2C code with B2B configuration in spring-filter-config.xml and Add below properties in in localextensions.xmlwebsite.electronics.http=http://localhost:9001/samplestorefront website.electronics.https=https://localhost:9002/samplestorefront
website.apparel-uk.http=http://localhost:9001/samplestorefront
website.apparel-uk.https=https://localhost:9002/samplestorefront
website.apparel-de.http=http://localhost:9001/samplestorefront
website.apparel-de.https=https://localhost:9002/samplestorefront
website.powertools.http=http://localhost:9001/sampleb2bstorefront
website.powertools.https=https://localhost:9002/sampleb2bstorefront
media.powertools.http=http://localhost:9001
media.powertools.https=https://localhost:9002
Step 9: Do ant clean all and start Hybrisserver (hybrisserver.debug) in platform.
Access the siteshttps://localhost:9002/samplestorefront/?site=electronics
https://localhost:9002/sampleb2bstorefront/?site=powertools
https://localhost:9002/samplestorefront/?site=apparel-uk&clear=true for more infomartion please click on https://help.sap.com/docs/SAP_COMMERCE/4c33bf189ab9409e84e589295c36d96e/6b3c400939a046cd9ff4b80bf6ab6d80.html
Comments
Please make a document on how to customize OCC controller i.e ProductsController method.