Commerce Server Blog

Build world class ecommerce applications using Microsoft Commerce Server
  •  
  • Home
  • Advertise
  • Copyright Policy
  • Disclaimer
  • About

Creating Custom Display Types in Commerce Server

ravikanth | September 2, 2008

Microsoft Commerce Server Marketing system allows business users to create different type of visual Advertisements. You can set the type using display type property as shown below.

Out of box commerce server provides a list of display types. These display types have unique identifier associated in SQL Server. You can refer to mktg_creative_type for more details.

Display Type Id Display Type

1

Image

2

Text

3

HTML

4

Non-Clickable Image

5

Buy Now

6

Windows Media Services

7

Left Vignette

8

Right Vignette

9

Top Vignette

10

No Display

Each display type has its own properties. For example, image display type will capture image URL and HTML display type will capture HTML. These property definitions are created in a table named mktg_creative_property. For example the template of image display type is as follows.

<!–Inserted by Microsoft Commerce Server–><A HREF = “{%RedirectUrl%}?ciid={%item_id%}&cachename={%CacheName%}&PageGroupId={%PageGroupId%}&url={%ClickUrl%}” TARGET = “{%TargetFrame%}”> <IMG SRC = “{%ImgUrl%}?CEVT={T=CAMP,CI={%item_id%},PG={%PageGroupId%},EVT=DOWNLOAD}” WIDTH = “{%Width%}” HEIGHT = “{%Height%}” BORDER = “{%Border%}” Alt = “{%AltText%}” /> </A>

If you observe the above template, you can find many place holders (text within {%%}). At runtime, before applying the template, commerce server fills the place holder with actual property values and render the text to the client. The advertisement details are stored in mktg_creative table and advertisement properties are stored in mktg_creative_property_value table.

So far we have discussed what are display types and how they are stored in SQL server. Lets see how can we create a custom display type which will render flash advertisements in the browser.

 To create a new display template for Flash, you should know the formatted HTML tags to render flash objects. Identify the properties that needs input from the user. For example, the HTML tags required to render flash object is

    <!–    <OBJECT classid=”clsid:D27CDB6E-AE6D-11cf-96B8-44455354FFFF” codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0“     WIDTH=”475″ HEIGHT=”475″ id=”FlashContent”>
    <PARAM NAME=movie VALUE=”advertisement.swf”>
    <PARAM NAME=quality VALUE=high>
    <PARAM NAME=”AllowScriptAccess” VALUE=”never”>
    <EMBED src=”advdrtisment.swf”
    quality=”high” WIDTH=”550″ HEIGHT=”400″ NAME=”FlashContent” AllowScriptAccess=”never”     TYPE=”application/x-shockwave-flash” PLUGINSPAGE=”http://www.macromedia.com/go/getflashplayer”>
    </EMBED>
    </OBJECT> –>

If you observe the HTML, to make the template dynamic we should accept few properties from the user and replace these user provided values with tokens. In the above case, we can make width, height and flash URL as properties.

    <!–    <OBJECT classid=”clsid:D27CDB6E-AE6D-11cf-96B8-44455354FFFF” codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0“     WIDTH=”{%width%}” HEIGHT=”{%height%}” id=”FlashContent”>
    <PARAM NAME=movie VALUE=”{%flashURL%}”>
    <PARAM NAME=quality VALUE=high>
    <PARAM NAME=”AllowScriptAccess” VALUE=”never”>
    <EMBED src=”{%flashURL%}”
    quality=”high” WIDTH=”{%width%}” HEIGHT=”{%height%}” NAME=”FlashContent” AllowScriptAccess=”never” TYPE=”application/x-shockwave-flash” PLUGINSPAGE=”http://www.macromedia.com/go/getflashplayer”>
    </EMBED>
    </OBJECT> –>

The next step is to create display template in to marketing system.You can find the code block on msdn to create or modify the DisplayTemplate and the URL is http://msdn.microsoft.com/hi-in/library/aa545356(en-us).aspx

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.CommerceServer.Marketing;namespace CreatingNewTemplate
{
class Program
{
static void Main(string[] args)
{
try
{
string campaignServiceUrl = @http://localhost/MarketingWebService/MarketingWebService.asmx;
MarketingServiceAgent ma = new MarketingServiceAgent(campaignServiceUrl);
MarketingContext marketingSystem = MarketingContext.Create(ma);// Create a new template.
DisplayTemplate template = marketingSystem.DisplayTemplates.NewDisplayTemplate();
template.Name = “Flash”;
template.Text = @”<OBJECT classid=”"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″” codebase=”"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0″” WIDTH=”"{%width%}”" HEIGHT=”"{%height%}”" id=”"FlashContent”"><PARAM NAME=movie VALUE=”"{%flashURL%}”"><PARAM NAME=quality VALUE=high><PARAM NAME=”"AllowScriptAccess”" VALUE=”"never”"><EMBED src=”"{%flashURL%}”" quality=”"high”" WIDTH=”"{%width%}”" HEIGHT=”"{%height%}”" NAME=”"FlashContent”" AllowScriptAccess=”"never”" TYPE=”"application/x-shockwave-flash”" PLUGINSPAGE=”"http://www.macromedia.com/go/getflashplayer”"></EMBED></OBJECT> “;

DisplayProperty property = new DisplayProperty(”Width”);
property.Type = DisplayPropertyType.Text;
property.DefaultValue = “100%”;
property.Label = “Width”;
template.Properties.Add(property);

property = new DisplayProperty(”Height”);
property.Type = DisplayPropertyType.Text;
property.DefaultValue = “100%”;
property.Label = “Height”;
template.Properties.Add(property);

property = new DisplayProperty(”flashURL”);
property.Type = DisplayPropertyType.Text;
property.Label = “Flash URL”;
template.Properties.Add(property);
template.Save();

// Template Success Created!
Console.WriteLine(”Successfully created template: {0}”, template.Name);
}
catch (Exception e)
{
Console.WriteLine(e.StackTrace);
}
}
}
}

Once you have executed the above code, you can see a new display type template was added to your site and when you create a new advertisement, you will find the template “Flash” is shown in display type and when you select it then the corresponding properties are shown in the next slide as shown below.

New Display Type properties

So, what are you waiting far. Start creating different display types and make your e-commerce site flashy with different types of advertisement.

Categories
commerce server 2007
Tags
commerce server 2007 Display Types
Comments rss
Comments rss
Trackback
Trackback

« Update Commerce Server Inventory Through SQL How many promotion codes are used in Commerce Server? »

One Response to “Creating Custom Display Types in Commerce Server”

  1. Commerce Server Blog » Show Silverlight Advertisements in Commerce Server says:
    December 16, 2009 at 10:54 pm

    [...] blog is continuation to my blog entry “Creating custom display types in commerce server”. In my previous blog entry, I have explained how can we display adobe flash advertisements and [...]

    Reply

Leave a Reply

Click here to cancel reply.

Powered by WP Hashcash

Sign up for Newsletter


Categories

Quiz

  • Catalog Quiz for Beginners
  • Profile Quiz for Beginners
  • Quiz 1 for Advance Users
  • Quiz for Beginners

Recent Posts

  • RCXml2Resx.exe tool stops working
  • Commerce Server Profile Importer Tool
  • Marketing Web service Exception: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM
  • Download Commerce Server 2009 Help Document
  • Commerce Server 2009 work with SharePoint 2010?
  • Failed to set value for profile property ‘email_address’.
  • ArgumentException: An item with the same key has already been added.
  • Please note that one or more items were removed from your order because the product is no longer sold.
  • How to Avoid Duplicate Orders Numbers in Commerce Server
  • Error: Microsoft.Commerce.Contracts.Faults.ItemDoesNotExistFault

Archives

  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008

Tags

add discounts add images to profile Advantages of commerce server approve discounts authentication auto login process automatic user creation basket Brand Management business tools campaign management Catalog catalog import Category CategoryConfiguration commerce server commerce server 2007 commerce server manager Commerce Server SP2 discounts ecommerce Estimation Installation inventory Kanth Koppala marketing system migration error Mojave operation components operation sequence Order subsystem Product profile profile subsystem property metadata purchase order quick checkout Ravi Ravi Kanth site cache refresh starter site tools transactions error Variant
(c) 2009 Commerce Server Blog. All rights Reserved. Articles cannot be reproduced without permission from the author.Write to me at kanth@ravikanth.net if you have any comments, questions, suggestions about this site or would like to send us a tip
About Us | Terms of Use | Disclaimer | Advertise .