Content Selection Framework - how to get a list of discounts applicable for a product/SKU

This is Interesting: Free IT Magazines  
Home > Archive > Content Selection Framework > June 2004 > how to get a list of discounts applicable for a product/SKU





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author how to get a list of discounts applicable for a product/SKU
Ravi Shankar

2004-05-01, 7:34 am


As part of the site we're building the customer has a
requirement that states that they would like to see all
discounts applicable for a product/SKU to be visible on
the product listing page.

I have gone through the documentation (probably not with
sufficient thoroughness) but am at a loss on how for
every product I can query the CFS for all possible
discounts available on it...

Any pointers welcome

Regards.
Ravi.
Andy Xu[MSFT]

2004-05-05, 9:36 pm

Ravi,

Unfornately, there is no direct out-of-box solution for the scenario you describe, which is more like predict discounts based on product. The content selection feature provided by
Commerce Server 2002 is to show ad/discount targetted by user profile or target context. What you want is targetted by product/SKU.

A workaround I can think of is to add a property to targeting context, for example, called "TargetedProduct". for each discount, you create a target expression, which is
TargetingContext.TargetedProduct = <SKU value>". And in the runtime code, for each request to the product page, your site code is in charge of adding corresponding SKU(s) to the
targeting context's TargetedProduct property. (CommerceContext.Current.TargetingSystem.TargetingContextProfile ) And running ContentSelector should get the targetted discounts.

The problem is, of course, if you have multiple products in one page, you will probably get more than one returned applicable discounts. You probably have to use the site code to
mapping the returned discount to show with the correct product.

HTH,

Andy Xu [MSFT]
Commerce Server Team
--
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
--------------------
Content-Class: urn:content-classes:message
From: "Ravi Shankar" <shankar.nospam@hp.com>
Sender: "Ravi Shankar" <shankar.nospam@hp.com>
Subject: how to get a list of discounts applicable for a product/SKU
Date: Sat, 1 May 2004 03:55:23 -0700
Lines: 15
Message-ID: <6f6b01c42f6a$cdc64b20$a101280a@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcQvas3G/7jH3b5dTSmKM+rVrGQnwg==
Newsgroups: microsoft.public.commerceserver.campaigns_csf
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.commerceserver.campaigns_csf:2625
NNTP-Posting-Host: tk2msftngxa09.phx.gbl 10.40.1.161
X-Tomcat-NG: microsoft.public.commerceserver.campaigns_csf


As part of the site we're building the customer has a
requirement that states that they would like to see all
discounts applicable for a product/SKU to be visible on
the product listing page.

I have gone through the documentation (probably not with
sufficient thoroughness) but am at a loss on how for
every product I can query the CFS for all possible
discounts available on it...

Any pointers welcome

Regards.
Ravi.


Ravi Shankar

2004-06-26, 10:50 am

I have done the following

1. Extended the "Targeting Context" Profile by adding a
field "TargetProduct"

2. Based on this using BizDesk I created a "Target
Group" where the Expression is TargetProduct="SKU" and
the Action is "Target"

3. In an advertising campaign I created an Advertisement
where "Page Group" was "ALL" and the above TargetGroup
was the assigned target group.

4. I'm trying to retrieve the ad like so...

Dim oCommerceContext As CommerceContext
Dim oCS As ContentSelector

oCommerceContext = CommerceContext.Current
oCommerceContext.TargetingSystem.TargetingContextProfile
("PageGroup").Value = "All"
oCommerceContext.TargetingSystem.TargetingContextProfile
("TargetProduct").Value = ProductID

oCS = oCommerceContext.TargetingSystem.SelectionContexts
("Advertising").GetSelector()
If Not oCS Is Nothing Then
oCS.Profiles.Add("targetingContext",
oCommerceContext.TargetingSystem.TargetingContextProfile)

If oCommerceContext.AuthenticationInfo.IsAuthenticated
() Then
oCS.Profiles.Add("user",
oCommerceContext.UserProfile)
End If

oCS.ItemsRequested = 3
oCS.Size = "Button1"
m_arDiscounts = oCS.GetContent()

If m_arDiscounts.Count > 0 Then
productDiscountsDisplay.DataSource = m_arDiscounts
productDiscountsDisplay.DataBind()
End If
End If

Now what is happening is that the ad is being shown for
every product, While I wanted only where the target group
condition is true.

Is there something I missed ? How can cause the selection
framework to return this only when the target group is
exactly matched.

HELP !

>-----Original Message-----
>Ravi,
>
>Unfornately, there is no direct out-of-box solution for

the scenario you describe, which is more like predict
discounts based on product. The content selection feature
provided by
>Commerce Server 2002 is to show ad/discount targetted by

user profile or target context. What you want is
targetted by product/SKU.
>
>A workaround I can think of is to add a property to

targeting context, for example,
called "TargetedProduct". for each discount, you create
a target expression, which is
>TargetingContext.TargetedProduct = <SKU value>". And in

the runtime code, for each request to the product page,
your site code is in charge of adding corresponding SKU
(s) to the
>targeting context's TargetedProduct property.

(CommerceContext.Current.TargetingSystem.TargetingContextP
rofile ) And running ContentSelector should get the
targetted discounts.
>
>The problem is, of course, if you have multiple products

in one page, you will probably get more than one returned
applicable discounts. You probably have to use the site
code to
>mapping the returned discount to show with the correct

product.
>
>HTH,
>
>Andy Xu [MSFT]
>Commerce Server Team
>--
>This posting is provided "AS IS" with no warranties, and

confers no rights. Use of included script samples are
subject to the terms specified at
>http://www.microsoft.com/info/cpyright.htm
>
>Note: For the benefit of the community-at-large, all

responses to this message are best directed to the
newsgroup/thread from which they originated.
>--------------------
>Content-Class: urn:content-classes:message
>From: "Ravi Shankar" <shankar.nospam@hp.com>
>Sender: "Ravi Shankar" <shankar.nospam@hp.com>
>Subject: how to get a list of discounts applicable for a

product/SKU
>Date: Sat, 1 May 2004 03:55:23 -0700
>Lines: 15
>Message-ID: <6f6b01c42f6a$cdc64b20$a101280a@phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Thread-Index: AcQvas3G/7jH3b5dTSmKM+rVrGQnwg==
>Newsgroups: microsoft.public.commerceserver.campaigns_csf
>Path: cpmsftngxa10.phx.gbl
>Xref: cpmsftngxa10.phx.gbl

microsoft.public.commerceserver.campaigns_csf:2625
>NNTP-Posting-Host: tk2msftngxa09.phx.gbl 10.40.1.161
>X-Tomcat-NG:

microsoft.public.commerceserver.campaigns_csf
>
>
>As part of the site we're building the customer has a
>requirement that states that they would like to see all
>discounts applicable for a product/SKU to be visible on
>the product listing page.
>
>I have gone through the documentation (probably not with
>sufficient thoroughness) but am at a loss on how for
>every product I can query the CFS for all possible
>discounts available on it...
>
>Any pointers welcome
>
>Regards.
>Ravi.
>
>

Ravi Shankar

2004-06-26, 10:50 am

Solved it.. the issue was with the target group
definition, setting the action to "Require" as opposed
to "Target" resolved the display portion.


>-----Original Message-----
>I have done the following
>
> 1. Extended the "Targeting Context" Profile by adding a
>field "TargetProduct"
>
> 2. Based on this using BizDesk I created a "Target
>Group" where the Expression is TargetProduct="SKU" and
>the Action is "Target"
>
> 3. In an advertising campaign I created an

Advertisement
>where "Page Group" was "ALL" and the above TargetGroup
>was the assigned target group.
>
> 4. I'm trying to retrieve the ad like so...
>
> Dim oCommerceContext As CommerceContext
> Dim oCS As ContentSelector
>
> oCommerceContext = CommerceContext.Current
>

oCommerceContext.TargetingSystem.TargetingContextProfile
>("PageGroup").Value = "All"
>

oCommerceContext.TargetingSystem.TargetingContextProfile
>("TargetProduct").Value = ProductID
>
> oCS =

oCommerceContext.TargetingSystem.SelectionContexts
>("Advertising").GetSelector()
> If Not oCS Is Nothing Then
> oCS.Profiles.Add("targetingContext",
>oCommerceContext.TargetingSystem.TargetingContextProfile)
>
> If

oCommerceContext.AuthenticationInfo.IsAuthenticated
>() Then
> oCS.Profiles.Add("user",
>oCommerceContext.UserProfile)
> End If
>
> oCS.ItemsRequested = 3
> oCS.Size = "Button1"
> m_arDiscounts = oCS.GetContent()
>
> If m_arDiscounts.Count > 0 Then
> productDiscountsDisplay.DataSource =

m_arDiscounts
> productDiscountsDisplay.DataBind()
> End If
> End If
>
>Now what is happening is that the ad is being shown for
>every product, While I wanted only where the target

group
>condition is true.
>
>Is there something I missed ? How can cause the

selection
>framework to return this only when the target group is
>exactly matched.
>
>HELP !
>
>the scenario you describe, which is more like predict
>discounts based on product. The content selection

feature
>provided by
by[vbcol=seagreen]
>user profile or target context. What you want is
>targetted by product/SKU.
>targeting context, for example,
>called "TargetedProduct". for each discount, you create
>a target expression, which is
>the runtime code, for each request to the product page,
>your site code is in charge of adding corresponding SKU
>(s) to the
>

(CommerceContext.Current.TargetingSystem.TargetingContextP
>rofile ) And running ContentSelector should get the
>targetted discounts.
products[vbcol=seagreen]
>in one page, you will probably get more than one

returned
>applicable discounts. You probably have to use the site
>code to
>product.
and[vbcol=seagreen]
>confers no rights. Use of included script samples are
>subject to the terms specified at
>responses to this message are best directed to the
>newsgroup/thread from which they originated.
a[vbcol=seagreen]
>product/SKU
microsoft.public.commerceserver.campaigns_csf[vbcol=seagreen]
>microsoft.public.commerceserver.campaigns_csf:2625
>microsoft.public.commerceserver.campaigns_csf
with[vbcol=seagreen]
>.
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com