on 2015 Feb 17 7:39 AM
HI Guys
I have a requirement where I need to have sites specific to two countries. (eg. foo and goo) but my domain remains the same. ( www.mycompany.com ). So I need two sites with something like this
Both these countries have their specific catalogs, base store, sites.
Just needed to understand what is the best way to handle site switching in this situation.
Thanks Bhanu P Jain
Request clarification before answering.
I have done the following uptill now:
CMS Site URLs
site foo: (?i)^https?://mycompany.[^/]+/store+(/[a-z][a-z])+foo+(|/.|\?.)$
site goo: (?i)^https?://mycompany.[^/]+/store+(/[a-z][a-z])+goo+(|/.|\?.)$
Actual SITE URLs
site foo: https://mycompany.com:9002/store/en?clear=true&country=foo
site goo:https://mycompany.com:9002/store/en?clear=true&country=goo
I have modified the 'processNormalRequest' method of CMSSiteFilter as below:
if (cmsSiteModel == null || StringUtils.contains(queryString, CLEAR_CMSSITE_PARAM)){
final String country = httpRequest.getParameter(PARAM_COUNTRY);
if(StringUtils.isEmpty(country)){
/No Country Fetched from the URI/
httpResponse.sendError(MISSING_CMS_SITE_ERROR_STATUS, MISSING_COUNTRY_ERROR_MESSAGE);
return false;
}
final String absoluteURL = StringUtils.removeEnd(currentRequestURL, "/") + "/" + country
+ (StringUtils.isBlank(queryString) ? "" : "?" + queryString);
cmsSiteModel = getContextInformationLoader().initializeSiteFromRequest(absoluteURL);
}
Now sending the country in query params, adding this to the absolute URL while fetching site for the requestURI works great.
The problem is now handling both the sites in the same browser . For eg: if I open foo site in tab1 and log in. Now in tab2 I open goo site, the site of tab1 changes to goo but the user is still logged in.
How to handle this situation. What if I want both the sites to maintain their own session in the same browser?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.