Grouping locales by country and store

You can group your new locales by country and separate them by store. Grouping locales by country and store ensure that a store in a particular country has only the languages that it requires.

A locale that ends in _US or _CA might be the deciding factor in how a store is created. All locales that end in _US assume United States stores. All locales that end in _CA assume Canadian stores. For example, en_CA and fr_CA both apply to the same store. To do so, you publish two stores. Then, you change the profile of each store to assign storeA only United States English, and storeB only Canadian English and Canadian French.

Creating stores for each country

Procedure

  1. Create a second custom store to be used only for Canadian English and Canadian French.
  2. Open the Administration Console, selecting the Site option.
  3. From the Store Archives menu, select Publish.
    The Store Archives page is displayed.
  4. From the list, select the ExtendedSites.sar store archive, or the store archive that you want to publish.
  5. Click Next.
    The Parameters page is displayed. Different parameters are displayed depending on the store archive you select.
  6. Click Next.
    The Summary page displays, listing the store archive and parameters that are selected, and the location to which the store archive is published.
  7. After you review the summary information, click Finish.
    A confirmation dialog displays with the number of the publishing job. Note the job number for future reference.
  8. Restart the server.
  9. Change your second stores profiles to contain only Canadian English and Canadian French:
    1. Open the Store Management tool.
    2. Select the second store to work with.
    3. Under Supported languages, add Canadian English and Canadian French and remove the other languages.

      Language List
    4. Click Default to make Canadian English the default language for the store.
    5. Click Save.

Mapping locales to your store

About this task

Follow these steps to map your locale to your stores.

Procedure

  1. Ensure that your host names can be resolved to the same IP address, which depends on your domain registry.
    However, for local testing, add the following entries in your host files:
    192.168.0.1 www.storeA.com
    192.168.0.2 www.storeB.ca
  2. Update the HTTP Server configuration:
    1. Open the WC_installdir/instances/instance_name/httpconf/httpd.conf file in a text editor.
    2. Add the following line to the virtual host portion of the configuration: NameVirtualHost *
    3. Update the existing virtual host settings.
      The virtual host for your HCL Commerce instance resembles the following snippet by default:
      
      <VirtualHost  www.storeA.com>
           <ServerName  www.storeA.com>
           DocumentRoot  "C:/WebSphere/HTTPServer/htdocs" 
      
                              <!-- ...... -->
                     <VirtualHost  www.storeA.com:443>
                     <ServerName  www.storeA.com>
                     DocumentRoot  "C:/WebSphere/HTTPServer/htdocs"
                              <!-- ...... -->
                     <VirtualHost  www.storeA.com:8000>
                     <ServerName  www.storeA.com>
                     DocumentRoot  "C:/WebSphere/HTTPServer/htdocs"
      

      Update the virtual host settings to look like the following snippet:

      
      <VirtualHost  *>
                     <ServerName  www.storeA.com>
                     DocumentRoot  "C:/WebSphere/HTTPServer/htdocs" 
      
                               <!--......-->
                     <VirtualHost  *:443>
                     <ServerName  www.storeA.com>
                     DocumentRoot  "C:/WebSphere/HTTPServer/htdocs"
                               <!--......-->
                     <VirtualHost  *:8000>
                     <ServerName  www.storeA.com>
                     DocumentRoot  "C:/WebSphere/HTTPServer/htdocs"
      
    4. Create a set of virtual hosts for the second store and update the ServerName and DocumentRoot values.
      Your new set of virtual hosts might resemble the following snippet:
      
      <VirtualHost  *>
                   <ServerName  www.storeB.ca>
                   DocumentRoot  "C:/WebSphere/HTTPServer/htdocs_storeB" 
      
                               <!--......-->
                   <VirtualHost  *:443>
                   <ServerName  www.storeB.ca>
                   DocumentRoot  "C:/WebSphere/HTTPServer/htdocs_storeB"
                               <!--......-->
                   <VirtualHost  *:8000>
                   <ServerName  www.storeB.ca>
                   DocumentRoot  "C:/WebSphere/HTTPServer/htdocs_storeB" 
      
    5. Save your changes and close the httpd.conf file.
  3. Create the document root for your second store. Create a folder called htdocs_storeB under the following directories:
    • Linux/opt/HTTPServer
  4. Create an index.html file under the new directory.
    This index.html file is used to redirect to a second HCL Commerce store.
    For example:
    
    <HTML>
    <HEAD></HEAD>
    <TITLE>www.storeB.ca</TITLE>
    
    <SCRIPT LANGUAGE="JavaScript">
    function redirect() {
        
    window.location.href="/webapp/wcs/stores/servlet/StoreB/index.jsp";
    } 
    
    <BODY onLoad="redirect()"></BODY>
    </HTML>
    
    Note: The above URL might also be routed to a store that all locales share. Instead of pointing to StoreB, point to the same store and specify the language identifier to open the store with a specified language.
    • If the Store reference number is 10001 and the language number is -24 for Canadian English, then use the following URL: http://localhost/webapp/wcs/stores/servlet/StoreView?storeId=10001&langId=-24
    • If the Store reference number is 10001 and the language number is -25 for Canadian French, then use the following URL: http://localhost/webapp/wcs/stores/servlet/StoreView?storeId=10001&langId=-25
  5. Optional: Create an index.html file under the previous document root to redirect to the first store.
    For example, drive:\WebSphere\HTTPServer\htdocs for Windows.
  6. Update the virtual host configuration in WebSphere Application Server.
    1. Open the WebSphere Application Server administrative console.
    2. Expand the Environment section and click Virtual Hosts.
    3. Select the virtual hosts for your HCL Commerce instance.
      For example, WC_default_host, admin_host, and default_host.
    4. Under the Additional Properties tab, click Hosts Aliases. Click New to add the host names to the list of aliases.
      For example, the www.storeB.ca host name for ports 80 and 443.
    5. Click Apply to save the changes.
    6. Regenerate your WebServer plug-in.
      If you are using a remote web server, you must copy this file to the remote server after regeneration.
  7. Restart the HTTP Server.
    The HTTP Server must be restarted to recognize the changes to the httpd.conf file and the WebSphere plug-in file. After the HTTP Server is restarted, the stores are accessible by their separate names.
    For example, www.storeA.com and www.storeB.ca.

Results

You grouped the locales by country and separated them by store. In turn, you added two fully functional locales to your HCL Commerce instance.