I created b2c storefront using ant modulegen command. Now I want to create b2b storefront in the same code base. At the end b2b and b2c storefronts should run on the single hybris instance. Please provide the step by step process to achieve this. Thanks in advance.
问题:
回答1:
I agree with the other respondents that the question is not completely clear. However, if you want one storefront, then you can do the following:
ref: https://help.hybris.com/1811/hcd/8ae0711f86691014877ae05249b2f5ac.html
If you have multiple storefronts, you can apply the changes described here to the storefront you want to appear as the default storefront when the user's URL does not provide sufficient information to discriminate between different storefronts.
SAP Commerce Accelerator provides the functionality to support multiple storefronts; a request to the servlet at its root context path directly results in a 500 error. You need to use hosts file mappings or use the site-ID parameter to avoid a 500 error.
The CMS site has an attribute called urlPatterns. This is a list of regular expressions that the website CMS filters match to determine which storefront a user is trying to access.
To resolve this, add an additional regular expression to the CMS site such as the following:
(?i)^https?://[^/]/yacceleratorstorefront((?![\?\&]site=).) The regular expression can be added in the Backoffice Administration Cockpit.
Setting URL Patterns in Backoffice Log into Backoffice. Navigate to Start of the navigation pathWCMS Next navigation step WebsiteEnd of the navigation path. A list of storefronts appears in the main pane. Click the storefront you want to set up. In the Properties tab, make sure that the text field in the URL Patterns section looks like the one in the example below:enter image description here
To make the change permanent, add the following code to the CMS site setup ImpEx script run during the project data phase of initialization.
CMS Site
UPDATE CMSSite;uid[unique=true];urlPatterns; ;electronics;(?i)^https?://[^/]+(/[^?])?\?(.\&)?(site=electronics)(|\&.)$,(?i)^https?://electronics.[^/]+(|/.|\?.)$,(?i)^https?://api.hybrisdev.com(:[\d]+)?/rest.$,(?i)^https?://[^/]/yacceleratorstorefront((?![\?\&]site=).);
回答2:
I'm not sure I completely understand what you are trying to achieve.
If you want to serve business and end customers using one online shop you will have to use either the b2c or the b2b accelerator. The b2b and b2c accelerator storefronts are 2 seperate example implementations of one online shop for b2b and b2c respectively. One offers an online shop for business customers and another one that targets end customers. There is no possibility of combining those two in one storefront.
If you want two seperate online shops running on one instance, one that serves business customers and another one that serves end users, it should be possible to generate two different modules with different names/packages (e.g. "myb2baccelerator" and "myb2caccelerator"). Note, that both will need a different webroot, so you can access them on a different URL (e.g. /myb2baccelerator and /myb2caccelerator )
You can set the webroot either via property or in the extensioninfo.xml file of your generated myb2baccelerator / myb2caccelerator extension.
If you tried this approach and had troubles doing so, please add an error description to your question.
Further reading: How to create a module: https://help.hybris.com/6.5.0/hcd/8ace75c786691014a5e9dcafa29d5410.html
回答3:
You can install b2c_b2b_acc recipe.
Install Setup
On Windows: install.bat -r b2c_b2b_acc
On Linux or Mac: ./install.sh -r b2c_b2b_acc
Initialize Setup
On Windows: install.bat -r b2c_b2b_acc initialize
On Linux or Mac: ./install.sh -r b2c_b2b_acc initialize
回答4:
SO comment
I don't want to merge two storefronts. I have created merchadiseb2cStore and its working properly. Now I want to create merchandiseb2bStore in the same code base. Please let me, is it possible? If yes, please provide the steps to achieve this or share the wiki link
I'm assuming you already have all (B2B & B2C) require extensions configure in your localextension.xml file. If not, you can take help of b2c_b2b_acc recipe as mentioned in other answers.
want two diffent storefronts?
In this case, you can generate another extension (say it as merchandiseb2bStore) using extgen
by making your current merchadiseb2cStore as the base template. Now install require B2B addons on the newly generated storefront merchandiseb2bStore Like b2bacceleratoraddon, commerceorgaddon.
Refer to this for more detail steps