Multiple Prices for Products

Each KonaKart product object has 4 price fields that can be used to store 4 different prices. For example, these may be retail price, wholesale price, MRP, employee price etc.

The prices may be stored just for reporting purposes since whenever a product is added to an Order and an OrderProduct object is created which becomes an attribute of the Order object, this OrderProduct contains all of the product prices. This means that whenever documentation is generated from the order, you can show customers information such as the discount from the MRP etc.

The prices may also be used to display different prices to different customers based on what customer group they belong to.

In order to have an unlimited number of prices, they may be stored in a separate database table and referenced by a catalog id. The database table is called kk_product_prices. In order to pick up the external prices, the Application Engine must be configured with the correct catalog id. The catalog id can be calculated in a number of ways and is application specific. For example, it may depend on the country that the customer is accessing from, or the URL or the type of customer etc. One way of configuring the application engine is in the KKAppEngCallouts class as shown below:


/**
 * Callouts to add custom code to the KKAppEng
 */
public class KKAppEngCallouts
{
    /**
     * Called at the start of startup
     * 
     * @param eng
     */
    public void beforeStartup(KKAppEng eng)
    {
        System.out.println("Set product options for current customer");
        FetchProductOptionsIf fpo = new FetchProductOptions();
        fpo.setCatalogId("cat1");
        fpo.setUseExternalPrice(true);
        fpo.setUseExternalQuantity(true);
        eng.setFetchProdOptions(fpo);
    }

    /**
     * Called at the end of startup
     * 
     * @param eng
     */
    public void afterStartup(KKAppEng eng)
    {
    }

The catalogId must be set to the id of a valid catalog and the the UseExternalPrice attribute must be set to true. Note that when using the application API directly, this functionality is available on all of the API calls that accept an Options object such as FetchProductOptions or AddToBasketOptions. The Options object for each API call must be configured in a similar way as shown above.

The kk_product_prices table may be loaded in various ways:

Once the product prices have been generated or inserted, the Admin App may also be used to maintain the external product prices for individual products. The Catalog must first be defined using the Catalogs panel. Once defined, it appears in a drop list in the panel header. When selected in the drop list, all product related API calls made by the admin app attempt to use the catalog. i.e. If you edit a product, the prices, attribute prices (or variant prices, if enabled) and tier prices are all written to the kk_product_prices table rather than to the standard tables. When inserting a product, the prices are written both to the kk_product_prices table as well as the standard tables.

Note that if a catalog is defined but the product does not have entries in the kk_product_prices table, then it will not be displayed in the Products Panel after a search. In order to add the prices to the kk_product_prices table you must take the following steps:

Note that the API calls using the kk_product_prices table are only available when either the Business or Enterprise Editions are installed.