Although Kartris has an extensive array of features and is highly configurable, there will always be some requirements that necessitate customization. Kartris is open source and so the source code to enable virtually any customization is available. But Kartris also includes specific design features to aid customization.

Very often when creating new features, you need to set values at the product or version level. We found this ourselves when adding new features to Kartris. Rather than adding new fields in the existing product and version tables, we came up with a better solution - the object config system.

Each new setting required is added as a record to the tblKartrisObjectConfig table in the database. The data type can be string (s), boolean (b) or numeric (n). Once a record has been added here, the new setting is immediately available on the object config tab when editing products. Any values set are stored in the tblKartrisObjectConfigValues table.

There is no Kartris GUI for adding these values; it needs to be done manually within SQL Management Studio. However, it's not something that will be done routinely, and even then only by developers, so it's not something that we'd really want to have a back end page to handle doing anyway.

Of course, as well as setting values, you will also want to read them within whatever new code you write. Fortunately, the functions to support this are already in Kartris. You can call an object config value simply as follows:

Dim strSampleValue As String = ObjectConfigBLL.GetValue("K:product.myobjectname", numProductID)

The numProductID value, which is the database ID of the product (P_ID from the tblKartrisProducts table) is available in some for or another in most places that products are being handled.

You should of course replace K:product.myobjectname with the actual name of your object config setting.

Kartris has multiple product types, including 'options' products and text-customizations, which can handle most scenarios. However, some kinds of products, especially ones that are custom made, can't be adequately handled by the built in product types.

A typical case where a customized product interface is required would be a site that makes items such as curtains and blinds. Both height and width could be any value (in centimetres) between perhaps 50 and 300, so it becomes impractical to create every possible width or height as an option. Furthermore, although options can have a price modifier associated with them, this doesn't really help with pricing where width and height are both variable.

Instead, a far more manageable solution would be for pricing to be obtained from a lookup table or a formula.

Situations where a highly customized product interface is also required or where a client side configuration system has already been created may lend themselves to custom product controls. For example, a client side tool that lets you design a t-shirt and add text and/or images, then buy the item.

Kartris ships with a couple of sample custom controls in the /UserControls/Custom/ folder. There are comments within the files to help explain the code. Our examples are very simple in nature, but you can make things as complicated as necessary as long as you can dump a price and item description out of the control.

For example, you could have a control that has textboxes for the width and height of curtains, a dropdown menu of different lining types and then some other checkboxes for some further options. Prices could be looked up in an Excel spreadsheet with a table of curtain costs. This not only allows very fine control of pricing, but also makes it easy to change or update pricing by editing prices in the spreadsheet.

Engineering applications such as industrial fans could use either a 'black box' software component from the manufacturer or a web service to look up pricing based on various performance requirements, and return the fan specification as the item description, as well as the price.

Once you have written your custom control, it is simple to incorporate it into Kartris. First, upload it to the /UserControls/Custom/ folder.

Next, create a new single version product. Give it an appropriate name, but price is not important as that will come later from the custom control.

Finally, edit the product and go to the object config tab. Enter the name of the control in the K:product.customcontrolname object config setting. For example: 'SampleCustomControl.ascx' (the .vb part will be linked in automatically).

When you view this product on the front end, you should now see your custom control providing most of the interface.

You can use a custom control from different products. So for example, in the case of a curtains web site, you can have each curtain set up with an image of the type of fabric, and then use the custom control on each curtain to handle pricing. You can also use per-product settings. So if the price per square metre of fabric is different for each product, you can set that at each product, and then just have the common values within the custom product control.

You can have as many custom controls as you need, so you can for example configure curtains and blinds using different custom controls within the same site, and of course mix in standard Kartris product types too.

As you can see from this simple overview, the custom product control support is extremely flexible and can cope with virtually any scenario.

Powered by tomeCMS