Chapter 10. KonaKart Content

Table of Contents

Content Overview
Text Content
Banner Content
Content Expressions
Content Caching
Content Access

Content Overview

KonaKart supports basic Content Management features that may be sufficient for some store owners who don't want to integrate with a sophisticated Content Management System for more advanced features.

KonaKart allows you to define "Content" objects which can be anything you like including blocks of text, images and clickable banners. You can set up these content items in the Administration Application and access them via the KonaKart APIs to show in your storefront. Their use is demonstrated in the sample store that you get when you install KonaKart.

Each content object contains an extensive set of attributes that can be used to program the storefront. Different content types require different attributes to be specified but there are very few mandatory attributes giving considerable freedom to use content in creative and flexible ways in the storefront.

There are two main object types used to define KonaKart content. These are called "Content" and "Content Type" where a piece of content has a content type. An example of one of the provided "Content Types" is a "Top Banner". An example of a piece of "Content" with a "Content Type" of "Top Banner" is a banner image.

You can maintain the Content Types in the Admin Application as follows.

Both "Content Type" and "Content" objects have numerous custom fields that can be used for custom purposes. By default the Administration Application does not display the "Content" custom fields for editing but they can be shown by configuring File-Based Configuration not to hide them (see the konakartadmin_gwt.properties file for details).

In order to start using KonaKart Content you need to enable it in the Adminsitration Application on the Configuration panel.

Text Content

In the simple case of text content we'll use the "About Us" text as an example of how to define and use a block of text content.

First you need to define the content in the Administration Application on the Content panel. For text content the important attribute is the "content" attribute which is defined for each language supported by the store.

You can maintain the Content objects in the Admin Application as follows.

Once the content text is defined you can access it from the storefront using the KonaKart APIs and selecting the required content by specifying its Content Id which is automatically assigned when the content is created.

In the demo application (which uses a standard Module View Controller) the About us content (which has Content Id 23) is retrieved in the AboutUsAction class and displayed in the AboutUsBody JSP.

Banner Content

In the sample storefront application four distinct banner types are defined (these are defined as KonaKart "Content Types"):

  • Top Banner - at the top of the store's Home Page
  • Sub Banner - in the row below the top banner on the home page of the store
  • Category Banner - the main category banner
  • Sub-Category Banner - the row underneath the main category banner

You can define as many Content Types as you like; you are not restricted to those that are defined in the sample storefront application

When defining a banner content type it would be typical to provide the images in each supported language. (If the images are the same for each language you can set these up quickly by setting them up for one language and using the "Copy" button on the Edit Content panel to duplicate the definitions for each supported language).

Four images per language are allowed. There are no rules that define what images you should use for each of the four image attributes but it might be convenient to use the four attributes for different sized images if you are implementing a storefront with a responsive design (as in the sample storefront).

When you upload an image to associate with "Content" it is stored at a location defined by the concatenation of the "ImageBasePath" (defined for the store) and the name of the content directory (defaults to "content" but can be changed in the konakartadmin_gwt.properties file).

Optionally you can assign a "Click URL" to the banner object. This would be useful in the case where you need to define which URL should be accessed when the banner is clicked by the user. If required, the Click URL can use a special "{OBJ_ID}" identifier within the string to allow the replacement of the "Object Id" at runtime. In typical cases the "Object Id" would be the Id of the product or category that was referenced in the banner itself.

Content Expressions

One of the powerful features of KonaKart content is the ability to select it programmatically by evaluating KonaKart expressions. You could use this feature to select appropriate banners or text for the particular customer browsing the storefront.

To use this feature you need to set up KonaKart expressions (which are based on Customer Tags) and associate an expression to a piece of content. You define this association by setting the expression attribute on the content object to the appropriate expression. When selecting content you can set an option in your API call parameters to evaluate expressions. If this is set, only content whose expressions evaluate to True will be returned (plus the content that has no expression defined).

Content Caching

For performance reasons, Content is cached in the customer's session. This behaviour can be modified to suit your requirements as the full source code for the Application Engine (KKAppEng) is provided in the Business and Enterprise Editions.

Content Access

Content can be retrieved in various ways through the KKEngIf APIs (or for Admin functions by using the Admin APIs defined on KKAdminIf). Which search criteria you use will depend on your specific requirements. Content can be retrieved using a wide variety of attributes but the most common search keys to use are:

  • Content Id - the business Id of the content.
  • Content Type Id - for retrieving all content of a certain type.
  • Content Search Key - for retrieving all content that have a certain search key. In the sample store this is set to retrieve all the banners applicable to a certain category by using the category's matching search key. You are free to define any search key to identify content for your own purposes.
  • From Date and To Date - for retrieving content appropriate for a certain date. banner