SitecoreCommerce public resources

Advertisements

testing Commerce Server Pipelines

this is a great resource to learn how to instrument your own project to test PipeLines…
http://csdevwiki.codeplex.com/SourceControl/changeset/view/28029#

if your CS implementation is correct, you will be able to test 95% of your business logic testing your pipelines, testing pipelines, it could be very useful to verify that a new discount is interacting correctly with the existing ones, and that’s a way to automate your discount testing procedure.

3X2 Discounts on Commerce Server

As several you know, Commerce Server discounts are very cool, but sometime, if you don’t know what you are doing, they can make you crazy…

the most frequent question that I receive from my clients is about the 3 x 2 Discounts or better called N x M… generally CS newbies can configure correctly the discount on Commerce Server, but they complain about the fact that the award item is the most expensive and not the cheapest one (as it make sense for a 3×2 discount).

well Commerce Server support it from long time, the only things that you have to do is configure the Order Discount Pipeline Component properly to satisfy your discount condition. In the specific case, to let it works 3×2 properly customers HAVE to change the option to the Order Discount so that the default award is NOT the MOST EXPENSIVE FIRST but the cheapest one first.

Unfortunately this option belong at pipeline level, it means, that all basket that will run that pipeline, will follow that business rule… if you really want to avoid it, you should implemnt several pipelines and try to understand witch pipeline to run for each specific basket.

Place Orders outside of the webContext

99% of developers still look at Commerce Server as Web Platform…
in my project experience, I understood to appreciate Commerce Server as an application platform for E-Commerce architectures….

well the difference between a Web Platform and an Application platform is quite big, and this post want to demonstrate and explain hot to run the CS MultiChannel foundation outside from a web application.
More specifically I will explain how to place an order (running pipelines and so on…) in a console application.

you can get the full source code, the exe and all the proper documentation here
http://cs2009pipeconsole.codeplex.com/

this kind of scenario could be very useful to test your schema changes, Order Components, Commerce Query, Pipeline, Pipeline Components and so on much more quickly than in a classic web Context.

this project could also used to instrument your own Unit – Integration – Load test environment running test on the CS Components.

the most important configuration setting belong in the channel configuration

as you can see the code is quite simple and use a lot of the CSSamples
and the contemporary site.

//Add LineItem to the Basket

Basket mybskt= BasketManager.AddLineItem( new Microsoft.Samples.Commerce.Order.CommerceEntities.LineItem("Adventure Works Catalog","AW075-03","64",1));

var myShippingAddress = new Address();

myShippingAddress.AddressName = "any";
myShippingAddress.AddressType = 2;
myShippingAddress.Id = Guid.NewGuid().ToString();

var myBillingAddress = new Address();

myBillingAddress.AddressName = "any name";
myBillingAddress.AddressType = 2;
myBillingAddress.Id = Guid.NewGuid().ToString();

var myCreditCard = new CreditCard();

myCreditCard.AuthorizationCode = "AuthCode";
myCreditCard.CustomerName = "custName";
myCreditCard.CreditCardNumber = "4111111111111111";
myCreditCard.DisplayName = "test displayname";
myCreditCard.ExpirationMonth = 1;
myCreditCard.ExpirationYear = 2015;
myCreditCard.BillingAddressId = myBillingAddress.Id;
myCreditCard.PaymentMethod = new CommerceRelationship();
myCreditCard.PaymentMethod.Id = paymentMethodId;

//Set the Shipping, BillingAddress, ShippingMethod,CreditCard and run basket and checkoutPipeline

BasketManager.PrepareForCheckout(myShippingAddress, myBillingAddress, myCreditCard, shippingMethodId, mystr.ToArray(), paymentMethodId);

//Place the Order and run the CheckoutPipeline

BasketManager.Checkout();

this post was also inspired by the following post http://notepuddle.com/2009/02/10/using-commerce-server-2009-outside-of-a-web-application/

you can check also the following reosurces for CS 2007 http://msdn.microsoft.com/en-us/library/bb219215.aspx

and this application that do the same thing on CS 2007http://blogs.msdn.com/nihitk/archive/2006/08/07/RunningPipelinesFromAConsoleApp.aspx

Commerce Server Profile Adapter – Useful Information

As most of you already know, commerce server come with a set of Biztalk Adapters that rely on Commerce Server Web Services (the same ones used by the Business User Applications)

to create your own schema for the profile system you can use the ExportProfileXsd.exe tool

but before starting to work on the Profile Adapter there are few things that you should keep in mind:

  1. it does not support multiple profile import, it means one profile for each message….
  2. it support message types CommerceServerProfilesImport and CommerceServerProfilesUpdate on the port level and you HAVE to use Import to Add a profile and update to UPDATE a profile

the first point means, that you will have a bigger number of messages to handle (it could affect the monitoring of your solution – transaction handling and your orchestration complexity)

the second point means that in a typical UPSERT scenario you will have to query the profile system to decide witch message type to use (you can specify it in the context)

these 2 limitations are quite big and it could affect your implementation and the decision to use the Profile Adapter to integrate your profile system in your Architecture….

obviously you could consider to workaround it extending the profile system web service with your own logic to handle the UPSERT scenario, or write your own custom WCF or Biztalk adapter to support your specific requirements or consider using the SQL adapter or consider a different integration pattern (SSIS!?)

as usual there are several approaches when it comes to integrate systems and each one has his own pro and contra….

Commerce Server Catalog Adapter, common Issue with GlobalPropertySchemas

this is one of the most common issue that I had working with Commerce Server catalog Adapter…

after a succesfull installation and configuration you will receive the follwing mesage:

The Messaging Engine received an error from transport adapter “Commerce Server Catalog Adapter” when notifying the adapter with the BatchComplete event. Reason “Exception from HRESULT: 0xC0C01620”.

The problem is quite simple and easy to solve….

and it’s related to the fllowing assembly:
Microsoft.CommerceServer.GlobalPropertySchemas.CommonAdapterPropertySchema

For some reason is not installed correctly in your biztalk application (where you are using the Commerce Server Catalog Adapter)

so what you need to do to fix it is just add it to your application using the Biztalk administrative console…

just go on the root, select Add Biztalk Assemblies and select Microsoft.CommerceServer.Adapter.GlobalPropertySchemas.dll in the Commerce Server 2007 installation directory.
Once you finish the installation everything will work as expected.