Content Selection Framework - Can't get Discounts to Show or Apply (FP1) - HELP?!

This is Interesting: Free IT Magazines  
Home > Archive > Content Selection Framework > October 2004 > Can't get Discounts to Show or Apply (FP1) - HELP?!





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 Can't get Discounts to Show or Apply (FP1) - HELP?!
Shai

2004-10-02, 8:59 pm

I had campaigns working on a CS2k2 before, but I just added FP1. I
love the Discount Manager -- its very easy to use, but after approving
the new discount, it doens't show up at all on the site. No errors in
the pipeline logs, etc. I don't know what's wrong. Simple Order
Discount: Buy Any Product(s), Value over $20, get %10 Off of
SubTotal. No Expressions Added, wanted it to apply to every order.

OrderDiscount and OrderDiscountApply components are in the pipeline.
Using Classic ASP site.

I used the retail2000 (not 2002) solution and customized everything.
The code in teh basket.asp :

Set mscsOrderForm =
mscsOrderGrp.Value(ORDERFORMS).Value(sOrderFormName)
If mscsOrderForm.Value("_winners").Count > 0 Then
bDiscountApplied = True
End If

And of course, all the functionality occurs when bDiscountApplied =
true. So far, I got nothing. I've ran an IISRESET, rebooted the
server, etc. thinking it might be some cache thing as that was the
case with 2002 and 2000.

HELP!?!?


Shai
Madhur Joshi

2004-10-15, 9:11 pm

The first thing to check will be whether your discounts are getting loaded
into the discounts cache.
You can use the below script to dump out all the discounts that are being
loaded into the cache (replace the SITENAME variable with your site name)
Apart from that, refer to the "Ads or disocunts do not appear on the Web
site section" (under Troubleshooting Commerce Server -> Troubleshooting
your application). It provides details on how you can diagnose what is
going wrong here.

Hope that helps,
madhur

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
© 2004 Microsoft Corporation. All rights reserved.

================== Begin Script Snippet =========================

' LoadDiscounts.vbs
'
' Dumps all the Discounts to stdout
' Run with cscript.exe


const SITENAME = "retail"


' MAIN
dim connectionString
connectionString = GetConnStr()
Call EnumKeys()


' ================== Functions ==================

function GetConnStr()
set oSiteConfig = CreateObject("Commerce.SiteConfigReadOnly")
oSiteConfig.Initialize(SITENAME)
set oFields = oSiteConfig.Fields("Marketing").Value
GetConnStr = oFields("connstr_db_marketing").Value
end function


' Enumerate all the key/value pairs in the ContentList rows
Sub EnumKeys
Set list = GetDiscounts
Call OutputStart("EnumKeys")
Set oRows = list.AllRows
For Each oFields in oRows
For each oField in oFields
sOut = oField.Name & "="
If IsNull(oField.Value) then
Wscript.echo sout & "<NULL>"
Elseif IsObject(oField.Value) then
Wscript.echo sOut & "<OBJECT>"
If oField.Name = "values" then
call DumpValues(oField.Value)
End If
ElseIf IsArray(oField.Value) then
Wscript.Echo sOut & "<ARRAY>"
DumpArray(oField.Value)
Else
Wscript.Echo sOut & oField.Value
End If

Next
WScript.Echo
Next
End Sub


' ================== Output methods ==================


Sub OutputStart(str)
wscript.echo(vbcrlf & "============" & str & "================")
End Sub


Sub DumpArray(arr)
If (IsNull(arr)) then
Wscript.echo(" <NULL ARRAY>")
Exit Sub
End If

Wscript.echo(" Array contains " & cstr(UBound(arr) - LBound(arr) + 1) &
" items")
For each item in arr
If not IsObject(item) And Not IsNull(item) then
Wscript.echo(" " & cstr(item))
End If
Next
End Sub

Sub DumpValues(dict)
For Each key In dict
WScript.Echo(" value: " & key & "=" & dict(key))
Next
End Sub


Sub DumpSchema(oContentListFactory)
Dim oSchema, i, arrColTypes
arrColTypes = array("", "", "short (CLCOL_I2)", "int (CLCOL_I4)", "real
(CLCOL_R4)", _
"double-precision real (CLCOL_R8)", "currency (CLCOL_CY)",
"date/time (CLCOL_DATE)", _
"", "IDispatch (CLCOL_DISPATCH)", "", "Boolean (CLCOL_BOOL)", "",
"IUnknown (CLCOL_UNKNOWN)", _
"String (CLCOL_STRING)", "SafeArray (CLCOL_VARIANTARRAY)")
Set oSchema = oContentListFactory.Schema
For i = 0 to oSchema.count - 1
WScript.Echo("Column " & i)
WScript.Echo(vbTab & "ColumnName: " & oSchema.ColumnName(i))
WScript.Echo(vbTab & "ColumnType: " &
arrColTypes(oSchema.ColumnType(i)) )
WScript.Echo(vbTab & "ColumnFlags: " &
GetFlagsAsString(oSchema.ColumnFlags(i)) )
Next
End Sub


Function GetFlagsAsString(lFlags)
Dim sFlags
sFlags = CStr(lFlags) & " ("
If lFlags = 0 Then sFlags = sFlags & "DEFAULT | "
If lFlags And 1 Then sFlags = sFlags & "CLCOL_READONLY | "
If lFlags And 2 Then sFlags = sFlags & "CLCOL_PRIVATE | "
If lFlags And 4 Then sFlags = sFlags & "CLCOL_SCORE_COLUMN | "

GetFlagsAsString = Mid(sFlags, 1, Len(sFlags)-3) & ")"

End Function

' =================== Loader component ====================


Function GetDiscounts
' uses CacheManager
Set dictConfig = CreateObject("Commerce.Dictionary")
dictConfig.ConnectionString = CONNECTIONSTRING
Set oCacheManager = CreateObject("Commerce.CacheManager")
Set oCacheManager.LoaderConfig("Discounts") = dictConfig
oCacheManager.LoaderProgId("Discounts") = "Commerce.CSFLoadDiscounts"
oCacheManager.RefreshInterval("Discounts") = 900

Set dictCache = oCacheManager.GetCache("Discounts")


WScript.Echo("Cache timestamp: " & cstr(dictCache("_CacheTimestamp")))
WScript.Echo("Cache name: " & dictCache("_CacheName"))
WScript.Echo("Cache refresh interval: " &
dictCache("_CacheRefreshINterval"))

Set Factory = dictCache("Factory")
DumpSchema(factory)

Set GetDiscounts = factory.CreateNewContentList()
GetDiscounts.TraceMode = g_fTrace

End Function

================== End Script Snippet =========================

--------------------
From: mistershyguy@hotmail.com (Shai)
Newsgroups: microsoft.public.commerceserver.campaigns_csf
Subject: Can't get Discounts to Show or Apply (FP1) - HELP?!

I had campaigns working on a CS2k2 before, but I just added FP1. I
love the Discount Manager -- its very easy to use, but after approving
the new discount, it doens't show up at all on the site. No errors in
the pipeline logs, etc. I don't know what's wrong. Simple Order
Discount: Buy Any Product(s), Value over $20, get %10 Off of
SubTotal. No Expressions Added, wanted it to apply to every order.

OrderDiscount and OrderDiscountApply components are in the pipeline.
Using Classic ASP site.

I used the retail2000 (not 2002) solution and customized everything.
The code in teh basket.asp :

Set mscsOrderForm =
mscsOrderGrp.Value(ORDERFORMS).Value(sOrderFormName)
If mscsOrderForm.Value("_winners").Count > 0 Then
bDiscountApplied = True
End If

And of course, all the functionality occurs when bDiscountApplied =
true. So far, I got nothing. I've ran an IISRESET, rebooted the
server, etc. thinking it might be some cache thing as that was the
case with 2002 and 2000.

HELP!?!?


Shai

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com