Configuring the sample portlets in the development environment

Deploying the WebSphere Commerce sample portal application configures the portlet application on the WebSphere Portal developement server. Deploying a portlet makes it available to portal users. Adding a portlet to a page makes the portlet accessible to users with the appropriate rights.About this task

Previous step

  1. Open the WebSphere Portal administration console using the WebSphere Portal administrator ID and password. For information on the WebSphere Portal administration console, refer to Start and stopping WAS and WebSphere Portal.

  2. Select Administration from the top of the pane to access the WebSphere Portal administration console.

  3. Optional: Assign Anonymous user access to the required portlets:

    1. Select Portlet Management>Web Modules and then select File names startswith as the Search by option. Type the name of the WAR file that you have installed. For example, MVCPortlet.

    2. Click the Web Module link by Name and select MVCPortlet.war. The title of the WebSphere Commerce sample application is "WebSphere Commerce Portlet".

    3. To assign Anonymous user access:

      1. Select the WebSphere Commerce - Product portlet.

      2. Select the Assign Access to portlet icon.

      3. Select the Edit Role icon for the User roles.

      4. Click Add and select Anonymous Portal user.

      5. Click the link to the portlet below the Add button.

      6. Click Done to save the configuration.

      7. Repeat these steps for the WebSphere Commerce - My Cart portlet.

        To allow anonymous access to these portlets, add these portlets to a page that allows anonymous user access. Additional updates are needed within the WebSphere Portal configuration. For more information refer to Portal configuration services page, and click on the "Navigator Service" link.

      8. Restart the WAS, and the WebSphere Portal server.

  4. Optional: The portlets are automatically added to the Content Root > Home > Rational portlets page. If you want to add the portlets to another page...

    1. Select Portal User Interface > Manage Pages.

    2. Locate the page where you will add the portlet. For example Content Root>Home>WebSphere Commerce.

    3. Click the Edit Page Layout button (the pencil icon).

    4. Click the Add portlets button.

    5. Use the following search criteria to locate the appropriate portlet:

      1. Select Title contains as the search type, and type Commerce.

      2. Click Search.

    6. Select the check box for each portlet found by the search.

    7. Click Done to save the changes.

  5. Optional: Arrange the portlets:

    1. Select Portal User Interface > Manage Pages.

    2. Select the page with the title Content Root>Home>Rational Portlets. By default the portlets are added to the MVCPortlet page. For more information on creating a new page, refer to Manage pages in the WebSphere Portal Information Center.

    3. Select the MVCPortlet page, click the Edit Page Layout button (the pencil icon) and move the portlets into the following recommended arrangement:

      Move the portlets using the arrow buttons.

      • In the first column: WebSphere Commerce - Search, WebSphere Commerce - Catalog

      • In the second column: WebSphere Commerce - Product, WebSphere Commerce - Cashier

      • In the third column: WebSphere Commerce - My Cart, WebSphere Commerce - My Order, WebSphere Commerce - My Account

    4. Click Done to save the changes.

  6. Add the portlets to the page for anonymous shoppers:

    1. Select Portal User Interface > Manage Pages.

    2. Create a new page or locate an existing page where you want to add the WebSphere Commerce portlets. For example Content Root>Home>WebSphere Commerce. For more information on creating a new page, refer to Manage pages in the WebSphere Portal Information Center. In order to enable the anonymous shopper, pick a page which the anonymous WebSphere Portal user can access.

    3. Click the Edit Page Layout button (the pencil icon).

    4. Click the Add portlets button.

    5. Use the following search criteria to locate the appropriate portlet:

      1. Select Title contains as the search type, and type Commerce.

      2. Click Search.

    6. Select the check box for the WebSphere Commerce - Product and WebSphere Commerce - My Cart portlets only.

    7. Click Done to save the changes.

  7. Set up the Wires for the new portlet:

    1. Click Portal User Interface > Manage Pages.

    2. Click the Edit Page Layout button (the pencil icon) for that portlet that you want to configure.

    3. Select the Wires tab.

    4. Add the following wires: Notes:

      • Click the "+" button to after you have selected the wire type to create the wire.

      • Set the Wire Type to Public.

      • The default Target page name is MVCPortlet. If you have created your own page and want to add wires to that page, select that name from the Target page list.

      • When the Source Portlet is set to "WebSphere Commerce - MyCart" the Sending dropdown list contains 2 orderIDs. Select the first orderID for "WebSphere Commerce - My Account", and the second for "WebSphere Commerce - Cashier".

      • The number of portlet wires that must be configured depends on your page configuration. The wire configurations suggested on this page apply only to the suggested page layout. The number of wires vary depending on the number of portlets you have placed on a given page. For example, if your page does not have the "WebSphere Commerce - My Order" portlet, then you are not able to configure the portlet wires related to the "WebSphere Commerce - My Order" portlet.

      Source Portlet Sending Target page Target portlet Receiving Wire Type
      WebSphere Commerce - Catalog catalogId MVCPortlet WebSphere Commerce - Product Catalog_Product,catalogId Public
      WebSphere Commerce - Catalog catGroupId MVCPortlet WebSphere Commerce - Product Catalog_Product,catGroupId Public
      WebSphere Commerce - Cashier catEntryId MVCPortlet WebSphere Commerce - Product Cashier_Product,catEntryId Public
      WebSphere Commerce - My Cart orderId MVCPortlet WebSphere Commerce - My Account MyCart_MyAccount,orderId Public
      WebSphere Commerce - My Cart orderId MVCPortlet WebSphere Commerce - Cashier MyCart_Cashier,orderId Public
      WebSphere Commerce - My Cart catEntryId MVCPortlet WebSphere Commerce - Product MyCart_Product,catEntryId Public
      WebSphere Commerce - My Order catEntryId MVCPortlet WebSphere Commerce - Product MyOrder_Product,catEntryId Public
      WebSphere Commerce - Search criteria MVCPortlet WebSphere Commerce - Product Search_Product,criteria Public

    5. Click Done.

  8. If your WebSphere Commerce storeID is not 10001, complete the following steps:

    If you have not published a store for the WebSphere Portal integration, publish that store now. Your new storeID is located in the STOREENT.STOREENT_ID entry of the WebSphere Commerce database. The storeID was recorded when you reviewed the prerequisites page.

    1. Navigate to the MVCPortlet/WebContent/WEB-INF/ directory.

    2. Open the portlet.xml file in a text editor.

    3. Search for all .ContextDefault-storeId entries and edit the value to match your storeID.

    4. Save the file.

    5. Navigate to the MVCPortlet/WebContent/WEB-INF/config directory.

    6. Open the store-directory.properties file in a text editor. For more information on the store-directory.properties file, refer to WebSphere Commerce Portal integration and WebSphere Commerce stores.

    7. Search for 10001 and change the value that you find to match your storeID. If you are not using the default directory, update this entry as well. For example, when the storeID is 10001, and the default directory is /ConsumerDirect, this entry is:
      10001 = /ConsumerDirect

    8. Save the file and exit.

  9. Register the static content URL reference on WebSphere Portal's WAS:

    1. From the WAS administration console, select Resources > URL Providers > Default URL Provider.

    2. Under Additional Properties click URLs.

    3. Add a new URL reference:

      • Name: External Content

      • JNDI name: url/com/ibm/commerce/foundation/client/portal/ExternalContent

      • Specification: http://hostname:port/wcsstore

      Where:

      >
      hostname
      Is the hostname of the machine that serves the WebSphere Commerce related static content files, such as the WebSphere Commerce web server or WebSphere Commerce Developer. An example of the WebSphere Commerce related static content file is an image file of a product in the WebSphere Commerce catalog.
      port
      Is the HTTP port number for the store related HTTP requests.

  10. Optional: If you have enable anonymous users, a public session will be created for anonymous shoppers. To prevent the following warning statements from being logged in the SystemOut.log file on the Portal server
    [4/3/07 12:45:16:953 EDT] 0000007a SessionContex W SESN0066E: Response is already committed to client. Session cookie cannot be set.
    [4/3/07 12:45:16:968 EDT] 0000007a SRTServletRes W WARNING: Cannot set session cookie. Response already committed.
    

    1. From the WAS administration console, select Resources > Resource Environment Providers.

    2. Click WP NavigatorService. Under Additional Properties select Custom Properties.

    3. Click New to create new custom properties.

    4. In the Name field, type public.session.

    5. In the Value field, type true.

    6. Click OK to confirm the changes.

    7. Save the configuration.

      For more information refer to the topic Portal configuration services.

  11. Restart the WebSphere Portal Server and publish the changes.


Related concepts

WebSphere Commerce integration with WebSphere Portal WebSphere Commerce Portal integration and WebSphere Commerce stores Portlet packaging structure WebSphere Commerce Portal Integration maintenance Starter store conventions


Related reference

WebSphere Commerce portlet samples - - -