Tutorials > Customize > Create a multicultural store

< Previous


Group locales by country and store

Overview

In this step of the tutorial, we will learn how to...

Locales ending in _US we can assume are United States stores. All locales ending in _CA we can assume are Canadian stores. For our example, en_CA and fr_CA both apply to the same store.

We need to publish two stores, then use Accelerator to change the profile of each store.

StoreA holds only United States English in the Selected languages box. StoreB holds only Canadian English and Canadian French in the selected languages box.


Create two stores for the two locales

  1. Publish the store through the Administration Console

    1. Logon and go to...

      Site / Store Selection | Site radio box | OK | Store Archives | Publish

    2. Follow the publish wizard to publish the store

    3. To verify publish status...

      Store Archives | Publish Status | Refresh

    4. Logoff of the Administration Console

  2. Publish a second store through the Administration Console following the directions of step 1 above.

  3. Change the stores profiles

    1. Logon to the WebSphere Commerce Accelerator

    2. Select the store from the Select Store and Language page

    3. Click OK

    4. Click Store > Change Profile

    5. Set the languages

      • For the first store make sure United States English is in the Selected Languages list and is set as the default languages.

      • For the second store move Canadian English and Canadian French from the Available Languages to the Selected Languages and click Set as Default Language

    6. Click OK

Follow these steps to map the locale to the stores:

  1. Verify the host names can be resolved to the same IP address, which will depend on the domain registry.

    For local testing, you can add entries in the host files...

    192.168.0.1 www.StoreA.com
    192.168.0.2 www.StoreB.ca

  2. Update the HTTP Server configuration:

    1. Edit...

      <wc>/instances/<instance>/httpconf/httpd.conf

    2. Add the following line to the virtual host portion of the configuration:

      NameVirtualHost *

    3. Update the existing virtual host settings.

      By default, the virtual host for the WCS instance should look like this:

      <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 extract:

      <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 new set of virtual hosts for the second store and update the ServerName and DocumentRoot. Your new set of virtual hosts should look like this extract:

      <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 the changes and close the httpd.conf file.

  3. Create the document root for the second store. Create new folder...

      /opt/HTTPServer/htdocs_StoreB

  4. Create a new index.html file under the new directory.

    This index.html file will be used to redirect to a second WebSphere 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 that the above URL could also be routed to a store that all locales share.

    To do this, instead of pointing to StoreB, point to the same store and specify the language identifier in order to open the store with a specified language. For example:

    • If the Store reference number is 10001 and the language number is 124 for Canadian English, then use the following URL:

      http://localhost/webapp/wcs/stores/servlet/StoreView?storeId=10001&langId=124

    • If the Store reference number is 10001 and the language number is 125 for Canadian French, then use the following URL:

      http://localhost/webapp/wcs/stores/servlet/StoreView?storeId=10001&langId=125

  5. (Optional) If you have not already done so, you might want to create an index.html file under the previous document root to redirect to the first store. For example...

    /opt/IHS70/htdocs

  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 on Virtual Hosts.

    3. Select the virtual hosts for the WCS instance. For example...

      VH_demo
      VH_demo_tools

    4. Under the Additional Properties tab, click on Hosts Aliases. Add the hostname to the list of aliases.For example:

      www.StoreA.com www.StoreA.com:443
      www.StoreB.ca www.StoreB.ca:443

    5. Click Apply to save the changes.

    6. Regenerate the WebServer Plug-in. If you are using a remote Web server, we will need to copy this file to the remote machine after regeneration).

  7. Restart the HTTP Server to recognize the changes to httpd.conf and the WebSphere Plug-in file.

    Once the HTTP Server is restarted, the stores should be accessible using their separate names...

    www.StoreA.com
    www.StoreB.ca

You have now grouped the new locales by country, and separated them by store. In turn, you now have added two fully functional locales to the WCS instance.


Summary

In this tutorial you learned that update the main bootstrap file and create language specific bootstrap files in order for WebSphere Commerce to recognize you new locales. In step 2 you learned that it was necessary to include the language data for the new locales in the WCS instance. That was accomplished by editing a configuration xml file, and updating the store profile in the Commerce Accelerator. Then in step 3 you learned that you had to create new property and image files for the new locales. This was accomplished by altering existing files to suit the needs of the new locales. Finally, in step 4 of this tutorial, you learned that you could have the same store support different languages by simply publishing the store a second time, and having each instance of the store support different languages. As well you learned that you could use the HTTP Server to create separate URL's for the store that link to the appropriate locale.

< Previous


+

Search Tips   |   Advanced Search