LineItem PlacedPrice (cy_placed_price) 101

PlacedPrice is a property of a basket line item in the Commerce Server object model.  The name suggests (IMO) that it contains the price of the item at the time the order was placed.  However, PlacedPrice actually contains the list price of the item at the time it was placed in the basket.  The property exists to track the list price of an item, so that if it changes during the lifetime of the basket the customer can be informed (if required).

How is the Placed Price Populated?

The PlacedPrice property is populated after you run a pipeline that contains the component RequiredItemAdjustPriceCy.  Pipeline components operate on IDictionary types rather than the CS object model.  Therefore, the RequiredItemAdjustPriceCy actually populates the cy_placed_price value of each line item dictionary.  If cy_placed_price is empty the value of cy_iadjust_current_price is copied into it.  Once you save the basket with populated cy_placed_price values the value is left untouched on future runs. 

RequiredItemAdjustPriceCy is configured in the the basket.pcf pipeline that is provided with the Starter Site and the other installed PUP sites.  Therefore, it is likely you have this component configure in your site.  The image below shows the component and describes it’s PlacedPrice behaviour:

Image of a Commerce Server basket pipeline with the RequiredItemAdjustPriceCy component highlighted and an explanation of how this component populates the cy_placed_price property of a line item dictionary.

The description text on this image is taken from the documentation for RequiredItemAdjustPriceCy.  Below are other excerpts relating to PlacedPrice taken from the Commerce Server 2007 documentation.

Additional Commerce Server Documentation on PlacePrice

  Posted: 08:34:04 Thu 2 Jul 2009  Tags: Commerce Server 2007
   Permalink Comments [0]

OrderDiscount Writes discount_timestamp Properties Into The Future?

back-to-the-future-film-poster The Commerce Server OrderDiscount pipeline component writes applicable discount information into the Order dictionary.  Specifically, it writes discount information into the item._itemlevel_discounts_applied  SimpleList and the _orderlevel_discounts_detail Dictionary/SimpleList.  The written information includes the property discount_timestamp which contains the last modified DateTime for the discount.  Curiously, it would appear that the values placed in these discount_timestamp properties are always one second later than the actual last modified DateTime value.  The correct value can be found in the dt_campaignitem_modified column of the mktg_campaign_item table (where the discounts and other campaign items are stored).

Is this a hack of some sort?  A mistake on my part?  A bug?  I have not done a detailed investigation (as that would be sad) so I don't really know the answer.

Filed under Commerce Server minutiae.  Do not read when operating heavy machinery as may cause drowsiness.

  Posted: 02:50:21 Tue 10 Mar 2009  Tags: Commerce Server 2007 | Commerce Server 2009
   Permalink Comments [0]

Commerce Server Mojave PDC Session Video Available Now

Tom Schultz and Kerry Havas presented the session Commerce Server Mojave : Overview on Monday at the Tom Schultz and Kerry Havas presenting Commerce Server Mojave talk at the LA PDC 2008.Microsoft PDC in LA.  The video of this session is available now - Watch Commerce Server Mojave : Overview.  Kerry covered the new API and Tom stitched together a site in about 5 minutes with the new Mojave SharePoint web parts.  Unfortunately, the session started late (the film crew failed to show on time) so they did not get the chance to cover the new Mojave Operational Sequences architecture.

I had the opportunity to talk to Tom and Kerry after the session too.  I had some robust feedback on the new API and they were kind enough to listen to my ravings.  We had a pretty good conversation, with good points made on all sides.  One of the things I took away from this (and from the PDC in general) is the difficulty of addressing the needs and wants of all different types of development groups and individuals (see also Entity Framework!).

I will be posting more on my thoughts about the new API soon.  What do you think about it?

  Posted: 05:02:54 Wed 29 Oct 2008  Tags: Commerce Server 2007 | Commerce Server Mojave | Ecommerce | PDC
   Permalink Comments [0]

Commerce Server Mojave October CTP Available on Connect

commerce server 2007 image of a man smiling at a computer Kamoji has just posted that the October CTP of Commerce Server "Mojave", the next significant revision of Commerce Server is now available to download (via Microsoft Connect) by the general development public.  Previously, you could only get the Mojave bits if you were participating in the Commerce Server Mojave Technology Adoption Program (TAP)However, at the time of writing, the October CTP download link appears to be broken (for me)Update 23/10:  The October CTP download link is working fine.  It takes you to an EULA with a follow up download email.  The announcement was made on the public Microsoft Commerce Server Product Unit e-commerce Blog, so I am assuming it is genuine and public.

Final Mojave CTP in November so get your feedback in now!  The CTP post also outlines the remaining CTP timeline.  There will be one more CTP in the "November 2008 time frame".  Therefore, it is important to get feedback to the product team now.  The phases outlined here would suggest that after the final CTP the product will go straight to Release Candidate (i.e. missing out Beta).  Therefore, I would assume that the November CTP will be pretty baked.  Not much time.  Get on it! (and if you can be bothered feel free to post your thoughts in the comments below).

Mojave October CTP bits just-in-time for the PDC?  The MS e-commerce blog also posted (3 hours later) that the Commerce Server Product Team will be attending the Microsoft PDC in LA next week.  Not only that, but they will be doing a session on Mojave.  This session is a late edition to the PDC (and is still not in the sessions list).  The session abstract is as follows:

In this session you will get an in depth look into the new Commerce Server “Mojave” product release.  Learn how you can use Commerce Server’s next-gen e-commerce API to develop performant, multi-channel e-commerce websites.  See improvements to the programming model, improved functionality for working with the desktop and devices, and integration of Commerce Server with SharePoint for search scenarios, content management, and social networking.  We’ll also show how to use the “Mojave” e-commerce web parts to quickly build rich, custom user experiences.

Do you work with Commerce Server?  Are you going to the LA PDC next week?  Do you like to drink one or two beers and talk about software development?  If you answered yes to any of these, drop me a line and we can meet up!

  Posted: 04:08:17 Tue 21 Oct 2008  Tags: Commerce Server 2007 | Commerce Server Mojave | Ecommerce
   Permalink Comments [0]

Easy Commerce Server Pipeline Component Debugging with IIS7s appcmd.exe

If you have worked on a large Commerce Server implementation, you have likely built a custom pipeline component or two.  This makes you part of a very special band of brothers (requires Facebook login).  It also means that you have probably seen your fair share of the build error "Unable to copy file ... The process cannot access the file XYZ" (pictured below in all it's namespace censored glory)...

Picture of build error, unable to copy file ... the process cannot access the file XYZ.

This error usually occurs when you build pipeline component project, having just run a pipeline that contains the same physical component (or another component in the same assembly).  The reason it occurs is that the process hosting your website (in my case w3wp.exe) has an open file handle to the assembly containing your pipeline component.  Hence you can't copy over it :(

In the past I have resolved this using one of the following methods:

However, all of these involve what I call micro-tedium.  Micro-tedious tasks are those computing tasks that are so small that they appear insignificant, but in reality suck the life out of you (like the Large Hadron Collider is also probably doing right now).

Anyway, I digress.

My Slightly Funky but Practical Solution to "The Process Cannot Access the File" Tedium

IIS7 ships with a new tool called Appcmd.exe.  It is a command line tool that lets you do useful stuff like create and configure sites, view information about worker processes and start and stop application pools!

So, for pain free pipeline component development, use appcmd.exe in the pre and post-build events of your pipeline component project, to stop and start the application pool that hosts your Commerce Server site.  My build event commands look like this (you will need to replace DefaultAppPool with the name of the Application Pool your Commerce Server site is running in):

Picture of pre-build command line: %systemroot%\system32\inetsrv\appcmd.exe stop apppool DefaultAppPool

Picture of post build command line: %systemroot%\system32\inetsrv\appcmd.exe stop apppool DefaultAppPool

Configuring your build event commands like this results in the following occurring in order when you build your pipeline component project:

  • Before the build, the application pool is stopped.
  • Your project builds.
  • After the build the application pool is started again.

It works for me.  Does it work for you?  Any elegant(er) solutions out there?

Important Note about Exit 0The exit 0 command is included so that the return code is always success, even if appcmd has a non-success return code.  I do this because Appcmd will fail to stop the application pool, if the application pool is not already running.  This would then cause your build to fail.  The exit 0 command stops that happening.  If you have other commands in your build event, exit 0 could mask their failure.

Stuck on IIS 6?  If you are stuck on IIS 6 you may want to hack up something similar using one of the IIS 6 Command Line Tools (I think it is possible!).

Appendix:  Paste-able Version of the Appcmd Commands Used
%systemroot%\system32\inetsrv\appcmd.exe stop apppool DefaultAppPool
exit 0

%systemroot%\system32\inetsrv\appcmd.exe start apppool DefaultAppPool
exit 0

  Posted: 07:16:11 Mon 15 Sep 2008  Tags: Commerce Server 2007 | Commerce Server Mojave | Micro-Tedium | IIS 7 | Pipeline Components | Visual Studio
   Permalink Comments [0]