Tutorials > Customize the Consumer Direct sample store > Customizing the consumer direct sample store using snippets
Deploy the snippet changes
In this tutorial, you performed actions usually performed by multiple roles. Actions that involved creating assets using WebSphere Commerce Accelerator are not usually performed by a store developer. For example, a sales catalog will likely be created by a Category or Product Manager, and a promotion created by a Marketing Manager.
The following steps describe how to deploy the changes made by a store developer. The changes depend on the information created in this tutorial, such as the e-Marketing Spot name, or the existence of specific catalog entry IDs.
To ensure this code works in the production environment, ensure such information matches exactly.
- You published a consumer direct sample store called MyApparelStore with the Apparel catalog.
- The changes made in WebSphere Commerce Accelerator and Administration Console have already been made.
Procedure
- Export the files
- Click to File > Export.
- Choose File System and click Next.
- Click Deselect All.
- Select the following files
- Stores/WebContent/MyApparelStore/include/styles/style1/CachedHeaderDisplay.jsp
- Stores/WebContent/MyApparelStore/templates/EmailMessageDisplay.jsp
- Stores/WebContent/MyApparelStore/include/StoreCatalogDisplay.jsp
- Stores/WebContent/MyApparelStore/Snippets/ReusableObjects/CatalogEntryThumbnailDisplay.jspf
- Stores/WebContent/WEB-INF/classes/MyApparelStore/CatalogJSPCodeSnippetText_ locale.properties. There are 11 properties files, one for each locale and one default file with no locale in the file name.
- In the To directory field, enter a file name, for example, drive:/temp/.
- Click Finish.
- Modify the file structure so that it matches the file structure on the production machine:
- Rename the Stores directory to Stores.war.
- Move the MyApparelStore and WEB-INF directories and their contents under the Stores.war directory.
- Delete the now empty WebContent directory.
The resulting file structure should resemble the following:
- Stores.war/MyApparelStore/include/styles/style1/CachedHeaderDisplay.jsp
- Stores.war/MyApparelStore/templates/EmailMessageDisplay.jsp
- Stores.war/MyApparelStore/include/StoreCatalogDisplay.jsp
- Stores.war/MyApparelStore/Snippets/ReusableObjects/CatalogEntryThumbnailDisplay.jspf
- Stores.war/WEB-INF/classes/MyApparelStore/CatalogJSPCodeSnippetText_ locale.properties.
- Use a ZIP utility to create a zip file called drive:/temp/snippetTutorial.zip.
- Transfer the files to the target machine
In this section, we will create a temporary directory on the target WebSphere Commerce Server and then copy the file assets into this directory. In subsequent steps, we will place the different types of code into the appropriate place within the WebSphere Commerce application.
To copy the files from the development machine to the target WebSphere Commerce Server:
- On the target WebSphere Commerce Server, create a temporary directory called drive:\SnippetImport.
- Determine how we will copy the files from one computer to another. You can do this by mapping a drive on the target WebSphere Commerce Server to the development machine, or by using an FTP application, if you have that configured.
- From the development machine, copy the contents of drive:/temp/snippetTutorial.zip to drive:\SnippetImport on the target WebSphere Commerce Server.
- Unzip snippetTutorial.zip in the SnippetImport directory.
- Stop the target WebSphere Commerce application
Open the WebSphere Application Server administration console and stop the WebSphere Commerce application:
- Open the WebSphere Application Server administrative console by entering the following URL in a Web browser: http://host:portNumber/ibm/console
...where host is the name of the target machine and portNumber is the port number used to access the Admin Console is defined during profile creation. The default port number is 9060.
- Click Applications > Enterprise Applications to see a list of installed applications.
- Select the WebSphere Commerce application, for example WC_demo, and click Stop.
- Export a backup copy the EAR
Export a backup copy of the EAR, so that you can revert to the old version in the future if desired:
- In the WebSphere Application Server administrative console, click Applications > Enterprise Applications to see a list of installed applications.
- Select the WebSphere Commerce application, for example WC_demo, and click Export.
- Follow the wizard and save the EAR file in a backup directory.
- Update store assets on the target WebSphere Commerce Server
Update the store with the modified store assets using the WebSphere Application Server administrative console:
- In the WebSphere Application Server administrative console, click Applications > Enterprise Applications.
- Select the application name, for example WC_demo, and click Update.
- Select Partial Application
- If you are running the WebSphere Application Server administrative console on the target machine, select Local file system, since the files are local to the browser. If you are running the WebSphere Application Server administrative console on a different machine, select Remove file system, since the files are remote to the browser.
- Specify the path to drive:\snippetImport\SnippetTutorial.zip.
- Click Next.
- Click OK.
- When the update completes successfully, click Save to Master Configuration.
- On the Enterprise Applications screen, click Save to save the changes to the master configuration.
- Close the WebSphere Application Server administration console.
If you performed the steps that create an e-mail activity, register the e-mail template in the production database by following the steps in Register the e-mail template.
- Stop and start the WebSphere Application Server
You must stop and start the WebSphere Application Server to pick up the changes you deployed.
To stop and start the server:
- At a command prompt, navigate to WC_PROFILE\bin.
- Stop the WebSphere Application Server. For example, on the Windows operating system, enter stopServer server1. The server has stopped successfully when you see the message: Server server1 stop completed.
- Start the WebSphere Application Server. For example, on the Windows operating system, enter startServer server1. Wait until you see the message similar to: Server server1 open for e-business; process id is 3740.
- Navigate to WC_PROFILE\logs\server1.
- Examine the SystemOut.log file. Ensure the server started successfully without errors.
- Verify the deployment
Launch the MyApparelStore. The changes you made to the MyApparelStore in the development environment should display in the target environment, including the MyApparelSalesCatalog, the MyApparelSpot e-Marketing Spot, the e-mail activity and the CatalogEntryThumbnailDisplay.jspf snippet.