|
Home > Archive > Commerce Server General > September 2006 > CS2007: Can SiteTerms ranked?
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 |
CS2007: Can SiteTerms ranked?
|
|
| Pascal 2006-09-16, 7:28 pm |
| hi,
what would be the best approach for "ranking" site terms in a similar
fashion products can be ranked (sequenced) in the catalog. I don't want them
to be in alphabetical order but having the possibility of a business user to
determine the order in which the site terms are presented to the customer.
It does seem I would either need to extend the MemAttrib table, use my own
stored proc and UI (ext to Smart Client just for that...) OR holding
somewhere an array of site term names ranked the way I want, providing my own
UI (again) and handling the sequence logic in the code (via wrapper class).
Is there a better approach requiring less effort? I would really like
avoiding changing the Cust & Ord mgr for such a simple requirement.
Thanks
| |
| David Messner [MSFT] 2006-09-16, 7:28 pm |
| Pascal,
The first thing that comes to mind is to define your site term values
(referred to as the term "names" in both the Customer and Orders Manager UI
and in the CS2002 BizDesk, go figure) in an order that you can use to
rank/sort them on the site. You would then use the DisplayNames of the
SiteTerms to actually show to the user in the order sorted by value. Of
course this presumes you have control over the values you are you using for
your site terms and don't need to use the values for other purposes.
Unfortunately the default SiteTermElement CompareTo implementation sorts by
DisplayName (SiteTermElement.Name), not what you want here. So you'll need
to be aware of that and provide your own sorting.
The below code sample shows how you can enumerate all the Site Terms from
the rumtime.
using Microsoft.CommerceServer.Runtime;
using Microsoft.CommerceServer.Runtime.Profiles;
private void IterateSiteTerms()
{
ProfileContext profiles = CommerceContext.Current.ProfileSystem;
ArrayList names = profiles.SiteTermNames;
foreach (string name in names)
{
Response.Write(string.Format("<p>SiteTerm={0}</p>\n", name));
SiteTerm term = profiles.GetSiteTerm(name);
SiteTermElementCollection elements = term.Elements;
foreach (SiteTermElement element in elements)
{
Response.Write(string.Format("Name={0} value={1}<br/>",
element.Name, element.Value));
}
}
}
[Partial output]:
SiteTerm=UserRole
Name=Normal User value=1
Name=Administrator value=2
SiteTerm=Days
Name=Sunday value=0
Name=Monday value=1
Name=Tuesday value=2
Name=Wednesday value=3
Name=Thursday value=4
Name=Friday value=5
Name=Saturday value=6
Good luck
-djm
--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2006 Microsoft Corporation. All rights
reserved.
--------------------
From: =?Utf-8?B?UGFzY2Fs?= <Pascal@discussions.microsoft.com>
Subject: CS2007: Can SiteTerms ranked?
Date: Thu, 14 Sep 2006 14:07:02 -0700
hi,
what would be the best approach for "ranking" site terms in a similar
fashion products can be ranked (sequenced) in the catalog. I don't want
them
to be in alphabetical order but having the possibility of a business user
to
determine the order in which the site terms are presented to the customer.
It does seem I would either need to extend the MemAttrib table, use my own
stored proc and UI (ext to Smart Client just for that...) OR holding
somewhere an array of site term names ranked the way I want, providing my
own
UI (again) and handling the sequence logic in the code (via wrapper class).
Is there a better approach requiring less effort? I would really like
avoiding changing the Cust & Ord mgr for such a simple requirement.
Thanks
| |
| Pascal 2006-09-18, 7:36 pm |
| If I understand you right, your suggestion is to use the "Names" field for
ranking the site terms. I thought about that but is not flexibile as you add
new site terms or you simply want to re-sort them. Once you set the Name
field you cannot really change them without the pain of values of changing
all references to that site terms (including multi-value site term
attributes.. yikes)
"David Messner [MSFT]" wrote:
> Pascal,
>
> The first thing that comes to mind is to define your site term values
> (referred to as the term "names" in both the Customer and Orders Manager UI
> and in the CS2002 BizDesk, go figure) in an order that you can use to
> rank/sort them on the site. You would then use the DisplayNames of the
> SiteTerms to actually show to the user in the order sorted by value. Of
> course this presumes you have control over the values you are you using for
> your site terms and don't need to use the values for other purposes.
>
> Unfortunately the default SiteTermElement CompareTo implementation sorts by
> DisplayName (SiteTermElement.Name), not what you want here. So you'll need
> to be aware of that and provide your own sorting.
>
> The below code sample shows how you can enumerate all the Site Terms from
> the rumtime.
>
> using Microsoft.CommerceServer.Runtime;
> using Microsoft.CommerceServer.Runtime.Profiles;
>
> private void IterateSiteTerms()
> {
> ProfileContext profiles = CommerceContext.Current.ProfileSystem;
> ArrayList names = profiles.SiteTermNames;
> foreach (string name in names)
> {
> Response.Write(string.Format("<p>SiteTerm={0}</p>\n", name));
> SiteTerm term = profiles.GetSiteTerm(name);
> SiteTermElementCollection elements = term.Elements;
> foreach (SiteTermElement element in elements)
> {
> Response.Write(string.Format("Name={0} value={1}<br/>",
> element.Name, element.Value));
> }
> }
>
> }
>
> [Partial output]:
>
> SiteTerm=UserRole
>
> Name=Normal User value=1
> Name=Administrator value=2
>
> SiteTerm=Days
>
> Name=Sunday value=0
> Name=Monday value=1
> Name=Tuesday value=2
> Name=Wednesday value=3
> Name=Thursday value=4
> Name=Friday value=5
> Name=Saturday value=6
>
> Good luck
> -djm
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> You assume all risk for your use. © 2006 Microsoft Corporation. All rights
> reserved.
>
> --------------------
> From: =?Utf-8?B?UGFzY2Fs?= <Pascal@discussions.microsoft.com>
> Subject: CS2007: Can SiteTerms ranked?
> Date: Thu, 14 Sep 2006 14:07:02 -0700
>
>
> hi,
> what would be the best approach for "ranking" site terms in a similar
> fashion products can be ranked (sequenced) in the catalog. I don't want
> them
> to be in alphabetical order but having the possibility of a business user
> to
> determine the order in which the site terms are presented to the customer.
>
> It does seem I would either need to extend the MemAttrib table, use my own
> stored proc and UI (ext to Smart Client just for that...) OR holding
> somewhere an array of site term names ranked the way I want, providing my
> own
> UI (again) and handling the sequence logic in the code (via wrapper class).
>
> Is there a better approach requiring less effort? I would really like
> avoiding changing the Cust & Ord mgr for such a simple requirement.
>
> Thanks
>
| |
| David Messner [MSFT] 2006-09-19, 1:28 am |
|
Yes, you are correct, if you expect to be adding or changing values this
solution won't work. Given that ranking isn't a capability of the site
terms feature, you're back to the sort of workarounds you originally
suggested. Changing the stored procs included with Commerce Server is not
strictly supported, so I can't suggest you go there.
We'll certainly take this scenario into account in future development work.
Thanks for raising it.
regards
-David
--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2006 Microsoft Corporation. All rights
reserved.
--------------------
From: =?Utf-8?B?UGFzY2Fs?= <Pascal@discussions.microsoft.com>
Subject: RE: CS2007: Can SiteTerms ranked?
Date: Mon, 18 Sep 2006 12:53:03 -0700
If I understand you right, your suggestion is to use the "Names" field for
ranking the site terms. I thought about that but is not flexibile as you
add
new site terms or you simply want to re-sort them. Once you set the Name
field you cannot really change them without the pain of values of changing
all references to that site terms (including multi-value site term
attributes.. yikes)
"David Messner [MSFT]" wrote:
> Pascal,
>
> The first thing that comes to mind is to define your site term values
> (referred to as the term "names" in both the Customer and Orders Manager
UI
> and in the CS2002 BizDesk, go figure) in an order that you can use to
> rank/sort them on the site. You would then use the DisplayNames of the
> SiteTerms to actually show to the user in the order sorted by value. Of
> course this presumes you have control over the values you are you using
for
> your site terms and don't need to use the values for other purposes.
>
> Unfortunately the default SiteTermElement CompareTo implementation sorts
by
> DisplayName (SiteTermElement.Name), not what you want here. So you'll
need
> to be aware of that and provide your own sorting.
>
> The below code sample shows how you can enumerate all the Site Terms from
> the rumtime.
>
> using Microsoft.CommerceServer.Runtime;
> using Microsoft.CommerceServer.Runtime.Profiles;
>
> private void IterateSiteTerms()
> {
> ProfileContext profiles = CommerceContext.Current.ProfileSystem;
> ArrayList names = profiles.SiteTermNames;
> foreach (string name in names)
> {
> Response.Write(string.Format("<p>SiteTerm={0}</p>\n", name));
> SiteTerm term = profiles.GetSiteTerm(name);
> SiteTermElementCollection elements = term.Elements;
> foreach (SiteTermElement element in elements)
> {
> Response.Write(string.Format("Name={0} value={1}<br/>",
> element.Name, element.Value));
> }
> }
>
> }
>
> [Partial output]:
>
> SiteTerm=UserRole
>
> Name=Normal User value=1
> Name=Administrator value=2
>
> SiteTerm=Days
>
> Name=Sunday value=0
> Name=Monday value=1
> Name=Tuesday value=2
> Name=Wednesday value=3
> Name=Thursday value=4
> Name=Friday value=5
> Name=Saturday value=6
>
> Good luck
> -djm
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use. © 2006 Microsoft Corporation. All
rights
> reserved.
>
> --------------------
> From: =?Utf-8?B?UGFzY2Fs?= <Pascal@discussions.microsoft.com>
> Subject: CS2007: Can SiteTerms ranked?
> Date: Thu, 14 Sep 2006 14:07:02 -0700
>
>
> hi,
> what would be the best approach for "ranking" site terms in a similar
> fashion products can be ranked (sequenced) in the catalog. I don't want
> them
> to be in alphabetical order but having the possibility of a business user
> to
> determine the order in which the site terms are presented to the customer.
>
> It does seem I would either need to extend the MemAttrib table, use my
own
> stored proc and UI (ext to Smart Client just for that...) OR holding
> somewhere an array of site term names ranked the way I want, providing my
> own
> UI (again) and handling the sequence logic in the code (via wrapper
class).
>
> Is there a better approach requiring less effort? I would really like
> avoiding changing the Cust & Ord mgr for such a simple requirement.
>
> Thanks
>
| |
| Pascal 2006-09-19, 1:25 pm |
| And btw, multi-lingual support for Site Term would be a great add-on too but
you already know that one ;) and the workaround has been documented already.
Thanks David,
Pascal
"David Messner [MSFT]" wrote:
>
> Yes, you are correct, if you expect to be adding or changing values this
> solution won't work. Given that ranking isn't a capability of the site
> terms feature, you're back to the sort of workarounds you originally
> suggested. Changing the stored procs included with Commerce Server is not
> strictly supported, so I can't suggest you go there.
>
> We'll certainly take this scenario into account in future development work.
> Thanks for raising it.
>
> regards
> -David
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> You assume all risk for your use. © 2006 Microsoft Corporation. All rights
> reserved.
>
> --------------------
> From: =?Utf-8?B?UGFzY2Fs?= <Pascal@discussions.microsoft.com>
> Subject: RE: CS2007: Can SiteTerms ranked?
> Date: Mon, 18 Sep 2006 12:53:03 -0700
>
>
> If I understand you right, your suggestion is to use the "Names" field for
> ranking the site terms. I thought about that but is not flexibile as you
> add
> new site terms or you simply want to re-sort them. Once you set the Name
> field you cannot really change them without the pain of values of changing
> all references to that site terms (including multi-value site term
> attributes.. yikes)
>
> "David Messner [MSFT]" wrote:
>
> UI
> for
> by
> need
> rights.
> rights
> own
> class).
>
|
|
|
|
|