April 25, 2005

Content connection and languages

Because of the daily work (most MCMS programming) little time remains left for investigation. So I am still working to find out what is the best way to connect CMS and Commerce through MSIB.

OK, my goal is: get rid of the Commerce Catalog Manager and do all the product management from within CMS.
What I have done so far: I got into the CMS approve event and created a Commerce product using the Catalog Web Service. I did not call the Catalog Web Service directly, but used the Microsoft.CatalogServer.Bridge.dll as suggested by Vinayak Tadas (see blog April 19th). I made a CMS template file with placeholders for the product properties, and ProductPropertyDataSetPlaceholders to connect Commerce product properties to CMS placeholders. Finally, in the approve event of  CMS, after I created the product, I made a new ProductPosting and called the MakeRich method like this:

ProductPosting productPosting = new ProductPosting(<ProductCode>, ProductDefinition>, <CatalogName>, postingBeingApproved);
productPosting.MakeRich(postingBeingApproved);

This in order to make my recently made product rich, i.e. store the CMS guid in the RichPostingId field of the product in Commerce. Unfortunately, instead of what I expected, the program returns the error message "the language you specified is not associated with the current catalog.". I have created the catalog for the culture "nl-NL" and have deleted the standard "en-US" culture. Does MSIB have trouble with cultures other than "en -US". Why is it not clear that the catalog is "nl-NL"? The catalog I have has only one culture. Now I wonder how MSIB wants you to implement multiple cultures. Should there be a product posting for each culture? Or should all the cultures be integrated in one posting. Logically speaking, only the first option makes sense. I hope to come back soon and inform you further on my investigations. 

Posted by Peter at 20:52:06 | Permanent Link | Comments (5) |

April 19, 2005

Calling the catalog webservice

In my recent posts I described calling the Catalog Web Service from CMS. On approval of the CMS posting the web service was called directly. In an article by Vinayak Tadas, he advices to use the classes exposed by the Microsoft.CatalogServer.Bridge.dll assembly instead of calling the Catalog Web Service directly. You can find this assembly under Program Files/Microsoft Commerce Server 2002/FP1/Assemblies.

In your code, don't forget to include references to the Microsoft.CatalogServer namespace. 

Posted by Peter at 16:31:39 | Permanent Link | Comments (0) |

April 11, 2005

Make Rich

This web service call from the Approve-event of CMS (see blog April, 10) seems to me a good solution to create a Commerce product from within CMS. The advantage is obvious, customers do not have to work with two management tools (CMS and Catalog Manager) to manage the product content. On the other hand, this solution does not provide real "content connection", since the product posting in CMS and the product in Commerce are very loosly coupled (they may be linked through the product ID). MSIB provides us with a better defined coupling: it stores the GUID of the CMS posting in the RichProductPostingID field of the Commerce product. MSIB stores the GUID when it makes the posting "rich". A method "Make rich" is available to achieve this.

Microsoft has written an interesting article which includes content connection and rich product templates.

The question I ask myself is now: Is it possible to create a product in Commerce using the web service and then connect it to CMS by GUID using the "Make Rich" method?

Posted by Peter at 16:41:33 | Permanent Link | Comments (1) |

April 10, 2005

Call CatalogWebService from MCMS

The Catalog Web Service that is shipped with Commerce Server Feature Pack 1 makes it possible to create products without using the Commerce Server Catalog Manager. We don't want to use the Catalog Manager since our customers would like to create all of their website's content using Microsoft Content Management Server. For them it is more attractive to have only one tool for editing their website namely MCMS.

So, Commerce products must be postings in CMS.

Let say we would like to create a product in Commerce on approval of the product posting in CMS.  The approval event can be found in the global.asax.cs. So if we make a call to the Catalog Web Service there, a product will be made in the Commerce database on approval of the product posting. The code will look something like this:

public void CmsPosting_Approving (Object sender, ChangingEventArgs e)
{

PublishingEventArgs args = e as PublishingEventArgs;
Posting postingBeingApproved = e.Target as Posting;

if (postingBeingApproved.Template.Name  == "Product")
 { 

//Necessary to create a new product: 
//Catalog name, Product Type, productId, Price, ParentCategoryName, Display Name, Culture, Ident. Property
string productCode = CMSHelper.GetPostingContent(postingBeingApproved,"phdProductCode");
int productPrice = Int32.Parse(CMSHelper.GetPostingContent(postingBeingApproved,"phdDefaultPrice"));
string productCategory = postingBeingApproved.Parent.Name.ToString();
string productName = CMSHelper.GetPostingContent(postingBeingApproved,"phdName");
    
localhost.CatalogWebService catWebService = new localhost.CatalogWebService();
catWebService.CreateProduct("<Catalog>", "<ProductType>", productCode, productPrice, productCategory, productName, "<Culture>", "ProductCode")

}
[..]

}

Posted by Peter at 21:40:27 | Permanent Link | Comments (0) |

April 06, 2005

Content Connection

MSIB is not all about connecting content between Microsoft Content Management Server and Commerce Server but content connection is an important feature. As stated in this section of MSDN, the Content Connector enables editing of Commerce Server product data from MCMS web pages. That's fine, but the problem we encounter is that we first have to enter the products using the Commerce FP1 Catalog Manager, or -before FP1- using the Commerce Bizdesk.

For our customers that is not exactly what you call a user-friendly solution, having two applications to manage the content of their site. In my opinion, customers should be able to manage the content -including products- of their site with one application, in this case MCMS. Luckily, FP1 provides us with a webservice that gives us the opportunity to talk to the Commerce catalog. In the following posts I will further talk about this subject.
Posted by Peter at 21:31:47 | Permanent Link | Comments (0) |

April 05, 2005

Starting Commerce Server and MSIB web log

Hi,

This is the first posting of my weblog about Microsoft Commerce Server and Microsoft Solutions for Internet Business (MSIB). I work as a developer for Tam Tam, a full-service internet company, trying to deepen my knowledge about these subjects. To achieve this, and to share my knowledge with others I have started this weblog. Feel free to react to the postings and share your ideas and knowledge!!

Have fun reading this weblog!

Best regards,


Peter

Posted by Peter at 22:17:40 | Permanent Link | Comments (0) |