Online documentation - Websydian v6.0

Users Guide | Patterns Reference | WebsydianExpress | Search

 

Implementing ShopApp


Overview

This implementation guide shows how to implement a Web Shop using the library pattern ShopApp, which is part of the WsyShop group model.

ShopApp serves two purposes. First, it is possible to create a working demo within a very short period of time. Secondly, through inheritance ShopApp allows the creation of a fully functional and yet still customizable WebShop application extremely fast.

It is assumed that the reader of this implementation guide previously has implemented and deployed a Websydian application, e.g. by following the Websydian Tutorial.

The necessary steps for creating a custom web shop are almost the same as the necessary steps for creating a working demo. In the following the guide will describe how a working demo is created, with the extra steps for the custom shop included within.

Preparations

The first step is to add the WsyShop library to your host group model. The version of WsyBase and WsyUtil must be set to version  6.0. Remember to set Date, Storage, and WsyBase to the wanted values.

For the demo to work go straight ahead to the Generate and Build section below.

For the custom shop a few more steps must be performed.

MyShopApp is a ENT ShopApp
MyProduct is a ENT Product

Make the inherited objects real. Be aware there are quite a few. Now we have a custom ShopApp and a custom Product entity. All that remains aside from generating and building is the replacement of the library Product with MyProduct:

MyShopApp replaces ENT
... by ENT
WsyShop/Product
MyProduct

It is strongly recommended to supply meaningful implementation names to key objects such as the EventDispatcher, physical tables, PageGenerators, EventHandlers, and Panels.

The section below, Generate and Build, is identical for both the demo and the custom web shop, except that for the custom web shop the objects to generate and build are not ShopApp and Product but MyShopApp and MyProduct.

Generate and Build

Start by building the standard Websydian Packages for your platform and model configuration, including packages from SDSTRING, WSYBASE, WSYINTEG, WSYSESS, and WSYUSER models. Please refer to this section for more details.

Next, all objects in the WebShop application must be generate and build, except objects scoped under Abstract and replaced objects, e.g.  Shop.Data.Cart.Item. Generate and build objects in the following order:

Create an executable file for the EventDispatcher and the main GUI file, i.e. ShopApp.Web.EventDispatcher and ShopApp.GUI.AdministratorMenu.MDIParent.

If creating the custom web shop it is strongly recommended to supply meaningful implementation names for the EventDispatcher and the main GUI file.

Open the .ini files for the two functions and add database information. For the EventDispatcher .ini file, also add an [HTML] section as described in the Websydian Tutorial - Building a Simple Article Application document.

Create HTML Templates

When creating the ShopApp demo the templates supplied with Websydian Enterprise WebShop Developer can be used directly. Simply create a folder named HTML and copy the templates into that folder.

When the files have been copied please write down the URL used in the templates as this URL should be used later on when configuring the web server.

The custom Shop Application needs a bit more work. Two approaches are possible:

  1. Make a copy of each of the supplied templates and rename the template file to have the same filename as the corresponding PageGenerator. Make a global Search&Replace on the Dispatcher name in the templates.
  2. Alternatively run each TemplateGenerator (scoped under MyShopApp.Web and lower). Note that the resulting pages will have a different look than the supplied templates.

Create data for Shop Application

The creation of sample data is simple:

Run the function ShopApp.GUI._TestFunctions.ClearDBAndLoadSampleData

This creates a single shop and populates that shop with sample data. If different data is required (e.g. when running the custom Shop Application) simply access the WebShop Administration Program and modify data as wanted.

Specify Web Server Configuration

Now the WebShop application is ready to install and execute through a browser. Follow the appropriate installation guide for your platform and Internet Server, refer to the Installation part of the Websydian documentation.