<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0">
  <channel>
    <title>blog.brianh.dk - Commerce Server</title>
    <link>http://blog.brianh.dk/</link>
    <description>My personal blog about working with Microsoft .NET technology from Aarhus, Denmark</description>
    <language>en-us</language>
    <copyright>Brian Holmgård Kristensen</copyright>
    <lastBuildDate>Mon, 06 Sep 2010 06:54:00 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>bhk@yourhost.dk</managingEditor>
    <webMaster>bhk@yourhost.dk</webMaster>
    <item>
      <trackback:ping>http://blog.brianh.dk/Trackback.aspx?guid=ff65ec7c-8922-4dd0-9b9c-f25f79999452</trackback:ping>
      <pingback:server>http://blog.brianh.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.brianh.dk/PermaLink,guid,ff65ec7c-8922-4dd0-9b9c-f25f79999452.aspx</pingback:target>
      <dc:creator>Brian Holmgård Kristensen</dc:creator>
      <wfw:comment>http://blog.brianh.dk/CommentView,guid,ff65ec7c-8922-4dd0-9b9c-f25f79999452.aspx</wfw:comment>
      <wfw:commentRss>http://blog.brianh.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=ff65ec7c-8922-4dd0-9b9c-f25f79999452</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There is a built-in restriction in the new Commerce Server 2009 Foundation API (MCCF
- Multi Channel Commerce Foundation) to only expect one OrderForm instance on the
aggregate root, being the OrderGroup. An OrderGroup is either a Basket or PurchaseOrder
(or OrderTemplate if you are using that).
</p>
        <p>
Below is a simplified diagram of the key classes in the Object Model for the Orders
System. Please notice that we have the OrderForms collection on the OrderGroup class,
where each instance of an OrderForm can be retrieved either by index or by a name
(string). 
</p>
        <p>
          <a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/OnlyoneOrderForminCommerceServer2009_B453/ClassHierachy_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Orders API - class hierachy" border="0" alt="Orders API - class hierachy" src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/OnlyoneOrderForminCommerceServer2009_B453/ClassHierachy_thumb.png" width="490" height="506" />
          </a>
        </p>
        <p>
This allows us to create multiple OrderForms, each with their own data like Line Items,
Payments, Shipments etc, and share other data like Addresses, TrackingNumber and a
few more properties on the OrderGroup class. 
</p>
        <p>
In all projects I’ve been working on we don’t actually use the ability to have multiple
OrderForms. We only have one single OrderForm at all times.
</p>
        <p>
The Commerce Server 2007 code would then look something like:
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>Basket basket = OrderContext.Current.GetBasket(userId,
basketName);</pre>
          <pre>
            <span class="lnum"> 2: </span> </pre>
          <pre>
            <span class="lnum"> 3: </span>
            <span class="kwrd">if</span> (basket.OrderForms.Count
== 0)</pre>
          <pre>
            <span class="lnum"> 4: </span> basket.OrderForms.Add(<span class="kwrd">new</span> OrderForm());</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
 
</p>
        <p>
This retrieves a named Basket from the Orders System and if the basket is new, it
will create an instance of OrderForm and add this to the OrderForms collection.
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>basket.OrderForms[0].LineItems.Add(</pre>
          <pre>
            <span class="lnum"> 2: </span>
            <span class="kwrd">new</span> LineItem(<span class="str">"ProductCatalog"</span>, <span class="str">"ProductID"</span>, <span class="str">"VariantID"</span>,
1m));</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
 
</p>
        <p>
At some point we would then like to add a Line Item to our basket as illustrated above
where we hardcode the index-value to 0 to retrieve the one and only OrderForm we have.
</p>
        <p>
In Commerce Server 2009 though, we never deal with the actual types, instead we work
with the ICommerceEntity type. The Commerce Server 2009 code for retrieving a basket
would be something like:
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>var query = <span class="kwrd">new</span> CommerceQuery&lt;CommerceEntity&gt;(<span class="str">"Basket"</span>);</pre>
          <pre>
            <span class="lnum"> 2: </span> </pre>
          <pre>
            <span class="lnum"> 3: </span>query.SearchCriteria.Model.SetPropertyValue(<span class="str">"UserId"</span>,
userId);</pre>
          <pre>
            <span class="lnum"> 4: </span>query.SearchCriteria.Model.SetPropertyValue(<span class="str">"BasketType"</span>,
0); <span class="rem">// 0 = Basket, 1 = Purchase Order</span></pre>
          <pre>
            <span class="lnum"> 5: </span>query.SearchCriteria.Model.SetPropertyValue(<span class="str">"Name"</span>,
basketName);</pre>
          <pre>
            <span class="lnum"> 6: </span> </pre>
          <pre>
            <span class="lnum"> 7: </span>var operationServiceAgent = <span class="kwrd">new</span> OperationServiceAgent();</pre>
          <pre>
            <span class="lnum"> 8: </span> </pre>
          <pre>
            <span class="lnum"> 9: </span>var response =</pre>
          <pre>
            <span class="lnum"> 10: </span> operationServiceAgent</pre>
          <pre>
            <span class="lnum"> 11: </span> .ProcessRequest(</pre>
          <pre>
            <span class="lnum"> 12: </span>
            <span class="kwrd">new</span> CommerceRequestContext</pre>
          <pre>
            <span class="lnum"> 13: </span> {</pre>
          <pre>
            <span class="lnum"> 14: </span> Channel = <span class="str">"DefaultChannel"</span>,</pre>
          <pre>
            <span class="lnum"> 15: </span> UserId = Guid.NewGuid().ToString(<span class="str">"b"</span>),</pre>
          <pre>
            <span class="lnum"> 16: </span> UserLocale = CultureInfo.CurrentCulture.ToString(),</pre>
          <pre>
            <span class="lnum"> 17: </span> UserUILocale = CultureInfo.CurrentUICulture.ToString(),</pre>
          <pre>
            <span class="lnum"> 18: </span> RequestId = Guid.NewGuid().ToString()</pre>
          <pre>
            <span class="lnum"> 19: </span> }, </pre>
          <pre>
            <span class="lnum"> 20: </span> query.ToRequest())</pre>
          <pre>
            <span class="lnum"> 21: </span> .OperationResponses</pre>
          <pre>
            <span class="lnum"> 22: </span> .Single() <span class="kwrd">as</span> CommerceQueryOperationResponse;</pre>
          <pre>
            <span class="lnum"> 23: </span> </pre>
          <pre>
            <span class="lnum"> 24: </span>var basketEntity = response.CommerceEntities.Single();</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
 
</p>
        <p>
Effectively this will execute the <strong>CommerceQueryOperation_Basket</strong> Operation
Sequence defined in ChannelConfiguration.config which in short will load the Basket
from the Orders System and map this to the generic ICommerceEntity type. 
</p>
        <p>
In the process of retrieving and mapping a Basket to a ICommerceEntity the following
extension method from Microsoft.Commerce.Providers.Utility.OrderGroupExtensions is
being called on the OrderGroup:
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>
            <span class="kwrd">public</span>
            <span class="kwrd">static</span>
            <span class="kwrd">void</span> EnsureDefaultOrderForm(<span class="kwrd">this</span> OrderGroup
orderGroup, <span class="kwrd">string</span> modelName)</pre>
          <pre>
            <span class="lnum"> 2: </span>{</pre>
          <pre>
            <span class="lnum"> 3: </span> ParameterChecker.CheckForNull(orderGroup, <span class="str">"orderGroup"</span>);</pre>
          <pre>
            <span class="lnum"> 4: </span>
            <span class="kwrd">if</span> (orderGroup.OrderForms[<span class="str">"Default"</span>]
== <span class="kwrd">null</span>)</pre>
          <pre>
            <span class="lnum"> 5: </span> {</pre>
          <pre>
            <span class="lnum"> 6: </span>
            <span class="kwrd">if</span> (<span class="kwrd">string</span>.IsNullOrEmpty(modelName))</pre>
          <pre>
            <span class="lnum"> 7: </span> {</pre>
          <pre>
            <span class="lnum"> 8: </span> modelName = <span class="str">"Basket"</span>;</pre>
          <pre>
            <span class="lnum"> 9: </span> }</pre>
          <pre>
            <span class="lnum"> 10: </span> OrderForm orderForm = CommerceServerClassFactory.CreateInstance&lt;OrderForm&gt;(modelName,
2, <span class="kwrd">new</span><span class="kwrd">object</span>[] { <span class="str">"Default"</span> });</pre>
          <pre>
            <span class="lnum"> 11: </span> orderGroup.OrderForms.Add(orderForm);</pre>
          <pre>
            <span class="lnum"> 12: </span> }</pre>
          <pre>
            <span class="lnum"> 13: </span>}</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
          <span class="lnum">
          </span>
        </p>
        <p>
          <span class="lnum">This method is responsible of making sure that a single OrderForm
with the name “Default” is always available in the OrderForms collection of the OrderGroup
instance.</span>
        </p>
        <p>
          <span class="lnum">Also there is an extension method to always retrieve this single
OrderForm called Microsoft.Commerce.Providers.Utility.OrderGroupExtensions.GetDefaultOrderForm.</span>
        </p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>
            <span class="kwrd">public</span>
            <span class="kwrd">static</span> OrderForm
GetDefaultOrderForm(<span class="kwrd">this</span> OrderGroup orderGroup, <span class="kwrd">string</span> modelName)</pre>
          <pre>
            <span class="lnum"> 2: </span>{</pre>
          <pre>
            <span class="lnum"> 3: </span> ParameterChecker.CheckForNull(orderGroup, <span class="str">"orderGroup"</span>);</pre>
          <pre>
            <span class="lnum"> 4: </span>
            <span class="kwrd">if</span> (orderGroup.OrderForms[<span class="str">"Default"</span>]
== <span class="kwrd">null</span>)</pre>
          <pre>
            <span class="lnum"> 5: </span> {</pre>
          <pre>
            <span class="lnum"> 6: </span>
            <span class="kwrd">if</span> (<span class="kwrd">string</span>.IsNullOrEmpty(modelName))</pre>
          <pre>
            <span class="lnum"> 7: </span> {</pre>
          <pre>
            <span class="lnum"> 8: </span> modelName = <span class="str">"Basket"</span>;</pre>
          <pre>
            <span class="lnum"> 9: </span> }</pre>
          <pre>
            <span class="lnum"> 10: </span> OrderForm orderForm = CommerceServerClassFactory.CreateInstance&lt;OrderForm&gt;(modelName,
2, <span class="kwrd">new</span><span class="kwrd">object</span>[] { <span class="str">"Default"</span> });</pre>
          <pre>
            <span class="lnum"> 11: </span> orderGroup.OrderForms.Add(orderForm);</pre>
          <pre>
            <span class="lnum"> 12: </span> }</pre>
          <pre>
            <span class="lnum"> 13: </span>
            <span class="kwrd">return</span> orderGroup.OrderForms[<span class="str">"Default"</span>];</pre>
          <pre>
            <span class="lnum"> 14: </span>}</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
          <span class="lnum">
          </span>
        </p>
        <p>
          <span class="lnum">This method is used throughout the many Operation Sequence Components
in the Foundation API and if you are developing your own custom Operation Sequence
Components that works on the Orders System this method is properly something you would
like to use.</span>
        </p>
        <p>
          <span class="lnum">As mentioned earlier we’ve just been using one OrderForm in all
our Commerce Server projects, so this new limitation is not a problem for us, but
on one of my Commerce Server Training courses I had a guy telling me that they where
actually using multiple OrderForms on a CS 2007 project, so this new limitation would
be a problem for them if they were to upgrade or create a similar solution on a new
CS 2009 project.</span>
        </p>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
          <strong>What if we need more than OrderForm on our project, what to do?</strong>
        </p>
        <p>
In short: <strong>rethink</strong>. A solution with multiple OrderForms in CS 2009
will be too difficult to implement because of the many dependencies in the standard
Operation Sequence Components that expecting there to be only one – remember they
are all calling the GetDefaultOrderForm() extension method. Consider using multiple
OrderGroups instead.
</p>
        <p>
 
</p>
        <p>
If you are reading this and have come up with a better solution to having multiple
OrderForms in CS 2009 or have any comments at all I would really appreciate hearing
from you :-)
</p>
        <img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=ff65ec7c-8922-4dd0-9b9c-f25f79999452" />
      </body>
      <title>Only one OrderForm in Commerce Server 2009</title>
      <guid isPermaLink="false">http://blog.brianh.dk/PermaLink,guid,ff65ec7c-8922-4dd0-9b9c-f25f79999452.aspx</guid>
      <link>http://blog.brianh.dk/2010/09/06/OnlyOneOrderFormInCommerceServer2009.aspx</link>
      <pubDate>Mon, 06 Sep 2010 06:54:00 GMT</pubDate>
      <description>&lt;p&gt;
There is a built-in restriction in the new Commerce Server 2009 Foundation API (MCCF
- Multi Channel Commerce Foundation) to only expect one OrderForm instance on the
aggregate root, being the OrderGroup. An OrderGroup is either a Basket or PurchaseOrder
(or OrderTemplate if you are using that).
&lt;/p&gt;
&lt;p&gt;
Below is a simplified diagram of the key classes in the Object Model for the Orders
System. Please notice that we have the OrderForms collection on the OrderGroup class,
where each instance of an OrderForm can be retrieved either by index or by a name
(string). 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/OnlyoneOrderForminCommerceServer2009_B453/ClassHierachy_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Orders API - class hierachy" border="0" alt="Orders API - class hierachy" src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/OnlyoneOrderForminCommerceServer2009_B453/ClassHierachy_thumb.png" width="490" height="506" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
This allows us to create multiple OrderForms, each with their own data like Line Items,
Payments, Shipments etc, and share other data like Addresses, TrackingNumber and a
few more properties on the OrderGroup class. 
&lt;/p&gt;
&lt;p&gt;
In all projects I’ve been working on we don’t actually use the ability to have multiple
OrderForms. We only have one single OrderForm at all times.
&lt;/p&gt;
&lt;p&gt;
The Commerce Server 2007 code would then look something like:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;Basket basket = OrderContext.Current.GetBasket(userId,
basketName);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (basket.OrderForms.Count
== 0)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; basket.OrderForms.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; OrderForm());&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
This retrieves a named Basket from the Orders System and if the basket is new, it
will create an instance of OrderForm and add this to the OrderForms collection.
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;basket.OrderForms[0].LineItems.Add(&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; LineItem(&lt;span class="str"&gt;&amp;quot;ProductCatalog&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;ProductID&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;VariantID&amp;quot;&lt;/span&gt;,
1m));&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
At some point we would then like to add a Line Item to our basket as illustrated above
where we hardcode the index-value to 0 to retrieve the one and only OrderForm we have.
&lt;/p&gt;
&lt;p&gt;
In Commerce Server 2009 though, we never deal with the actual types, instead we work
with the ICommerceEntity type. The Commerce Server 2009 code for retrieving a basket
would be something like:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;var query = &lt;span class="kwrd"&gt;new&lt;/span&gt; CommerceQuery&amp;lt;CommerceEntity&amp;gt;(&lt;span class="str"&gt;&amp;quot;Basket&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;query.SearchCriteria.Model.SetPropertyValue(&lt;span class="str"&gt;&amp;quot;UserId&amp;quot;&lt;/span&gt;,
userId);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;query.SearchCriteria.Model.SetPropertyValue(&lt;span class="str"&gt;&amp;quot;BasketType&amp;quot;&lt;/span&gt;,
0); &lt;span class="rem"&gt;// 0 = Basket, 1 = Purchase Order&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;query.SearchCriteria.Model.SetPropertyValue(&lt;span class="str"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;,
basketName);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt;var operationServiceAgent = &lt;span class="kwrd"&gt;new&lt;/span&gt; OperationServiceAgent();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt;var response =&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; operationServiceAgent&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; .ProcessRequest(&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; CommerceRequestContext&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt; Channel = &lt;span class="str"&gt;&amp;quot;DefaultChannel&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt; UserId = Guid.NewGuid().ToString(&lt;span class="str"&gt;&amp;quot;b&amp;quot;&lt;/span&gt;),&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt; UserLocale = CultureInfo.CurrentCulture.ToString(),&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt; UserUILocale = CultureInfo.CurrentUICulture.ToString(),&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt; RequestId = Guid.NewGuid().ToString()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt; }, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt; query.ToRequest())&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt; .OperationResponses&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt; .Single() &lt;span class="kwrd"&gt;as&lt;/span&gt; CommerceQueryOperationResponse;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt;var basketEntity = response.CommerceEntities.Single();&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
Effectively this will execute the &lt;strong&gt;CommerceQueryOperation_Basket&lt;/strong&gt; Operation
Sequence defined in ChannelConfiguration.config which in short will load the Basket
from the Orders System and map this to the generic ICommerceEntity type. 
&lt;/p&gt;
&lt;p&gt;
In the process of retrieving and mapping a Basket to a ICommerceEntity the following
extension method from Microsoft.Commerce.Providers.Utility.OrderGroupExtensions is
being called on the OrderGroup:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; EnsureDefaultOrderForm(&lt;span class="kwrd"&gt;this&lt;/span&gt; OrderGroup
orderGroup, &lt;span class="kwrd"&gt;string&lt;/span&gt; modelName)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; ParameterChecker.CheckForNull(orderGroup, &lt;span class="str"&gt;&amp;quot;orderGroup&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (orderGroup.OrderForms[&lt;span class="str"&gt;&amp;quot;Default&amp;quot;&lt;/span&gt;]
== &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(modelName))&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt; modelName = &lt;span class="str"&gt;&amp;quot;Basket&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; OrderForm orderForm = CommerceServerClassFactory.CreateInstance&amp;lt;OrderForm&amp;gt;(modelName,
2, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { &lt;span class="str"&gt;&amp;quot;Default&amp;quot;&lt;/span&gt; });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; orderGroup.OrderForms.Add(orderForm);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&lt;span class="lnum"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class="lnum"&gt;This method is responsible of making sure that a single OrderForm
with the name “Default” is always available in the OrderForms collection of the OrderGroup
instance.&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class="lnum"&gt;Also there is an extension method to always retrieve this single
OrderForm called Microsoft.Commerce.Providers.Utility.OrderGroupExtensions.GetDefaultOrderForm.&lt;/span&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; OrderForm
GetDefaultOrderForm(&lt;span class="kwrd"&gt;this&lt;/span&gt; OrderGroup orderGroup, &lt;span class="kwrd"&gt;string&lt;/span&gt; modelName)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; ParameterChecker.CheckForNull(orderGroup, &lt;span class="str"&gt;&amp;quot;orderGroup&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (orderGroup.OrderForms[&lt;span class="str"&gt;&amp;quot;Default&amp;quot;&lt;/span&gt;]
== &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(modelName))&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt; modelName = &lt;span class="str"&gt;&amp;quot;Basket&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; OrderForm orderForm = CommerceServerClassFactory.CreateInstance&amp;lt;OrderForm&amp;gt;(modelName,
2, &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt;[] { &lt;span class="str"&gt;&amp;quot;Default&amp;quot;&lt;/span&gt; });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; orderGroup.OrderForms.Add(orderForm);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; orderGroup.OrderForms[&lt;span class="str"&gt;&amp;quot;Default&amp;quot;&lt;/span&gt;];&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&lt;span class="lnum"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class="lnum"&gt;This method is used throughout the many Operation Sequence Components
in the Foundation API and if you are developing your own custom Operation Sequence
Components that works on the Orders System this method is properly something you would
like to use.&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span class="lnum"&gt;As mentioned earlier we’ve just been using one OrderForm in all
our Commerce Server projects, so this new limitation is not a problem for us, but
on one of my Commerce Server Training courses I had a guy telling me that they where
actually using multiple OrderForms on a CS 2007 project, so this new limitation would
be a problem for them if they were to upgrade or create a similar solution on a new
CS 2009 project.&lt;/span&gt;
&lt;/p&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&lt;strong&gt;What if we need more than OrderForm on our project, what to do?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In short: &lt;strong&gt;rethink&lt;/strong&gt;. A solution with multiple OrderForms in CS 2009
will be too difficult to implement because of the many dependencies in the standard
Operation Sequence Components that expecting there to be only one – remember they
are all calling the GetDefaultOrderForm() extension method. Consider using multiple
OrderGroups instead.
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
If you are reading this and have come up with a better solution to having multiple
OrderForms in CS 2009 or have any comments at all I would really appreciate hearing
from you :-)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=ff65ec7c-8922-4dd0-9b9c-f25f79999452" /&gt;</description>
      <comments>http://blog.brianh.dk/CommentView,guid,ff65ec7c-8922-4dd0-9b9c-f25f79999452.aspx</comments>
      <category>Commerce Server</category>
    </item>
    <item>
      <trackback:ping>http://blog.brianh.dk/Trackback.aspx?guid=0a3d397c-5f61-47a7-91ef-294571ef9548</trackback:ping>
      <pingback:server>http://blog.brianh.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.brianh.dk/PermaLink,guid,0a3d397c-5f61-47a7-91ef-294571ef9548.aspx</pingback:target>
      <dc:creator>Brian Holmgård Kristensen</dc:creator>
      <wfw:comment>http://blog.brianh.dk/CommentView,guid,0a3d397c-5f61-47a7-91ef-294571ef9548.aspx</wfw:comment>
      <wfw:commentRss>http://blog.brianh.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=0a3d397c-5f61-47a7-91ef-294571ef9548</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Max Akbar’s Commerce Server 2007 training videos have yet again become available for
purchase. More than 19 hours of material can now be found on <a title="http://www.commerceservertraining.com/training-videos.aspx" href="http://www.commerceservertraining.com/training-videos.aspx">http://www.commerceservertraining.com/training-videos.aspx</a>. 
</p>
        <p>
We are working on producing and releasing new training videos targeting Commerce Server
2009.
</p>
        <img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=0a3d397c-5f61-47a7-91ef-294571ef9548" />
      </body>
      <title>Commerce Server training videos</title>
      <guid isPermaLink="false">http://blog.brianh.dk/PermaLink,guid,0a3d397c-5f61-47a7-91ef-294571ef9548.aspx</guid>
      <link>http://blog.brianh.dk/2010/09/03/CommerceServerTrainingVideos.aspx</link>
      <pubDate>Fri, 03 Sep 2010 12:27:37 GMT</pubDate>
      <description>&lt;p&gt;
Max Akbar’s Commerce Server 2007 training videos have yet again become available for
purchase. More than 19 hours of material can now be found on &lt;a title="http://www.commerceservertraining.com/training-videos.aspx" href="http://www.commerceservertraining.com/training-videos.aspx"&gt;http://www.commerceservertraining.com/training-videos.aspx&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
We are working on producing and releasing new training videos targeting Commerce Server
2009.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=0a3d397c-5f61-47a7-91ef-294571ef9548" /&gt;</description>
      <comments>http://blog.brianh.dk/CommentView,guid,0a3d397c-5f61-47a7-91ef-294571ef9548.aspx</comments>
      <category>Commerce Server</category>
      <category>Training</category>
    </item>
    <item>
      <trackback:ping>http://blog.brianh.dk/Trackback.aspx?guid=e512ace7-80d4-4ce9-aba2-21cb2487648d</trackback:ping>
      <pingback:server>http://blog.brianh.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.brianh.dk/PermaLink,guid,e512ace7-80d4-4ce9-aba2-21cb2487648d.aspx</pingback:target>
      <dc:creator>Brian Holmgård Kristensen</dc:creator>
      <wfw:comment>http://blog.brianh.dk/CommentView,guid,e512ace7-80d4-4ce9-aba2-21cb2487648d.aspx</wfw:comment>
      <wfw:commentRss>http://blog.brianh.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=e512ace7-80d4-4ce9-aba2-21cb2487648d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In Commerce Server the Rank property is used as a sorting discriminator when retrieving
categories, products and variants. This property is usually managed using Catalog
Manager as shown in the screenshot below:
</p>
        <p>
          <a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoretrieveCategoryRankinCommerceServe_BE87/image_2.png" target="_blank">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoretrieveCategoryRankinCommerceServe_BE87/image_thumb.png" width="244" height="158" />
          </a>
        </p>
        <p>
The Rank property could also be managed in your own application which will be the
topic of a later blog-post. This blog-post will focus on how to get the actual Rank
value when retrieving categories in Commerce Server.
</p>
        <p>
          <strong>How did we do this in in Commerce Server 2007?</strong>
        </p>
        <p>
Pretty easy! We just include “Rank” as an item in the PropertiesToReturnArray for
child categories (line 12) when requesting a specific category and later retrieve
the value from the property-bag of the Category instance (line 24) as shown in the
example below:
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>
            <span class="kwrd">public</span>
            <span class="kwrd">void</span> RequestUsing2007(<span class="kwrd">string</span> catalogName, <span class="kwrd">string</span> categoryName)</pre>
          <pre>
            <span class="lnum"> 2: </span>{</pre>
          <pre>
            <span class="lnum"> 3: </span> var catalogSystem = CommerceContext.Current.CatalogSystem;</pre>
          <pre>
            <span class="lnum"> 4: </span> </pre>
          <pre>
            <span class="lnum"> 5: </span> var configuration = <span class="kwrd">new</span> CategoryConfiguration</pre>
          <pre>
            <span class="lnum"> 6: </span> {</pre>
          <pre>
            <span class="lnum"> 7: </span> LoadChildCategories = <span class="kwrd">true</span>,</pre>
          <pre>
            <span class="lnum"> 8: </span> ChildCategories =</pre>
          <pre>
            <span class="lnum"> 9: </span> {</pre>
          <pre>
            <span class="lnum"> 10: </span> SearchOptions =</pre>
          <pre>
            <span class="lnum"> 11: </span> {</pre>
          <pre>
            <span class="lnum"> 12: </span> PropertiesToReturnArray = <span class="kwrd">new</span>[]
{ <span class="str">"DisplayName"</span>, <span class="str">"Rank"</span> }</pre>
          <pre>
            <span class="lnum"> 13: </span> }</pre>
          <pre>
            <span class="lnum"> 14: </span> }</pre>
          <pre>
            <span class="lnum"> 15: </span> };</pre>
          <pre>
            <span class="lnum"> 16: </span> </pre>
          <pre>
            <span class="lnum"> 17: </span> var category =</pre>
          <pre>
            <span class="lnum"> 18: </span> catalogSystem.GetCategory(catalogName, categoryName, <span class="str">"da-DK"</span>,
configuration);</pre>
          <pre>
            <span class="lnum"> 19: </span> </pre>
          <pre>
            <span class="lnum"> 20: </span>
            <span class="kwrd">foreach</span> (var childCategory <span class="kwrd">in</span> category.ChildCategories)</pre>
          <pre>
            <span class="lnum"> 21: </span> {</pre>
          <pre>
            <span class="lnum"> 22: </span> _writer.WriteLine(<span class="str">"Id={0}"</span>,
childCategory.Name);</pre>
          <pre>
            <span class="lnum"> 23: </span> _writer.WriteLine(<span class="str">"DisplayName={0}"</span>,
childCategory.DisplayName);</pre>
          <pre>
            <span class="lnum"> 24: </span> _writer.WriteLine(<span class="str">"Rank={0}"</span>,
childCategory[<span class="str">"rank"</span>]);</pre>
          <pre>
            <span class="lnum"> 25: </span> </pre>
          <pre>
            <span class="lnum"> 26: </span> _writer.WriteLine();</pre>
          <pre>
            <span class="lnum"> 27: </span> }</pre>
          <pre>
            <span class="lnum"> 28: </span>}</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
          <strong>
          </strong>
        </p>
        <p>
          <strong>And how can I do it in Commerce Server 2009?</strong>
        </p>
        <p>
In Commerce Server 2009 with the new Foundation API the overall way of retrieving
entities in Commerce Server has changed a lot. In the example below I’ve added “Rank”
as part of the properties to retrieve when requesting child categories for a specific
category (line 10):
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>
            <span class="kwrd">public</span>
            <span class="kwrd">void</span> RequestUsing2009(<span class="kwrd">string</span> catalogName, <span class="kwrd">string</span> categoryName)</pre>
          <pre>
            <span class="lnum"> 2: </span>{</pre>
          <pre>
            <span class="lnum"> 3: </span> var categoryQuery = <span class="kwrd">new</span> CommerceQuery&lt;CommerceEntity&gt;(<span class="str">"Category"</span>);</pre>
          <pre>
            <span class="lnum"> 4: </span> categoryQuery.Model.Properties.Add(<span class="kwrd">new</span>[]
{ <span class="str">"Id"</span>, <span class="str">"DisplayName"</span> });</pre>
          <pre>
            <span class="lnum"> 5: </span> </pre>
          <pre>
            <span class="lnum"> 6: </span> categoryQuery.SearchCriteria.Model.SetPropertyValue(<span class="str">"CatalogId"</span>,
catalogName);</pre>
          <pre>
            <span class="lnum"> 7: </span> categoryQuery.SearchCriteria.Model.SetPropertyValue(<span class="str">"Id"</span>,
categoryName);</pre>
          <pre>
            <span class="lnum"> 8: </span> </pre>
          <pre>
            <span class="lnum"> 9: </span> var childCategoryQuery = <span class="kwrd">new</span> CommerceQueryRelatedItem&lt;CommerceEntity&gt;(<span class="str">"ChildCategories"</span>, <span class="str">"Category"</span>);</pre>
          <pre>
            <span class="lnum"> 10: </span> childCategoryQuery.Model.Properties.Add(<span class="kwrd">new</span>[]
{ <span class="str">"Id"</span>, <span class="str">"DisplayName"</span>, <span class="str">"Rank"</span> });</pre>
          <pre>
            <span class="lnum"> 11: </span> categoryQuery.RelatedOperations.Add(childCategoryQuery);</pre>
          <pre>
            <span class="lnum"> 12: </span> </pre>
          <pre>
            <span class="lnum"> 13: </span> var operationServiceAgent = <span class="kwrd">new</span> OperationServiceAgent();</pre>
          <pre>
            <span class="lnum"> 14: </span> </pre>
          <pre>
            <span class="lnum"> 15: </span> var response = </pre>
          <pre>
            <span class="lnum"> 16: </span> operationServiceAgent.ProcessRequest(</pre>
          <pre>
            <span class="lnum"> 17: </span>
            <span class="kwrd">new</span> CommerceRequestContext</pre>
          <pre>
            <span class="lnum"> 18: </span> {</pre>
          <pre>
            <span class="lnum"> 19: </span> Channel = <span class="str">"MyChannel"</span>,</pre>
          <pre>
            <span class="lnum"> 20: </span> UserLocale = <span class="str">"da-DK"</span>,</pre>
          <pre>
            <span class="lnum"> 21: </span> UserUILocale = <span class="str">"da-DK"</span>,</pre>
          <pre>
            <span class="lnum"> 22: </span> RequestId = Guid.NewGuid().ToString()</pre>
          <pre>
            <span class="lnum"> 23: </span> }, </pre>
          <pre>
            <span class="lnum"> 24: </span> categoryQuery.ToRequest());</pre>
          <pre>
            <span class="lnum"> 25: </span> </pre>
          <pre>
            <span class="lnum"> 26: </span> var operationResponse = (CommerceQueryOperationResponse)response.OperationResponses.Single();</pre>
          <pre>
            <span class="lnum"> 27: </span> </pre>
          <pre>
            <span class="lnum"> 28: </span> var entity = operationResponse.CommerceEntities.SingleOrDefault();</pre>
          <pre>
            <span class="lnum"> 29: </span> </pre>
          <pre>
            <span class="lnum"> 30: </span>
            <span class="kwrd">foreach</span> (var childCategory <span class="kwrd">in</span> entity.Properties[<span class="str">"ChildCategories"</span>] <span class="kwrd">as</span> CommerceRelationshipList)</pre>
          <pre>
            <span class="lnum"> 31: </span> {</pre>
          <pre>
            <span class="lnum"> 32: </span>
            <span class="kwrd">foreach</span> (var categoryProperty <span class="kwrd">in</span> childCategory.Target.Properties)</pre>
          <pre>
            <span class="lnum"> 33: </span> {</pre>
          <pre>
            <span class="lnum"> 34: </span> _writer.WriteLine</pre>
          <pre>
            <span class="lnum"> 35: </span> (<span class="str">"{0}={1} ({2})"</span>, </pre>
          <pre>
            <span class="lnum"> 36: </span> categoryProperty.Key, </pre>
          <pre>
            <span class="lnum"> 37: </span> categoryProperty.Value, </pre>
          <pre>
            <span class="lnum"> 38: </span> categoryProperty.Value.GetType().Name);</pre>
          <pre>
            <span class="lnum"> 39: </span> }</pre>
          <pre>
            <span class="lnum"> 40: </span> </pre>
          <pre>
            <span class="lnum"> 41: </span> _writer.WriteLine();</pre>
          <pre>
            <span class="lnum"> 42: </span> }</pre>
          <pre>
            <span class="lnum"> 43: </span>}</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
 
</p>
        <p>
One of the Operation Sequence components being executed in this operation is responsible
for creating the CategoryConfiguration instance, that we manually created in the Commerce
Server 2007 example (CS 2007 example line 5). This Operation Sequence component is
named “CategoryConfiguration_Prepare”. 
</p>
        <p>
The actual logic for building the CategoryConfiguration instance is implemented in
a class named CatalogConfigurationBuilder. This class will look in the MetadataDefinitions.xml
file to match up the properties requested by the developer (in our case “Id, DisplayName,
Rank”) with the properties registered for the actual entity being requested (“Category”).
</p>
        <p>
If Rank is not registred in the MetadataDefinitions.xml file, it will be ignored by
the CatalogConfigurationBuilder (method doing this is called TranslatePropertyName)
and will therefore not be part of the “PropertiesToReturnArray” that in the end decides
which columns to retrieve from the catalog table in SQL Server.
</p>
        <p>
To make sure that Rank is registred in MetadataDefinitions.xml verify it by follow
these steps:
</p>
        <ol>
          <li>
Open MetadataDefinitions.xml</li>
          <li>
Locate &lt;CommerceEntity name=”Category”&gt;</li>
          <li>
Make sure that there is a &lt;PropertyMapping&gt; element for property=”Rank” (&lt;PropertyMapping
property=”Rank” csProperty=”rank” /&gt;)</li>
          <li>
Make sure that there is a &lt;Property&gt; element for name=”Rank” (&lt;Property name=”Rank”
dataType=”String” /&gt;)</li>
        </ol>
        <p>
Step 3 explained:
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">EntityMappings</span>
            <span class="kwrd">&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 2: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">EntityMapping</span>
          </pre>
          <pre>
            <span class="lnum"> 3: </span>
            <span class="attr">csType</span>
            <span class="kwrd">="Microsoft.CommerceServer.Catalog.Category"</span>
          </pre>
          <pre>
            <span class="lnum"> 4: </span>
            <span class="attr">csAssembly</span>
            <span class="kwrd">="Microsoft.CommerceServer.Catalog,
Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"</span>
            <span class="kwrd">&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 5: </span> </pre>
          <pre>
            <span class="lnum"> 6: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">PropertyMappings</span>
            <span class="kwrd">&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 7: </span>
            <span class="rem">&lt;!-- </span>
          </pre>
          <pre>
            <span class="lnum"> 8: </span>
            <span class="rem"> The following mappings are required
here to ensure that all</span>
          </pre>
          <pre>
            <span class="lnum"> 9: </span>
            <span class="rem"> the product common properties
are represented in the Microsoft Multi-Channel Commerce Foundation </span>
          </pre>
          <pre>
            <span class="lnum"> 10: </span>
            <span class="rem"> metadata. These are not returned
by the Commerce Server</span>
          </pre>
          <pre>
            <span class="lnum"> 11: </span>
            <span class="rem"> metadata automatically as the
common properties.</span>
          </pre>
          <pre>
            <span class="lnum"> 12: </span>
            <span class="rem"> --&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 13: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">PropertyMapping</span>
            <span class="attr">property</span>
            <span class="kwrd">="BaseCatalogName"</span>
            <span class="attr">csProperty</span>
            <span class="kwrd">="BaseCatalogName"</span>
            <span class="kwrd">/&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 14: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">PropertyMapping</span>
            <span class="attr">property</span>
            <span class="kwrd">="Rank"</span>
            <span class="attr">csProperty</span>
            <span class="kwrd">="rank"</span>
            <span class="kwrd">/&gt;</span>
          </pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
 
</p>
        <p>
Step 4 explained:
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">Properties</span>
            <span class="kwrd">&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 2: </span>
            <span class="rem">&lt;!-- </span>
          </pre>
          <pre>
            <span class="lnum"> 3: </span>
            <span class="rem"> The following property definitions
are required here to ensure that all</span>
          </pre>
          <pre>
            <span class="lnum"> 4: </span>
            <span class="rem"> the product common properties
are represented in the </span>
          </pre>
          <pre>
            <span class="lnum"> 5: </span>
            <span class="rem"> metadata. These are not returned
by the Commerce Server</span>
          </pre>
          <pre>
            <span class="lnum"> 6: </span>
            <span class="rem"> metadata automatically as the
common properties.</span>
          </pre>
          <pre>
            <span class="lnum"> 7: </span>
            <span class="rem"> --&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 8: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">Property</span>
            <span class="attr">name</span>
            <span class="kwrd">="BaseCatalogName"</span>
            <span class="attr">dataType</span>
            <span class="kwrd">="String"</span>
            <span class="kwrd">&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 9: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">DisplayName</span>
            <span class="attr">value</span>
            <span class="kwrd">="Base
Catalog Name"</span>
            <span class="kwrd">/&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 10: </span>
            <span class="kwrd">&lt;/</span>
            <span class="html">Property</span>
            <span class="kwrd">&gt;</span>
          </pre>
          <pre>
            <span class="lnum"> 11: </span>
            <span class="kwrd">&lt;</span>
            <span class="html">Property</span>
            <span class="attr">name</span>
            <span class="kwrd">="Rank"</span>
            <span class="attr">dataType</span>
            <span class="kwrd">="String"</span>
            <span class="kwrd">/&gt;</span>
          </pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
        <p>
 
</p>
        <p>
        </p>
        <p>
        </p>
        <p>
That’s it! The response returned by the Foundation API should now have the actual
Rank value returned for each child category entity:
</p>
        <pre class="csharpcode">Id=ThirdRankingCategory (String)
Rank=1 (Int32)
DisplayName=ThirdRankingCategory (String)

Id=AnotherRankingCategory (String)
Rank=2 (Int32)
DisplayName=AnotherRankingCategory (String)

Id=SomeRankingCategory (String)
Rank=3 (Int32)
DisplayName=SomeRankingCategory (String)</pre>
        <img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=e512ace7-80d4-4ce9-aba2-21cb2487648d" />
      </body>
      <title>How to retrieve Category Rank in Commerce Server 2009</title>
      <guid isPermaLink="false">http://blog.brianh.dk/PermaLink,guid,e512ace7-80d4-4ce9-aba2-21cb2487648d.aspx</guid>
      <link>http://blog.brianh.dk/2010/04/27/HowToRetrieveCategoryRankInCommerceServer2009.aspx</link>
      <pubDate>Tue, 27 Apr 2010 11:00:00 GMT</pubDate>
      <description>&lt;p&gt;
In Commerce Server the Rank property is used as a sorting discriminator when retrieving
categories, products and variants. This property is usually managed using Catalog
Manager as shown in the screenshot below:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoretrieveCategoryRankinCommerceServe_BE87/image_2.png" target="_blank"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoretrieveCategoryRankinCommerceServe_BE87/image_thumb.png" width="244" height="158" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
The Rank property could also be managed in your own application which will be the
topic of a later blog-post. This blog-post will focus on how to get the actual Rank
value when retrieving categories in Commerce Server.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;How did we do this in in Commerce Server 2007?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Pretty easy! We just include “Rank” as an item in the PropertiesToReturnArray for
child categories (line 12) when requesting a specific category and later retrieve
the value from the property-bag of the Category instance (line 24) as shown in the
example below:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; RequestUsing2007(&lt;span class="kwrd"&gt;string&lt;/span&gt; catalogName, &lt;span class="kwrd"&gt;string&lt;/span&gt; categoryName)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; var catalogSystem = CommerceContext.Current.CatalogSystem;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt; var configuration = &lt;span class="kwrd"&gt;new&lt;/span&gt; CategoryConfiguration&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; LoadChildCategories = &lt;span class="kwrd"&gt;true&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt; ChildCategories =&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; SearchOptions =&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; PropertiesToReturnArray = &lt;span class="kwrd"&gt;new&lt;/span&gt;[]
{ &lt;span class="str"&gt;&amp;quot;DisplayName&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;Rank&amp;quot;&lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt; };&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt; var category =&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt; catalogSystem.GetCategory(catalogName, categoryName, &lt;span class="str"&gt;&amp;quot;da-DK&amp;quot;&lt;/span&gt;,
configuration);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt; &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var childCategory &lt;span class="kwrd"&gt;in&lt;/span&gt; category.ChildCategories)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt; _writer.WriteLine(&lt;span class="str"&gt;&amp;quot;Id={0}&amp;quot;&lt;/span&gt;,
childCategory.Name);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt; _writer.WriteLine(&lt;span class="str"&gt;&amp;quot;DisplayName={0}&amp;quot;&lt;/span&gt;,
childCategory.DisplayName);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt; _writer.WriteLine(&lt;span class="str"&gt;&amp;quot;Rank={0}&amp;quot;&lt;/span&gt;,
childCategory[&lt;span class="str"&gt;&amp;quot;rank&amp;quot;&lt;/span&gt;]);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 25: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 26: &lt;/span&gt; _writer.WriteLine();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 27: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 28: &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&lt;strong&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;And how can I do it in Commerce Server 2009?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In Commerce Server 2009 with the new Foundation API the overall way of retrieving
entities in Commerce Server has changed a lot. In the example below I’ve added “Rank”
as part of the properties to retrieve when requesting child categories for a specific
category (line 10):
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; RequestUsing2009(&lt;span class="kwrd"&gt;string&lt;/span&gt; catalogName, &lt;span class="kwrd"&gt;string&lt;/span&gt; categoryName)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; var categoryQuery = &lt;span class="kwrd"&gt;new&lt;/span&gt; CommerceQuery&amp;lt;CommerceEntity&amp;gt;(&lt;span class="str"&gt;&amp;quot;Category&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; categoryQuery.Model.Properties.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt;[]
{ &lt;span class="str"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;DisplayName&amp;quot;&lt;/span&gt; });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; categoryQuery.SearchCriteria.Model.SetPropertyValue(&lt;span class="str"&gt;&amp;quot;CatalogId&amp;quot;&lt;/span&gt;,
catalogName);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; categoryQuery.SearchCriteria.Model.SetPropertyValue(&lt;span class="str"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;,
categoryName);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; var childCategoryQuery = &lt;span class="kwrd"&gt;new&lt;/span&gt; CommerceQueryRelatedItem&amp;lt;CommerceEntity&amp;gt;(&lt;span class="str"&gt;&amp;quot;ChildCategories&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;Category&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; childCategoryQuery.Model.Properties.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt;[]
{ &lt;span class="str"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;DisplayName&amp;quot;&lt;/span&gt;, &lt;span class="str"&gt;&amp;quot;Rank&amp;quot;&lt;/span&gt; });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; categoryQuery.RelatedOperations.Add(childCategoryQuery);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; var operationServiceAgent = &lt;span class="kwrd"&gt;new&lt;/span&gt; OperationServiceAgent();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt; var response = &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt; operationServiceAgent.ProcessRequest(&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; CommerceRequestContext&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt; Channel = &lt;span class="str"&gt;&amp;quot;MyChannel&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt; UserLocale = &lt;span class="str"&gt;&amp;quot;da-DK&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt; UserUILocale = &lt;span class="str"&gt;&amp;quot;da-DK&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt; RequestId = Guid.NewGuid().ToString()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt; }, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt; categoryQuery.ToRequest());&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 25: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 26: &lt;/span&gt; var operationResponse = (CommerceQueryOperationResponse)response.OperationResponses.Single();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 27: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 28: &lt;/span&gt; var entity = operationResponse.CommerceEntities.SingleOrDefault();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 29: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 30: &lt;/span&gt; &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var childCategory &lt;span class="kwrd"&gt;in&lt;/span&gt; entity.Properties[&lt;span class="str"&gt;&amp;quot;ChildCategories&amp;quot;&lt;/span&gt;] &lt;span class="kwrd"&gt;as&lt;/span&gt; CommerceRelationshipList)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 31: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 32: &lt;/span&gt; &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var categoryProperty &lt;span class="kwrd"&gt;in&lt;/span&gt; childCategory.Target.Properties)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 33: &lt;/span&gt; {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 34: &lt;/span&gt; _writer.WriteLine&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 35: &lt;/span&gt; (&lt;span class="str"&gt;&amp;quot;{0}={1} ({2})&amp;quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 36: &lt;/span&gt; categoryProperty.Key, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 37: &lt;/span&gt; categoryProperty.Value, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 38: &lt;/span&gt; categoryProperty.Value.GetType().Name);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 39: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 40: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 41: &lt;/span&gt; _writer.WriteLine();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 42: &lt;/span&gt; }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 43: &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
One of the Operation Sequence components being executed in this operation is responsible
for creating the CategoryConfiguration instance, that we manually created in the Commerce
Server 2007 example (CS 2007 example line 5). This Operation Sequence component is
named “CategoryConfiguration_Prepare”. 
&lt;/p&gt;
&lt;p&gt;
The actual logic for building the CategoryConfiguration instance is implemented in
a class named CatalogConfigurationBuilder. This class will look in the MetadataDefinitions.xml
file to match up the properties requested by the developer (in our case “Id, DisplayName,
Rank”) with the properties registered for the actual entity being requested (“Category”).
&lt;/p&gt;
&lt;p&gt;
If Rank is not registred in the MetadataDefinitions.xml file, it will be ignored by
the CatalogConfigurationBuilder (method doing this is called TranslatePropertyName)
and will therefore not be part of the “PropertiesToReturnArray” that in the end decides
which columns to retrieve from the catalog table in SQL Server.
&lt;/p&gt;
&lt;p&gt;
To make sure that Rank is registred in MetadataDefinitions.xml verify it by follow
these steps:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Open MetadataDefinitions.xml&lt;/li&gt;
&lt;li&gt;
Locate &amp;lt;CommerceEntity name=”Category”&amp;gt;&lt;/li&gt;
&lt;li&gt;
Make sure that there is a &amp;lt;PropertyMapping&amp;gt; element for property=”Rank” (&amp;lt;PropertyMapping
property=”Rank” csProperty=”rank” /&amp;gt;)&lt;/li&gt;
&lt;li&gt;
Make sure that there is a &amp;lt;Property&amp;gt; element for name=”Rank” (&amp;lt;Property name=”Rank”
dataType=”String” /&amp;gt;)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Step 3 explained:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;EntityMappings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;EntityMapping&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; &lt;span class="attr"&gt;csType&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Microsoft.CommerceServer.Catalog.Category&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; &lt;span class="attr"&gt;csAssembly&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Microsoft.CommerceServer.Catalog,
Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;PropertyMappings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; &lt;span class="rem"&gt;&amp;lt;!-- &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt;&lt;span class="rem"&gt; The following mappings are required
here to ensure that all&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt;&lt;span class="rem"&gt; the product common properties
are represented in the Microsoft Multi-Channel Commerce Foundation &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt;&lt;span class="rem"&gt; metadata. These are not returned
by the Commerce Server&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt;&lt;span class="rem"&gt; metadata automatically as the
common properties.&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt;&lt;span class="rem"&gt; --&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;PropertyMapping&lt;/span&gt; &lt;span class="attr"&gt;property&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;BaseCatalogName&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;csProperty&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;BaseCatalogName&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;PropertyMapping&lt;/span&gt; &lt;span class="attr"&gt;property&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Rank&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;csProperty&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;rank&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
Step 4 explained:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Properties&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt; &lt;span class="rem"&gt;&amp;lt;!-- &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;&lt;span class="rem"&gt; The following property definitions
are required here to ensure that all&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt;&lt;span class="rem"&gt; the product common properties
are represented in the &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;&lt;span class="rem"&gt; metadata. These are not returned
by the Commerce Server&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt;&lt;span class="rem"&gt; metadata automatically as the
common properties.&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt;&lt;span class="rem"&gt; --&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;BaseCatalogName&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;dataType&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;String&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;DisplayName&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Base
Catalog Name&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Property&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Rank&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;dataType&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;String&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
That’s it! The response returned by the Foundation API should now have the actual
Rank value returned for each child category entity:
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;Id=ThirdRankingCategory (String)
Rank=1 (Int32)
DisplayName=ThirdRankingCategory (String)

Id=AnotherRankingCategory (String)
Rank=2 (Int32)
DisplayName=AnotherRankingCategory (String)

Id=SomeRankingCategory (String)
Rank=3 (Int32)
DisplayName=SomeRankingCategory (String)&lt;/pre&gt;
&lt;img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=e512ace7-80d4-4ce9-aba2-21cb2487648d" /&gt;</description>
      <comments>http://blog.brianh.dk/CommentView,guid,e512ace7-80d4-4ce9-aba2-21cb2487648d.aspx</comments>
      <category>Commerce Server</category>
    </item>
    <item>
      <trackback:ping>http://blog.brianh.dk/Trackback.aspx?guid=d8867c4f-47b5-4e36-b8d1-b8966d3b10ae</trackback:ping>
      <pingback:server>http://blog.brianh.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.brianh.dk/PermaLink,guid,d8867c4f-47b5-4e36-b8d1-b8966d3b10ae.aspx</pingback:target>
      <dc:creator>Brian Holmgård Kristensen</dc:creator>
      <wfw:comment>http://blog.brianh.dk/CommentView,guid,d8867c4f-47b5-4e36-b8d1-b8966d3b10ae.aspx</wfw:comment>
      <wfw:commentRss>http://blog.brianh.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=d8867c4f-47b5-4e36-b8d1-b8966d3b10ae</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
By default Microsoft Commerce Server 2007 is highly extensible for example in regards
to extending the object model in the Order System (e.g. creating new classes or extending
existing ones). Also the Profile System is properly the most extensible subsystem
in Commerce Server being a general purpose data repository that allows the developer
to define and store any custom data in it. While this is all great and good news,
not everything on the Commerce Server platform is possible to extend and this post
will focus on one specific lack of extensibility in regards to extending Payment Methods
and Shipment Methods. 
</p>
        <p>
If you want to read more about Commerce Server 2007 seen from a developer and architect's
point of view, I recommend reading my colleague Søren's "<a href="http://www.publicvoid.dk/DevelopingWithMicrosoftCommerceServer2007Part2ThreeWayDataAccess.aspx">Developing
with Commerce Server 2007</a>"-series on his blog <a href="http://publicvoid.dk/">publicvoid.dk</a>.
</p>
        <h4>Requirements
</h4>
        <p>
In Denmark we have a national wide postal service called <a href="http://www.postdanmark.dk/index.jsp">Post
Danmark</a> which we use as our carrier for sending letters, packages etc. This is
defined in Commerce Server as one of the Shipment Methods on the specific customer
solution I'm currently working on. Post Danmark also offers a service allowing the
end-customer to postpone the actual payment of the order until the physical arrival.
By having this option, we created a Payment Method in the system called "Post Danmark
Efterkrav" <em>("Post Danmark Cash On Delivery")</em>, so the customer can choose
this in the checkout process. To be able to use this payment method we demand that
the customer has already chosen Post Danmark as the shipment method. If the customer
has chosen another shipment method we will not allow the customer to choose the cash
on delivery payment method from Post Danmark, thus having the payment method depending
on the chosen shipment method.
</p>
        <p>
Management of Commerce Server Payment Methods and Shipment Methods takes place in
the Customer and Orders Manager application. When creating a Payment Method it is
possible to specify e.g. Payment Type (Credit Card Payment, Gift Certificate Payment,
etc.). It is also possible to specify Name and Description of the Payment Method in
the languages you want to support, plus a few more options. Unfortunately this is
one of the areas in Commerce Server where you seemed to be locked by this model or
behavior and you cannot do any obvious extending. Nonetheless we needed some way to
do it, because we wanted to be able to specify a relation or dependency between Payment
Methods and Shipment Methods. We wanted to make it possible to specify that a specific
Payment Method should only be available when a specific Shipment Method was selected
in the checkout process. And of course we wanted to accomplish this using as much
Commerce Server standards as possible, so future service pack upgrades would not cause
problems among other obvious reasons :-) 
</p>
        <h4>The solution
</h4>
        <p>
As mentioned earlier the Profile System in Commerce Server is our general purpose
data repository where we can model almost anything and leverage from Commerce Server
API's to do data access operations and provide security to our data store. The solution
we came up with was to create two new profiles in the Profile System; one for payment
method extended properties <em>(PaymentMethodExtensionProfile)</em> and another for
shipment method extended properties <em>(ShipmentMethodExtensionProfile)</em> and
link these profiles to the Shipment Method and the Payment Method types.
</p>
        <p>
Shipped with Commerce Server comes a Software Development Kit, which among other very
nice things contains the complete source code to all the business applications (except
the Catalog and Inventory Schema Manager). There are two classes in the Customer and
Orders Manager project responsible of displaying the dialogs for management of Payment
Methods <em>(PaymentMethodEditView)</em> and Shipment Methods <em>(ShippingMethodEditView)</em> respectively.
In each of these Windows Forms dialog classes, we added a new button in the toolbar,
gave it an icon and named it "Extended Properties". When the user clicks on this button,
we execute some code, that depending on whether it is executed from a Payment Method
or Shipment Method basically just performs a search for a specific profile (our extended
properties profile) specified by the unique id of for instance the Payment Method,
and depending on whether the profile exist or not we open the standard profile management
dialog in the right state (edit or new). If the profile does not exist, we initialize
it with the unique id (our relation-key value). This is all done in a relatively few
lines of code, where all we do is basically the same steps as a business user would
manually do to either create a new profile or search for an existing one. All the
code pieces for this is of course already in the solution, the hard part was just
to find these exact pieces and assemble them to suit our requirements.
</p>
        <p>
I have attached some screenshots below that shows how our feature is implemented in
the Customer and Orders Manager application.
</p>
        <p>
          <u>
          </u>
        </p>
        <p>
          <a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_list_2.png">
            <img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="178" alt="payment_method_list" src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_list_thumb.png" width="244" border="0" />
          </a>
        </p>
        <p>
The figure above shows the list of payment methods in the system.
</p>
        <p>
          <a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_dialog_2.png">
            <img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="184" alt="payment_method_dialog" src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_dialog_thumb.png" width="244" border="0" />
          </a>
        </p>
        <p>
The figure above shows the new button we have added to the dialog, that, when the
user clicks on the button, executes our custom logic that opens up the profile management
dialog (either a new one, or an existing one), related to the payment method.
</p>
        <p>
          <a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_extension_profile_dialog_2.png">
            <img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="203" alt="payment_method_extension_profile_dialog" src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_extension_profile_dialog_thumb.png" width="244" border="0" />
          </a>    
</p>
        <p>
The figure above shows the actual profile which we use for extending the properties
for a specific payment method in the system.
</p>
        <p>
          <a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_related_shipping_method_2.png">
            <img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height="203" alt="payment_related_shipping_method" src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_related_shipping_method_thumb.png" width="244" border="0" />
          </a> 
</p>
        <p>
The figure above shows the actual relation between the payment method and the shipment
method. The logical relation is established between the two extension profiles of
the "Post Danmark" shipment method and the "Post Danmark Efterkrav" payment method.
</p>
        <h4>Conclusion
</h4>
        <h1>
        </h1>
        <h1>
        </h1>
        <p>
The solution I have described here for extending Payment Method and Shipment Methods
in Commerce Server 2007 works really good for us and we have added a lot of extended
properties to both the Payment Method type (see screenshots supplied) and the Shipment
Method type. Some of the functionality this provides is the ability to filter a specific
shipment method to a specific country as well as filter a payment method based on
the items added to the basket. Really cool and useful features and the best part of
it: we are using standard Commerce Server all the way! :-)
</p>
        <p>
Another very cool thing to mention is that when we had <a href="http://blogs.msdn.com/maxakbar/default.aspx">Max
Akbar</a> at <a href="http://www.vertica.dk">Vertica</a> to provide us some educational
days of concentrated <a href="http://commerceservertraining.com/">Commerce Server
training</a>, I gave him a demo of the feature, and his responses to it were really
good.
</p>
        <p>
If you have any questions or want me to elaborate more on this subject please don't
hesitate to contact me in any way.
</p>
        <img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=d8867c4f-47b5-4e36-b8d1-b8966d3b10ae" />
      </body>
      <title>How to extend Commerce Server Payment Methods and Shipment Methods</title>
      <guid isPermaLink="false">http://blog.brianh.dk/PermaLink,guid,d8867c4f-47b5-4e36-b8d1-b8966d3b10ae.aspx</guid>
      <link>http://blog.brianh.dk/2007/12/16/HowToExtendCommerceServerPaymentMethodsAndShipmentMethods.aspx</link>
      <pubDate>Sun, 16 Dec 2007 19:12:41 GMT</pubDate>
      <description>&lt;p&gt;
By default Microsoft Commerce Server 2007 is highly extensible for example in regards
to extending the object model in the Order System (e.g. creating new classes or extending
existing ones). Also the Profile System is properly the most extensible subsystem
in Commerce Server being a general purpose data repository that allows the developer
to define and store any custom data in it. While this is all great and good news,
not everything on the Commerce Server platform is possible to extend and this post
will focus on one specific lack of extensibility in regards to extending Payment Methods
and Shipment Methods. 
&lt;/p&gt;
&lt;p&gt;
If you want to read more about Commerce Server 2007 seen from a developer and architect's
point of view, I recommend reading my colleague Søren's "&lt;a href="http://www.publicvoid.dk/DevelopingWithMicrosoftCommerceServer2007Part2ThreeWayDataAccess.aspx"&gt;Developing
with Commerce Server 2007&lt;/a&gt;"-series on his blog &lt;a href="http://publicvoid.dk/"&gt;publicvoid.dk&lt;/a&gt;.
&lt;/p&gt;
&lt;h4&gt;Requirements
&lt;/h4&gt;
&lt;p&gt;
In Denmark we have a national wide postal service called &lt;a href="http://www.postdanmark.dk/index.jsp"&gt;Post
Danmark&lt;/a&gt; which we use as our carrier for sending letters, packages etc. This is
defined in Commerce Server as one of the Shipment Methods on the specific customer
solution I'm currently working on. Post Danmark also offers a service allowing the
end-customer to postpone the actual payment of the order until the physical arrival.
By having this option, we created a Payment Method in the system called "Post Danmark
Efterkrav" &lt;em&gt;("Post Danmark Cash On Delivery")&lt;/em&gt;, so the customer can choose
this in the checkout process. To be able to use this payment method we demand that
the customer has already chosen Post Danmark as the shipment method. If the customer
has chosen another shipment method we will not allow the customer to choose the cash
on delivery payment method from Post Danmark, thus having the payment method depending
on the chosen shipment method.
&lt;/p&gt;
&lt;p&gt;
Management of Commerce Server Payment Methods and Shipment Methods takes place in
the Customer and Orders Manager application. When creating a Payment Method it is
possible to specify e.g. Payment Type (Credit Card Payment, Gift Certificate Payment,
etc.). It is also possible to specify Name and Description of the Payment Method in
the languages you want to support, plus a few more options. Unfortunately this is
one of the areas in Commerce Server where you seemed to be locked by this model or
behavior and you cannot do any obvious extending. Nonetheless we needed some way to
do it, because we wanted to be able to specify a relation or dependency between Payment
Methods and Shipment Methods. We wanted to make it possible to specify that a specific
Payment Method should only be available when a specific Shipment Method was selected
in the checkout process. And of course we wanted to accomplish this using as much
Commerce Server standards as possible, so future service pack upgrades would not cause
problems among other obvious reasons :-) 
&lt;/p&gt;
&lt;h4&gt;The solution
&lt;/h4&gt;
&lt;p&gt;
As mentioned earlier the Profile System in Commerce Server is our general purpose
data repository where we can model almost anything and leverage from Commerce Server
API's to do data access operations and provide security to our data store. The solution
we came up with was to create two new profiles in the Profile System; one for payment
method extended properties &lt;em&gt;(PaymentMethodExtensionProfile)&lt;/em&gt; and another for
shipment method extended properties &lt;em&gt;(ShipmentMethodExtensionProfile)&lt;/em&gt; and
link these profiles to the Shipment Method and the Payment Method types.
&lt;/p&gt;
&lt;p&gt;
Shipped with Commerce Server comes a Software Development Kit, which among other very
nice things contains the complete source code to all the business applications (except
the Catalog and Inventory Schema Manager). There are two classes in the Customer and
Orders Manager project responsible of displaying the dialogs for management of Payment
Methods &lt;em&gt;(PaymentMethodEditView)&lt;/em&gt; and Shipment Methods &lt;em&gt;(ShippingMethodEditView)&lt;/em&gt; respectively.
In each of these Windows Forms dialog classes, we added a new button in the toolbar,
gave it an icon and named it "Extended Properties". When the user clicks on this button,
we execute some code, that depending on whether it is executed from a Payment Method
or Shipment Method basically just performs a search for a specific profile (our extended
properties profile) specified by the unique id of for instance the Payment Method,
and depending on whether the profile exist or not we open the standard profile management
dialog in the right state (edit or new). If the profile does not exist, we initialize
it with the unique id (our relation-key value). This is all done in a relatively few
lines of code, where all we do is basically the same steps as a business user would
manually do to either create a new profile or search for an existing one. All the
code pieces for this is of course already in the solution, the hard part was just
to find these exact pieces and assemble them to suit our requirements.
&lt;/p&gt;
&lt;p&gt;
I have attached some screenshots below that shows how our feature is implemented in
the Customer and Orders Manager application.
&lt;/p&gt;
&lt;p&gt;
&lt;u&gt;&lt;/u&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_list_2.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=178 alt=payment_method_list src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_list_thumb.png" width=244 border=0&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The figure above shows the list of payment methods in the system.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_dialog_2.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=184 alt=payment_method_dialog src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_dialog_thumb.png" width=244 border=0&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The figure above shows the new button we have added to the dialog, that, when the
user clicks on the button, executes our custom logic that opens up the profile management
dialog (either a new one, or an existing one), related to the payment method.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_extension_profile_dialog_2.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=203 alt=payment_method_extension_profile_dialog src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_method_extension_profile_dialog_thumb.png" width=244 border=0&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
The figure above shows the actual profile which we use for extending the properties
for a specific payment method in the system.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_related_shipping_method_2.png"&gt;&lt;img style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=203 alt=payment_related_shipping_method src="http://blog.brianh.dk/content/binary/WindowsLiveWriter/HowtoextendCommerceServerShipmentandPaym_863F/payment_related_shipping_method_thumb.png" width=244 border=0&gt;&lt;/a&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The figure above shows the actual relation between the payment method and the shipment
method. The logical relation is established between the two extension profiles of
the "Post Danmark" shipment method and the "Post Danmark Efterkrav" payment method.
&lt;/p&gt;
&lt;h4&gt;Conclusion
&lt;/h4&gt;
&lt;h1&gt;
&lt;/h1&gt;
&lt;h1&gt;
&lt;/h1&gt;
&lt;p&gt;
The solution I have described here for extending Payment Method and Shipment Methods
in Commerce Server 2007 works really good for us and we have added a lot of extended
properties to both the Payment Method type (see screenshots supplied) and the Shipment
Method type. Some of the functionality this provides is the ability to filter a specific
shipment method to a specific country as well as filter a payment method based on
the items added to the basket. Really cool and useful features and the best part of
it: we are using standard Commerce Server all the way! :-)
&lt;/p&gt;
&lt;p&gt;
Another very cool thing to mention is that when we had &lt;a href="http://blogs.msdn.com/maxakbar/default.aspx"&gt;Max
Akbar&lt;/a&gt; at &lt;a href="http://www.vertica.dk"&gt;Vertica&lt;/a&gt; to provide us some educational
days of concentrated &lt;a href="http://commerceservertraining.com/"&gt;Commerce Server
training&lt;/a&gt;, I gave him a demo of the feature, and his responses to it were really
good.
&lt;/p&gt;
&lt;p&gt;
If you have any questions or want me to elaborate more on this subject please don't
hesitate to contact me in any way.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=d8867c4f-47b5-4e36-b8d1-b8966d3b10ae" /&gt;</description>
      <comments>http://blog.brianh.dk/CommentView,guid,d8867c4f-47b5-4e36-b8d1-b8966d3b10ae.aspx</comments>
      <category>Commerce Server</category>
    </item>
    <item>
      <trackback:ping>http://blog.brianh.dk/Trackback.aspx?guid=283c5b67-2bea-4976-8d61-8bae503fa49b</trackback:ping>
      <pingback:server>http://blog.brianh.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.brianh.dk/PermaLink,guid,283c5b67-2bea-4976-8d61-8bae503fa49b.aspx</pingback:target>
      <dc:creator>Brian Holmgård Kristensen</dc:creator>
      <wfw:comment>http://blog.brianh.dk/CommentView,guid,283c5b67-2bea-4976-8d61-8bae503fa49b.aspx</wfw:comment>
      <wfw:commentRss>http://blog.brianh.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=283c5b67-2bea-4976-8d61-8bae503fa49b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
My first experience with Microsoft Commerce Server was in May 2007 when I started
working at <a href="http://www.vertica.dk">Vertica</a>. At that point I had absolutely
no clue of what Commerce Server could leverage as a standard eCommerce platform. The
first few weeks basically went by doing training based on some internal
training material and the documentation on <a href="http://msdn2.microsoft.com/en-us/library/ms864793.aspx">MSDN
for Commerce Server</a>. Soon after that I became team member on a Commerce
Server project for one of our customers. Since then my work has been more or
less exclusively to this project which have been a incredible educational experience
for me.
</p>
        <p>
Moving on to my point it had been planned for some months that we should have <a href="http://blogs.msdn.com/maxakbar/">Max
Akbar</a>, former Program Manager for the Microsoft Commerce Server Team, come to
our company location in Aarhus and provide us some technical training on Commerce
Server. At that time I had only read some of Max' posts about Commerce Server
but honestly I did not knew much about who he was or what he had do with
the Commerce Server product. But as I got to learn more about Commerce Server and
began digging more and more into the technical aspects of the product, in
purpose of extending and modifying it to our customer needs, Max' name and posts appeared
more frequently on the web-sites I came along. Also he had posted some very useful
articles on his <a href="http://blogs.msdn.com/maxakbar/">blog</a> that really helped
me a lot doing the development. So it was very great news that he would come to our
company, and I was really looking forward to meet him and none the less learn from
him.
</p>
        <p>
So this week we had Max coming all the way from California, USA to Aarhus, Denmark to spend a
couple of days with us giving in-house training on the Commerce Server 2007
product. Although Max suffered a bit jetlag from his flight there were no
way to tell it because he really pulled off some very intensive training and
the level of expertise was just stunning! The experience and in-depth knowledge with
the Commerce Server product was absolutely remarkable. I really enjoyed attending
the course with Max and it fully lived up to my expectations - and then some.
</p>
        <p>
This blog post doesn't cover all the topics that we went through the training
with Max, but hopefully it gives a resume of what went on. The first day we got
around talking about the installation, architecture and security stuff of Commerce
Server as well as giving us some insight on some of the work he had
been doing at Microsoft and some of the large scale enterprise solutions
he have been a part of. It was very exciting to hear about all that. The second
day we learned a lot about the CSS - Commerce Server Staging on how to easily deploy
Commerce Server business data and content between different environments. It was very
cool to learn about because the CSS part of Commerce Server is one thing
that I have none on-hands experience with nor much knowledge about.
We also got through the Catalog-, Profiles- and Marketing systems which gave me some
very good insight on how this is implemented in the product and how to best interact
with the systems. After the second day of training most of us from Vertica went
out with Max to grap a beer on Kafé Komma and later we all went
to eat on a really good restaurant. The third and last day of the training was
primarily focused on integration, extending the Orders system and building custom
pipelines.
</p>
        <p>
For me it was really cool to show Max some of the stuff that I have been working
on. Especially on how I have extended the Payment- and Shipping Methods using
the standard Profile System and how I integrated this into the Customer
and Orders Manager application with pretty much no modification to the application
at all. I'm proud to say that Max found the stuff I did very cool.
I might write a post about it some day.
</p>
        <p>
Also pretty cool was that Max gave us some of the custom tools that he has developed
for his various Commerce Server solutions and I'm absolutely sure that
they will come in pretty handy in our solutions as well. Max is a really nice guy
and besides all the training he did we also had a lot of fun during the
training days. I'm really glad to met Max and hopefully I'll come across him again
some day.
</p>
        <p>
I'm sorry for any bad English, bad grammar or misspelling. The clock
is getting pretty late and I'm not even done packing all my stuff yet. The thing is
that we are all leaving very early in the morning (4.15 AM to be exact) as we
are going with the train from Aarhus to the Copenhagen Airport
from where we are flying to Edinburgh. Vertica has arranged a company trip throughout
the weekend to Scotland which I'm really looking forward to.
</p>
        <img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=283c5b67-2bea-4976-8d61-8bae503fa49b" />
      </body>
      <title>Very cool Commerce Server training with Max Akbar</title>
      <guid isPermaLink="false">http://blog.brianh.dk/PermaLink,guid,283c5b67-2bea-4976-8d61-8bae503fa49b.aspx</guid>
      <link>http://blog.brianh.dk/2007/09/06/VeryCoolCommerceServerTrainingWithMaxAkbar.aspx</link>
      <pubDate>Thu, 06 Sep 2007 20:30:35 GMT</pubDate>
      <description>&lt;p&gt;
My first experience with Microsoft Commerce Server was in May 2007 when I started
working at &lt;a href="http://www.vertica.dk"&gt;Vertica&lt;/a&gt;. At that point I had absolutely
no clue of what Commerce Server could leverage as a standard eCommerce platform. The
first few weeks basically went by doing&amp;nbsp;training&amp;nbsp;based on some internal
training material and the documentation on &lt;a href="http://msdn2.microsoft.com/en-us/library/ms864793.aspx"&gt;MSDN
for Commerce Server&lt;/a&gt;. Soon after that I&amp;nbsp;became team member&amp;nbsp;on a&amp;nbsp;Commerce
Server&amp;nbsp;project for one of our customers. Since then my work has been more or
less exclusively to this project which have been a incredible educational experience
for me.
&lt;/p&gt;
&lt;p&gt;
Moving on to my point it had been planned for some months that we should have &lt;a href="http://blogs.msdn.com/maxakbar/"&gt;Max
Akbar&lt;/a&gt;, former Program Manager for the Microsoft Commerce Server Team, come to
our company location in Aarhus and provide us some technical&amp;nbsp;training on&amp;nbsp;Commerce
Server. At that time I had only read some of Max' posts&amp;nbsp;about&amp;nbsp;Commerce Server
but honestly I&amp;nbsp;did not knew much about who he was&amp;nbsp;or what he had do&amp;nbsp;with
the Commerce Server product. But as I got to learn more about Commerce Server and
began digging more and more into the technical&amp;nbsp;aspects of the&amp;nbsp;product, in
purpose of&amp;nbsp;extending and modifying it to our customer needs, Max' name and posts&amp;nbsp;appeared
more frequently on the web-sites I came along. Also he had posted some very useful
articles on his &lt;a href="http://blogs.msdn.com/maxakbar/"&gt;blog&lt;/a&gt; that really helped
me a lot doing the development. So it was very great news that he would come to our
company, and I was really looking forward to meet him and none the less learn from
him.
&lt;/p&gt;
&lt;p&gt;
So this week we had Max coming all the way from California, USA&amp;nbsp;to Aarhus, Denmark&amp;nbsp;to&amp;nbsp;spend&amp;nbsp;a
couple of days with us giving&amp;nbsp;in-house training on the&amp;nbsp;Commerce Server 2007
product. Although&amp;nbsp;Max suffered a bit jetlag from his flight there&amp;nbsp;were no
way to tell it&amp;nbsp;because he really pulled off some very intensive training and
the level of expertise was just stunning! The experience and in-depth knowledge with
the Commerce Server product was absolutely remarkable. I really enjoyed attending
the course with Max and it fully lived up to my expectations - and then some.
&lt;/p&gt;
&lt;p&gt;
This blog post&amp;nbsp;doesn't cover all the topics that we went through the training
with Max, but hopefully&amp;nbsp;it gives a resume of what went on. The first day we got
around talking about the installation, architecture and security stuff of Commerce
Server as well as giving us some insight on&amp;nbsp;some of&amp;nbsp;the work he&amp;nbsp;had
been doing&amp;nbsp;at Microsoft and some of the&amp;nbsp;large scale enterprise solutions
he have been a part of.&amp;nbsp;It was very exciting to hear about all that. The second
day we learned a lot about the CSS - Commerce Server Staging&amp;nbsp;on how to easily&amp;nbsp;deploy
Commerce Server business data and content between different environments. It was very
cool to&amp;nbsp;learn about because the CSS part of Commerce Server&amp;nbsp;is one thing
that I have&amp;nbsp;none on-hands&amp;nbsp;experience with nor&amp;nbsp;much knowledge about.
We also got through the Catalog-, Profiles- and Marketing systems which gave me some
very good insight on how this is implemented in the product and how to best interact
with the systems. After the second day of training&amp;nbsp;most of us from Vertica went
out&amp;nbsp;with&amp;nbsp;Max to grap a beer on Kafé Komma and later&amp;nbsp;we all&amp;nbsp;went
to eat&amp;nbsp;on a really good restaurant. The third and last day of the training was
primarily focused on integration, extending the Orders system and building custom
pipelines.
&lt;/p&gt;
&lt;p&gt;
For me it was really cool to show Max some of the stuff that I have been&amp;nbsp;working
on.&amp;nbsp;Especially on how I have extended the Payment- and Shipping Methods using
the standard&amp;nbsp;Profile System and&amp;nbsp;how I&amp;nbsp;integrated this into the Customer
and Orders Manager application with pretty much&amp;nbsp;no&amp;nbsp;modification to the application
at all.&amp;nbsp;I'm proud to say that Max found the&amp;nbsp;stuff I did&amp;nbsp;very cool.
I might write a post about it some day.
&lt;/p&gt;
&lt;p&gt;
Also pretty cool was that Max gave us some of the custom tools that he has developed
for his various&amp;nbsp;Commerce Server solutions&amp;nbsp;and I'm&amp;nbsp;absolutely sure that
they will come in pretty handy in our solutions as well. Max&amp;nbsp;is a really&amp;nbsp;nice&amp;nbsp;guy
and&amp;nbsp;besides all the training he did we also had&amp;nbsp;a lot of fun during the
training days. I'm really glad to met Max and hopefully I'll come across him again
some day.
&lt;/p&gt;
&lt;p&gt;
I'm sorry for any bad English, bad&amp;nbsp;grammar&amp;nbsp;or misspelling.&amp;nbsp;The clock
is getting pretty late and I'm not even done packing all my stuff yet. The thing is
that we are all leaving very early in the&amp;nbsp;morning (4.15 AM to be exact) as&amp;nbsp;we
are&amp;nbsp;going with&amp;nbsp;the train from Aarhus to the&amp;nbsp;Copenhagen&amp;nbsp;Airport
from where we are flying to Edinburgh. Vertica has arranged a company trip&amp;nbsp;throughout
the weekend to Scotland which&amp;nbsp;I'm really looking forward to.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=283c5b67-2bea-4976-8d61-8bae503fa49b" /&gt;</description>
      <comments>http://blog.brianh.dk/CommentView,guid,283c5b67-2bea-4976-8d61-8bae503fa49b.aspx</comments>
      <category>Commerce Server</category>
      <category>Education</category>
      <category>Personal</category>
      <category>Training</category>
    </item>
    <item>
      <trackback:ping>http://blog.brianh.dk/Trackback.aspx?guid=4c820cb3-15f1-4907-b57c-b7b8983a5776</trackback:ping>
      <pingback:server>http://blog.brianh.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.brianh.dk/PermaLink,guid,4c820cb3-15f1-4907-b57c-b7b8983a5776.aspx</pingback:target>
      <dc:creator>Brian Holmgård Kristensen</dc:creator>
      <wfw:comment>http://blog.brianh.dk/CommentView,guid,4c820cb3-15f1-4907-b57c-b7b8983a5776.aspx</wfw:comment>
      <wfw:commentRss>http://blog.brianh.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=4c820cb3-15f1-4907-b57c-b7b8983a5776</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The other day I wrote a <a href="http://blog.brianh.dk/2007/08/25/CommerceServerSearchExceptionOnWebsiteWhenAddingNewProperty.aspx">blog
post</a> about a search problem in the Commerce Server Starter Site. I had added
a new property to the propertiesToReturn element of web.config and that caused all
search operations on the web-site to fail with the following exception from
the database: 'Invalid column name 'Show_Variants_As_Products'. 
</p>
        <p>
In my efforts to solve the problem I stumbled across another issue when I tried to
execute the "Refresh Catalog FullText Index" command on one of my catalogs
in the Catalog Manager (screenshot provided). 
</p>
        <p>
This command executed without errors but when I tried to perform a new search
on the web-site the database threw another exception with the following error message: 
</p>
        <p>
Full-text table or indexed view has more than one LCID among its full-text indexed
columns. 
</p>
        <p>
This <a href="http://www.dbforums.com/archive/index.php/t-907917.html">post</a> helped
me to the solution. 
</p>
        <p>
          <strong>The solution</strong>
        </p>
        <p>
In SQL Server Management Studio I opened the Product Catalog database and found
the table holding the products for the specific catalog I initially performed the
Refresh command on. I changed  the "Language for Word Breaker" setting for the
CategoryName column from 'English' back to 'Neutral'  in the properties
Full Text Indexing (screenshot provided below). 
</p>
        <p>
dbo.[catalogname]_CatalogProducts &gt; Full Text index &gt; Properties &gt;
Columns &gt; CategoryName=Neutral (from English)
</p>
        <p>
          <img src="http://blog.brianh.dk/content/binary/sql2005.gif" style="border: 1px solid #000000;" border="0" />
        </p>
        <img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=4c820cb3-15f1-4907-b57c-b7b8983a5776" />
      </body>
      <title>Refresh Catalog FullText Index causes search operations to fail</title>
      <guid isPermaLink="false">http://blog.brianh.dk/PermaLink,guid,4c820cb3-15f1-4907-b57c-b7b8983a5776.aspx</guid>
      <link>http://blog.brianh.dk/2007/08/28/RefreshCatalogFullTextIndexCausesSearchOperationsToFail.aspx</link>
      <pubDate>Tue, 28 Aug 2007 18:30:22 GMT</pubDate>
      <description>&lt;p&gt;
The other day I wrote a &lt;a href="http://blog.brianh.dk/2007/08/25/CommerceServerSearchExceptionOnWebsiteWhenAddingNewProperty.aspx"&gt;blog
post&lt;/a&gt;&amp;nbsp;about a search problem in the Commerce Server Starter Site. I had added
a new property to the propertiesToReturn element of web.config and that caused all
search operations on the web-site&amp;nbsp;to fail with&amp;nbsp;the following exception from
the database: 'Invalid column name 'Show_Variants_As_Products'. 
&lt;p&gt;
In my efforts to solve the problem I stumbled across another issue when I tried to
execute the "Refresh Catalog FullText Index" command on&amp;nbsp;one of my&amp;nbsp;catalogs
in the Catalog Manager (screenshot provided). 
&lt;p&gt;
This command executed without errors but when I tried to perform a new&amp;nbsp;search
on the web-site the database threw another exception with the following error message: 
&lt;p&gt;
Full-text table or indexed view has more than one LCID among its full-text indexed
columns. 
&lt;p&gt;
This&amp;nbsp;&lt;a href="http://www.dbforums.com/archive/index.php/t-907917.html"&gt;post&lt;/a&gt; helped
me to the solution. 
&lt;p&gt;
&lt;strong&gt;The solution&lt;/strong&gt; 
&lt;p&gt;
In SQL Server Management Studio&amp;nbsp;I opened the Product Catalog database and&amp;nbsp;found
the table holding the products for the specific catalog I initially performed the
Refresh command on. I changed&amp;nbsp; the "Language for Word Breaker" setting for the
CategoryName column from 'English' back to 'Neutral'&amp;nbsp; in the&amp;nbsp;properties
Full Text Indexing (screenshot provided&amp;nbsp;below). 
&lt;p&gt;
dbo.[catalogname]_CatalogProducts &amp;gt; Full Text index&amp;nbsp;&amp;gt; Properties&amp;nbsp;&amp;gt;
Columns&amp;nbsp;&amp;gt; CategoryName=Neutral (from English)
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.brianh.dk/content/binary/sql2005.gif" style="border: 1px solid #000000;" border=0&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=4c820cb3-15f1-4907-b57c-b7b8983a5776" /&gt;</description>
      <comments>http://blog.brianh.dk/CommentView,guid,4c820cb3-15f1-4907-b57c-b7b8983a5776.aspx</comments>
      <category>Commerce Server</category>
    </item>
    <item>
      <trackback:ping>http://blog.brianh.dk/Trackback.aspx?guid=3adde20e-cac3-414f-91de-4c2e08078de8</trackback:ping>
      <pingback:server>http://blog.brianh.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.brianh.dk/PermaLink,guid,3adde20e-cac3-414f-91de-4c2e08078de8.aspx</pingback:target>
      <dc:creator>Brian Holmgård Kristensen</dc:creator>
      <wfw:comment>http://blog.brianh.dk/CommentView,guid,3adde20e-cac3-414f-91de-4c2e08078de8.aspx</wfw:comment>
      <wfw:commentRss>http://blog.brianh.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=3adde20e-cac3-414f-91de-4c2e08078de8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>Short explanation</strong>
        </p>
        <p>
When creating a new property definition which has the 'Assign to all products' attribute
set to true and when this new property is added to the propertiesToReturn element
in web.config (configuration/commerceSite/propertiesToReturn) search operations on
the web-site can cause the following exception: <font color="#ff0000">Invalid
column name '[property-name]'</font>. This occurs if one or more of the catalogs in
Commerce Server are out of sync with the catalog schema (defined in the Catalog And
Inventory Schema Manager) e.g. if the catalog is empty. 
</p>
        <p>
          <strong>Solution:</strong> Create a new dummy product in each catalog to ensure synchronization
is done. You can safely delete the dummy product after creation.
</p>
        <p>
          <br />
          <strong>Complete explanation</strong>
        </p>
        <p>
I had added the property 'Show_Variants_As_Products' in the Catalog And Inventory
Schema Manager. The 'Assign to all products' attribute was set to true to ensure that
all products in Commerce Server include this property.
</p>
        <p>
Afterwards I added the new property to the propertiesToReturn string list in web.config:
</p>
        <p>
          <font face="Courier New" color="#a52a2a">&lt;commerceSite 
<br />
 requireSSL="false" 
<br />
 enableExpressCheckout="false" 
<br />
 persistAnonymousBaskets="false" 
<br />
 rewriteProductUrls="true" 
<br />
 assetLocation="~/" 
<br />
 defaultShippingMethodId="87c0e40f-3661-4197-8f88-fa3f101ae1ad" 
<br />
 propertiesToReturn="CategoryName, ProductID, CatalogName, i_ClassType, DisplayName,
cy_list_price, VariantID,  <strong>Show_Variants_As_Products</strong>"&gt;</font>
        </p>
        <p>
This setting ensures that the property is available in the returned DataSet when e.g.
performing search operations on the web-site.
</p>
        <p>
However when I tried to perform a search, the web-site crashed with the following exception
coming from the SQL Server:
</p>
        <p>
          <font color="#ff0000">
            <strong>Invalid column name 'Show_Variants_As_Products'.</strong>
          </font>
        </p>
        <p>
In the Catalog Manager I opened a random product in one of my catalogs to verify
that the new property was actual present - and it was. So a bit confused I opened
SQL Server Profiler to create a new trace to check the queries which was actually
sent to the database from the web-site when performing a search.
</p>
        <p>
The query sent to the database was:
</p>
        <p>
          <font face="Courier New" color="#000000">
            <font size="1">
              <font color="#0000ff">exec </font>dbo.ctlg_GetResults 
<br />
 @Catalogs=N<font color="#ff0000">'<b>MyCatalog1,MyCatalog2,MyCatalog3</b>,'</font>,<br />
 @Language=N<font color="#ff0000">'da-DK'</font>,<br />
 @PropertiesToReturn=N</font>
            <font size="1">
              <font color="#ff0000">'[CategoryName],
[ProductID], [CatalogName], [i_ClassType], [DisplayName], [cy_list_price], [VariantID],
[Show_Variants_As_Products], [BaseCatalogName],<br />
 [oid], [OrigProductId], [OrigVariantId], [OrigCategoryName], [DefinitionName],
[PrimaryParentCategory], [UseCategoryPricing]'</font>,<br />
 @SQLClause=NULL,<br />
 @FTSPhrase=N<font color="#ff0000">'perfume'</font>,<br />
 @AdvancedFTSPhrase=<font color="#808080">NULL</font>,<br />
 @OrderBy=NULL,<br />
 @StartingRec=1,<br />
 @NumRecords=10,<br />
 @SortAscending=1,<br />
 @ClassType=10,<br />
 @eJoinType=-1,<br />
 @TargetTableName=N<font color="#ff0000">''</font>,<br />
 @SourceJoinKey=N<font color="#ff0000">''</font>,<br />
 @TargetJoinKey=N<font color="#ff0000">''</font>,<br />
 @RecordCount=@p16 <font color="#0000ff">output</font>,<br />
 @EnableInventory=1,<br />
 @InventoryServerName=<font color="#808080">NULL</font>,<br />
 @InventoryDatabaseName=<font color="#808080">NULL</font>,<br />
 @FilterOutOfStockProducts=0,<br />
 @FilterBackOrderableProducts=0,<br />
 @FilterPreOrderableProducts=0,<br />
 @UseThresholdAsFloor=1,<br />
 @TreatmissingAsOutOfStock=0,<br />
 @StockHandling=0,<br />
 @InventoryPropertiesToReturn=N<font color="#ff0000">'*'</font>,<br />
 @CategoryClause=<font color="#808080">NULL</font>,<br />
 @Recursive=0</font>
          </font>
          <br />
        </p>
        <p>
When executing this query directly on database I got the same error message. I opened
each of the catalog tables to verify that the new column 'Show_Variants_As_Products'
was present. The column was present in the first two catalogs (MyCatalog1 and MyCatalog2)
but in the last catalog (MyCatalog3) the column was not present indicating that this
specific table was out of sync with the Catalog schema. The catalog was also in fact
empty. So creating a new dummy product in MyCatalog3 using the Catalog Manager did
the trick of getting the MyCatalog3 catalog table back in sync with the Catalog schema.
I tested it with a new search operation on the web-site and everything returned successfully.<br /></p>
        <img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=3adde20e-cac3-414f-91de-4c2e08078de8" />
      </body>
      <title>Commerce Server: Search exception on web-site when adding new property</title>
      <guid isPermaLink="false">http://blog.brianh.dk/PermaLink,guid,3adde20e-cac3-414f-91de-4c2e08078de8.aspx</guid>
      <link>http://blog.brianh.dk/2007/08/25/CommerceServerSearchExceptionOnWebsiteWhenAddingNewProperty.aspx</link>
      <pubDate>Sat, 25 Aug 2007 10:24:16 GMT</pubDate>
      <description>&lt;p&gt;
&lt;strong&gt;Short explanation&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
When creating a new property definition which has the 'Assign to all products' attribute
set to true and when this new property is added to the propertiesToReturn element
in web.config (configuration/commerceSite/propertiesToReturn) search operations on
the web-site&amp;nbsp;can cause the following exception: &lt;font color=#ff0000&gt;Invalid column
name '[property-name]'&lt;/font&gt;. This occurs if one or more of the catalogs in Commerce
Server are out of sync with the catalog schema (defined in the Catalog And Inventory
Schema Manager)&amp;nbsp;e.g. if the catalog is empty. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; Create a new dummy product in each catalog to ensure synchronization
is done. You can safely delete the dummy&amp;nbsp;product after creation.
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;strong&gt;Complete explanation&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I had added the property 'Show_Variants_As_Products' in the Catalog And Inventory
Schema Manager. The 'Assign to all products' attribute was set to true to ensure that
all products in Commerce Server include this property.
&lt;/p&gt;
&lt;p&gt;
Afterwards I added the new property to the propertiesToReturn string list in web.config:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New" color=#a52a2a&gt;&amp;lt;commerceSite 
&lt;br&gt;
&amp;nbsp;requireSSL="false" 
&lt;br&gt;
&amp;nbsp;enableExpressCheckout="false" 
&lt;br&gt;
&amp;nbsp;persistAnonymousBaskets="false" 
&lt;br&gt;
&amp;nbsp;rewriteProductUrls="true" 
&lt;br&gt;
&amp;nbsp;assetLocation="~/" 
&lt;br&gt;
&amp;nbsp;defaultShippingMethodId="87c0e40f-3661-4197-8f88-fa3f101ae1ad" 
&lt;br&gt;
&amp;nbsp;propertiesToReturn="CategoryName, ProductID, CatalogName, i_ClassType, DisplayName,
cy_list_price, VariantID,&amp;nbsp; &lt;strong&gt;Show_Variants_As_Products&lt;/strong&gt;"&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
This setting ensures that the property is available in the returned DataSet when e.g.
performing search operations on the web-site.
&lt;/p&gt;
&lt;p&gt;
However when I tried to perform a search, the web-site crashed with&amp;nbsp;the following&amp;nbsp;exception
coming from the SQL Server:
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#ff0000&gt;&lt;strong&gt;Invalid column name 'Show_Variants_As_Products'.&lt;/strong&gt;&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
In the Catalog Manager I opened a random&amp;nbsp;product in one of my catalogs to verify
that the new property was actual present - and it was. So a bit confused I opened
SQL Server Profiler to create a new trace to check the queries which was actually
sent to the database from the web-site when performing a search.
&lt;/p&gt;
&lt;p&gt;
The query sent to the database was:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New" color=#000000&gt;&lt;font size=1&gt;&lt;font color=#0000ff&gt;exec &lt;/font&gt;dbo.ctlg_GetResults 
&lt;br&gt;
&amp;nbsp;@Catalogs=N&lt;font color=#ff0000&gt;'&lt;b&gt;MyCatalog1,MyCatalog2,MyCatalog3&lt;/b&gt;,'&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@Language=N&lt;font color=#ff0000&gt;'da-DK'&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@PropertiesToReturn=N&lt;/font&gt;&lt;font size=1&gt;&lt;font color=#ff0000&gt;'[CategoryName],
[ProductID], [CatalogName], [i_ClassType], [DisplayName], [cy_list_price], [VariantID],
[Show_Variants_As_Products], [BaseCatalogName],&lt;br&gt;
&amp;nbsp;[oid], [OrigProductId], [OrigVariantId], [OrigCategoryName], [DefinitionName],
[PrimaryParentCategory], [UseCategoryPricing]'&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@SQLClause=NULL,&lt;br&gt;
&amp;nbsp;@FTSPhrase=N&lt;font color=#ff0000&gt;'perfume'&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@AdvancedFTSPhrase=&lt;font color=#808080&gt;NULL&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@OrderBy=NULL,&lt;br&gt;
&amp;nbsp;@StartingRec=1,&lt;br&gt;
&amp;nbsp;@NumRecords=10,&lt;br&gt;
&amp;nbsp;@SortAscending=1,&lt;br&gt;
&amp;nbsp;@ClassType=10,&lt;br&gt;
&amp;nbsp;@eJoinType=-1,&lt;br&gt;
&amp;nbsp;@TargetTableName=N&lt;font color=#ff0000&gt;''&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@SourceJoinKey=N&lt;font color=#ff0000&gt;''&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@TargetJoinKey=N&lt;font color=#ff0000&gt;''&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@RecordCount=@p16 &lt;font color=#0000ff&gt;output&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@EnableInventory=1,&lt;br&gt;
&amp;nbsp;@InventoryServerName=&lt;font color=#808080&gt;NULL&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@InventoryDatabaseName=&lt;font color=#808080&gt;NULL&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@FilterOutOfStockProducts=0,&lt;br&gt;
&amp;nbsp;@FilterBackOrderableProducts=0,&lt;br&gt;
&amp;nbsp;@FilterPreOrderableProducts=0,&lt;br&gt;
&amp;nbsp;@UseThresholdAsFloor=1,&lt;br&gt;
&amp;nbsp;@TreatmissingAsOutOfStock=0,&lt;br&gt;
&amp;nbsp;@StockHandling=0,&lt;br&gt;
&amp;nbsp;@InventoryPropertiesToReturn=N&lt;font color=#ff0000&gt;'*'&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@CategoryClause=&lt;font color=#808080&gt;NULL&lt;/font&gt;,&lt;br&gt;
&amp;nbsp;@Recursive=0&lt;/font&gt;&lt;/font&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
When executing this query directly on database I got the same error message. I opened
each of the catalog tables&amp;nbsp;to verify that the new column 'Show_Variants_As_Products'
was present. The column was present in the first two catalogs (MyCatalog1 and MyCatalog2)
but in the last catalog (MyCatalog3) the column was not present indicating that this
specific table was out of sync with the Catalog schema. The catalog was also in fact
empty. So creating a new dummy product in MyCatalog3 using the Catalog Manager did
the trick of getting the MyCatalog3 catalog table back in sync with the Catalog schema.
I tested it with a new search operation on the web-site and everything returned successfully.&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.brianh.dk/aggbug.ashx?id=3adde20e-cac3-414f-91de-4c2e08078de8" /&gt;</description>
      <comments>http://blog.brianh.dk/CommentView,guid,3adde20e-cac3-414f-91de-4c2e08078de8.aspx</comments>
      <category>Commerce Server</category>
    </item>
  </channel>
</rss>