Tuesday, December 7, 2010

Commerce Server Inventory System Part 1

Inventory management is a vital part of any retail business, whether it’s a traditional brick-and-mortar shop or an online Web site. Inventory management provides you with critical information about the condition of your products, such as whether you are low on stock and your inventory needs to be replenished. Inventory management also provides your customers with accurate information, letting them know when items are out-of-stock, back-ordered, or pre-orderable. Failure to provide your customers with this information puts you at risk of losing future business. Inventory management also gives you insight into which products are selling well and which products are not. This information allows you to make better business decisions on how to market your products, and whether or not to even carry them.

Previous versions of Commerce Server to 2007 did not have an out-of-the-box inventory system. Instead, developers were either required to customize and extend the catalog schema, as well as write custom processes to track inventory levels, or develop their own processes for integrating into a line-of-business (LOB) inventory system.

Commerce Server has made significant advances with regards to inventory management, and has an out-of-the-box Inventory System capable of providing the following functionality:

* Real-time inventory management for product catalogs

* Full integration into the Catalog System and Orders System

* Integration into LOB systems through the Commerce Server BizTalk adapters

Keeping track of inventory is vitally important for any successful retail enterprise. Inventory systems let you know when it is time to stock up on items that are running low and can also prevent you from over selling products and then having to inform customers that their items are either unavailable or must be backordered. Inventory systems can provide insight into which products are selling well and which products are selling poorly. With this information you can make intelligent decisions on how to maximize your sales and make your Web site more effective.

In previous versions of Commerce Server it was a challenge to incorporate real-time inventory management into your Web site. Keeping the inventory levels synchronized to the product catalog required a great deal of effort and custom software development. Many custom solutions require the product catalog schema to be extended so that it can accommodate inventory information and modifications to the basket pipeline to check the inventory levels of the product added to the basket. This in and of itself is a challenge; more complex tasks, such as configuring items as back-orderable or pre-orderable, are levels of magnitude more complex to develop.

Fortunately, the Inventory System available in Commerce Server is specifically designed to integrate with the Catalog System, and provides an excellent solution for all the stake holders of your Web site, including customers, business users, Web site administrators, and software developers. Customers benefit from a much richer integration into the product catalog, allowing them to know if items are in stock, pre-orderable, or back-orderable. Customers can also filter products by those in stock, allowing them to ignore items that are currently unavailable (assuming you have developed this capability through the Inventory APIs). Business users benefit by having a far more robust and reliable method of coupling the inventory and product catalogs, as well as gaining insight into inventory levels and trends. Web site administrators benefit by easy import and export functionality, as well as synchronization to external LOB applications. Software developers benefit from all of the above, as well as a rich API layer that has methods for searching, browsing, and viewing the details of the inventory catalog, as well as sophisticated search options.

It is important to fully understand the role that the Inventory System plays within Commerce Server, and how it works together with product catalog to allow you to manage your inventory.

The Relationship between the Inventory and Catalog Systems

Before diving into the features of the Inventory System, you should take the time to understand the relationship between the Inventory and Catalog Systems. The Inventory System consists of inventory catalogs, much as the Catalog System consists of product catalogs. These inventory catalogs contain information about products and product variants that are stored in the product catalogs. As such, inventory catalogs can store inventory information for one or more product catalogs. Moreover, these product catalogs can be both base and virtual catalogs. Consider the following examples in Figure 4-1.



Figure 4-1

Scenario A describes a straightforward relationship between an inventory catalog and a product catalog. In this scenario, an inventory catalog has been defined and one product catalog added to it. When a product catalog is added to an inventory catalog it is considered to be mapped to the inventory catalog. Scenario B is similar to Scenario A, except that two product catalogs are mapped to the inventory catalog. Consequently, the inventory catalog contains inventory information for product and product variants stored in both catalogs.

As previously mentioned, virtual catalogs can also be mapped to inventory catalogs. Consider scenario C, in which the virtual catalog is the aggregation of two base catalogs. In this scenario, the virtual catalog is mapped to the inventory catalog. Consequently, the two base catalogs do not contain any inventory information. Instead, the inventory information is specific to the virtual catalog. Mapping virtual catalogs to an inventory catalog is a very powerful way to manage the inventory for aggregated base catalogs with specific pricing rules. For example, you could create a virtual catalog that gave preferred customers 15% off of various products and map it to an inventory catalog that limits the total quantity of these discounted products to 50.

The final scenario shows a more advanced set of relationships. In scenario D there are two base catalogs and one virtual catalog. The virtual catalog aggregates the products and product variants in both of the base catalogs and may apply special pricing. The virtual catalog and one of the base catalogs are mapped to the inventory catalog, while the second base catalog is not mapped to the inventory catalog. As a result, the mapped base catalog has the ability to track its own inventory, while the non-mapped base catalog cannot. The virtual catalog is able to track its own inventory on the products and product variants aggregated from both of the base catalogs. These four scenarios demonstrate the flexibility of the Inventory System, and how it can be used for a number of different and unique situations.

Based on my book on Commerce Server. Part 2 is here.

Monday, November 8, 2010

Commerce Server Template Pack for SharePoint 2010

At our User Group meeting last week, I installed the Template Pack live on a SharePoint 2010 installation. Several asked to have the procedure I used, so here goes.

The main point with the template pack is that it works with CS2009, you do not have to wait for R2.

1. First you will need a functioning SharePoint 2010 installation. This has quite a high Hardware Spec, with 64 bit and 8 GB. I did my Hyper V installation with 4 GB, but I am not recommending this. If you are using virtual images you will need a separate machine as a domain controller. Yes, I know you there are other options, hacking SharePoint (for local accounts) or hacking Commerce Server (so that you can install on a domain controller) but the whole point is to have a supported installation.

2. Second you will need to go through the usual fun process: Install Commerce Server 2007, Configure, Install Commerce Server 2009, Configure. Make sure you have everything you need (eg. Business Tools) otherwise you will have to uninstall CS2009, to get these. I usually unpup rather than use a CS project, so I have no VS2005/2008/2010 problems here. You of course will need the 64 bit version of the cab file:
CSRedistW2k3EN64.cab
If you are installing on W2008 R2 as I was you will get an error that Net 3.5 SP1 is not installed, even if it is automatically installed as part of W2008 R2. Installing will of course give the error that it is already installed. The only way out of this infinite loop is hotfix KB 975567, the hotfix was filed under Vista, but worked fine.

3. Now is a good time to switch User Account Control off. I have my reservations about this step, but it is in black and white in the Template Pack installation instructions. I leave it to you if you do it with the UI or Group Policy, I preferred the registry entry setting key HKLM\Software\Microsoft\Windows\ CurrentVersion\Policies\System\
EnableLUA to 0
Then install the Template Pack.

4. Next you should create your web app and extend it. You can use the SharePoint Commerce Services Wizard for this, I preferred to do this with SharePoint central admin. Add your host headers to DNS.

5. Now create your Commerce Server site. I unpacked the DefaultSiteWithData and made sure I named the site ContemporarySite. The reasons for doing this step manually are because of the next step. Make sure that all accounts have the rights in SQL they need.

6. If you run the SharePoint Commerce Services Wizard now (with Windows 2008 R2), the Wizard will fail with an error creating the Profile encryption key. I suspect this is because Windows 2008 R2 restricts Registry entries, perhaps things will be better after W2008R2 Sp1.
So with thanks to Ravi Kanth's blog, you will have to run
ProfileKeyManager.exe /kn /O (Note: Ravi has a typo here, it should not be a zero.)
ProfileKeyManager /ke /kf "NewKeyPair_2010_9_15_20_46_14_35.xml" /reg "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Commerce Server 2007 Keys\ContemporarySite"
(you will have to adjust the key file name to match the autogenerated name from the first command.)

7. Now you can run the SharePoint Commerce Services Wizard and select the web app you have created and the Commerce Server site you created. Press View Site and ....

8. You should have the Contemporary Site coming up, obviously the Channel needs to be set.
Careful, you cannot run the Wizard twice, without getting an DLL open error. The product team says that you can fix this by retracting and removing the solution before running again, makes sense to me. But some claim the only way to fix this is to run reflector and skip one line.
According to the product team there is another known issue on CS default zone with SP2010 if an IIS Hotfix (KB979917) is installed (which is recommended by SP2010). The workaround is to change the AllowAnonymousImpersonation value from default value “true” to “false”
Don't forget, there is a new extensibility kit that comes with the template pack, you will need to use this one if you are changing web parts.

9. If you open the Forms authenticated site in your browser you will get the unusually helpful message in your error log:
Object Cache: The super reader account utilized by the cache does not have sufficient permissions to SharePoint databases.
To configure the account use the following command 'stsadm -o setproperty -propertyname portalsuperreaderaccount -propertyvalue account -url webappurl'. It should be configured to be an account that has Read access to the SharePoint databases.
Additional Data:
Current default super reader account: NT AUTHORITY\LOCAL SERVICE

This is because this claims authentication does not resolve this account. To fix, use the stsadm command as they suggest to set the portalsuperreaderaccount to an appropriate domain account

Caveat: Obviously you should read and follow the entire Template pack installation instructions, especially if doing a production installation. There are more hotfixes needed for production, but this quick guide should get you going with a working installation. As with any technical procedure, there are bound to be mistakes in my write up, please let me know, so I can correct them.

Monday, August 30, 2010

The Microsoft Certified Master program

I just added the MCM logo to my blog. Why? Just another certification from Microsoft? Last time I looked on my transcript, I had the following, MCT, MCSD, MCDST, MCAD, MCDBA, MCSA, 2 MCITPs, 19 MCTSs, 5 MCPDs and 3 MCSEs. Each of those certifications took a lot of work and study and I consider each a good proof of competence in a technical area. Why am so excited about 3 more unpronounceable letters? ( so much so that when the email came late at night on Friday, our whole family was dancing around our home).

The key lies with the difficulty of the Master certification. The Master certification in effect certifies that one is an expert in a particular area, in my case SharePoint 2007. When I came to the three weeks of intensive course in Redmond in March 2009, I considered myself very competent in SharePoint, I had worked with SharePoint from the early beginnings of Digital Dashboard, all though the incarnations 2001, 2003 and 2007. I had gained a lot of experience, coaching a consultancy to become a SharePoint consultancy, retraining their consultants and developers to become SharePoint consultants and developers and fielding all the more difficult problems that came up. However, coming to Redmond I was a Commerce Server expert, not a SharePoint expert and to obtain the Masters certification I had to become an SharePoint expert. The 3 written exams are difficult enough, but it is the lab exam that is the real monster. 8 and a half hours of real world tasks that would usually take 8 and a half days in the real world. Because of the time difference between Europe and the US, by the end of my retake it was after midnight and I was so exhausted I would have had difficulty spelling SharePoint let alone doing any tasks. It took me more than a year after the Redmond training to reach the level of expertise required. Some of the recipes on this blog are the product of that preparation. Does that mean that I now think I know everything about SharePoint? No, it means that I have to continue learning constantly just to keep up. Being a master requires clearly identifying what you do not know and constantly filling in the gaps.

What advice do I have to others considering the same path? Firstly, I would advise you to be sure you are an expert before you get to Redmond. You will get much more out of the class. The experience is unique, you are sitting with a class with vast experience and the program tries to get the instructors who have the best knowledge in the world. Not all of them are natural teachers, so you also have to be able to draw the information out of them. It is also much easier if you can concentrate just on one product, my life is made a lot more difficult in effect trying to be a master of both SharePoint and Commerce Server, (even though there is no master program for Commerce Server).

Now that I have joined an small group of MCMs, (I calculate that I am the 18th outside Microsoft to obtain this qualification for SharePoint), do I think that we know SharePoint better than anyone else? No, I am very conscious that there are doubtless many good SharePoint experts who will not get this opportunity. (Having my own company meant that it was easier to convince my boss.) What about MVP's? I realize that MVP is an award given in recognition of services to the community, it does not in itself certify that one is an expert in that area. That said, we had 2 MVPs in our class and they were among the best in the class. The Master certification however, certifies that one is an expert right across SharePoint not just one particular area. Thus it is especially the case that although there is a focus on the architecture of large farms, since this is where you especially need a Master, a Master also has to know the development side well also. While there can always be gaps in a Masters knowledge, the breadth and depth of the exams sure tries to make sure that those gaps are small.

What is the Return On Investment from the Masters program? The jury is still out on that one. It would help us if Microsoft would require (or strongly recommend) having an MCM on board for large installations. It would help if a Gold Partnership received an advantage in competencies for having a Master involved. Unfortunately, they have recently gone the other way, and the Partner program no longer counts an MCM as counting as two MCPs.

What is my next step? I need to first make sure that my understanding of Commerce Server and SharePoint 2010 is at the same level as my understanding of SharePoint 2007. And that is a challenge enough for today.

Here are some of my classmates blogging about their experience:
http://www.houberg.net/archive/2009/04/06/master-training_are-you-ready.aspx
http://www.sharepointchick.com/archive/2009/04/08/the-microsoft-certified-master-experience.aspx
http://harbar.net/archive/2009/04/28/certified-master-for-sharepoint-2007-ldquor2rdquo.aspx
http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=301
http://www.sharepointbits.com/blog/2009/10/31/freshly-minted-microsoft-certified-sharepoint-master.html
http://blogs.msdn.com/b/ramg/archive/2009/05/16/my-mcm-experience.aspx

Friday, August 27, 2010

Creating a generic Data Form web part with SharePoint Designer 2010


If you create a List Form web part and save it to a file or gallery you get a prompt whether you want the web part saved with a relative path (list name is stored in the web part) or fixed to thesite (list id is saved in the web part)


If you create a Data Form web part and save it to a file or gallery you do not get this prompt.
Insert > Data View > Empty Data View
Select a Data Source, then insert fields as Single Item Form.
Save Web Part to a gallery.

To make the web part generic and referencing a file name you need to do the following changes.

In the property ParameterBindings replace:
ParameterBinding Name="ListID" Location="None" DefaultValue="{01CF5B35-CB1E-4A5A-82D1-144C6A0312E2}"
with
ParameterBinding Name="ListName" Location="None" DefaultValue="Shared Documents"

Also replace
property name="ListName" type="string">{01CF5B35-CB1E-4A5A-82D1-144C6A0312E2}
with
property name="ListName" type="string">Shared Documents

remove this line
01cf5b35-cb1e-4a5a-82d1-144c6a0312e2

And replace each occurence of
ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{01CF5B35-CB1E-4A5A-82D1-144C6A0312E2}" Name="ListID"
with
ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Shared Documents" Name="ListName"

Make sure that the ListId and the List Guid do not appear any where else in the webpart.

Now you have a generic Data Form web part!

With thanks to Sandeep and the folks at Trinedy.


Thursday, June 10, 2010

Commerce Server Training in Canada

Just got back from Ottawa, after giving my Commerce Server Training there. Thanks to Itplanit, it was an excellent training center, everything worked well. Did not get a chance to get across and visit those I know at Cactus, will have to do that next time.

Tuesday, June 8, 2010

Using SSL in Windows 2008

Our old friend SelfSSl does not work in IIS 7.0. But it is easy enough to set up a certificate and use SSL. Here is the brief version:
Server Name > Server Certifications > Create Self-Signed Cert
Go to site > Right click > Edit Bindings > Add one for https with unused port
Select the cert you created.
Restart web site then click on the correct browser link for the port on the right
You will get a warning that the cert is unsafe, but you can continue to the site.

Here is a longer version if you get stuck:
http://learn.iis.net/page.aspx/144/how-to-setup-ssl-on-iis-70/

Tuesday, June 1, 2010

Recycling Application Pools in Windows 2008

C:\Windows\System32\inetsrv>appcmd stop apppool sharepointapppool
C:\Windows\System32\inetsrv>appcmd start apppool sharepointapppool
Here is the a command file that does the above.

Friday, May 14, 2010

2nd Commerce Server User Group Meeting - Commerce Server Staging

Great user group meeting. Especially enjoyed the practical tone of the questions.

Here are the links I mentioned in my talk:
Using SQL instead of Access
http://blogs.msdn.com/charles/archive/2008/09/15/how-to-configure-css-to-log-to-sql-database.aspx

We will have the next meeting on November 5, subject will be CS and SharePoint 2010.

Monday, May 3, 2010

Sychronizing SharePoint Profiles with Active Directory

There are a lot of urban myths about importing profiles from AD, particularly on some blogs where it is claimed that deleted users are only erased from SharePoint on the third try.

Here are the steps when a user is deleted from Active Directory:

1. When the profiles are synchronized with Active Directory, the bDeleted flag is set to true in the SSP's UserProfile_Full table.

2. Every hour the MySiteCleanup job runs.
If bDeleted is true the job deletes the profile from UserProfile_Full table and adds it to the deleted users.
The manager gets a email and ownership of the MySite.

3. Every five minutes each Content DataBase sychronizes its UserInfo table with the SSP. This is the Quick Profile Synchronization (WSSSweepSynch).

4. Every hour there is a complete synchronization Profile Sychronization (WSSProfileSych).
This is bidirectional, in the up direction the Profiles are updated with the site collection membership list. In the down direction, the UserInfo table is updated with the Profile information. If a user flagged as deleted in the UserProfile_Full table, he is also marked as such in the UserInfo table. It is not be deleted in the UserInfo table, as it is needed for Auditing.

The procedure is the same in SharePoint 2010.

(With thanks to Chris Gideon, I based this on discussions with him at MCM training and Ignite. All mistakes are my misunderstandings, not his)

Recipe:RSS Viewer in MOSS 2007


1. To add a feed for a list or document library.
Go to list, actions, rss feed. Save address.
Go to page, add web part, copy address into url.

2. To set refresh for rss feed.
Site collection rss settings.
Settings for web part.
But...refresh is hard coded at 60 minutes!

Kerberos Authentication, needed even if sql on same box.

Kerberos debugging tips:
NETDIAG /TEST:KERBEROS /DEBUG >KERBTEST.TXT

Add the following registry value:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters

Registry Value: LogLevel
Value Type: REG_DWORD
Value Data: 0x1

But you will get some false errors.

Kerbtray gives the tickets for the current logged in user only. See great blog.

When cross forest trust, make sure that forest and domains are 2003 level, otherwise will only have external trusts which will not use kerberos. Make sure the web site is trusted site to see RSS feed.

Sunday, May 2, 2010

Recipe: Using Kerberos with MOSS 2007 and Windows 2003

1. SPN for SQL
Install ADSIEdit on DC from W2003 Support Tools.
Change SPN of SQL Service Account to:
MSSQLSvc/sql1.litware.com:1433
MSDN also says add not just FQDN but NetBIOS name also:
MSSQLSvc/sql1:1433
Don't understand why this is necessary.
If the SQL is on the same machine as MOSS Kerberos will not be used. Ditto named pipes are used. See blog.
You can also check your work by using the SetSPN -L SQLService
From the the W2003 Resource kit you can use Klist and Kerbtray
To list or purge the Tickets use Klist tickets or Klist purge.

2. SPN for Central Admin
Add SPNs to Central Admin App Pool Identity.
HTTP/moss01:12345
HTTP/moss01.litware:12345
Change Central Admin to negotiate
Use this link to get to stsadm
stsadm -o authentication -url http://moss01:12345 -type windows -usewindowsintegrated
Browse to site.

If you get following error
Logon Failure:
Reason: Unknown user name or bad password
User Name:
Domain:
Logon Type: 3
Logon Process: Kerberos
Authentication Package: Kerberos
Workstation Name: -
Caller User Name: -
Caller Domain: -

This is because the browser does not send the port number with the spn.
For 32 bit I used the following registry change to ie6. Details are here, but the hotfix dlls were an older version than my dlls. Still needed the registry change.

If you need to check if the iis virtual directory has kerberos enabled you can say
adsutil.vbs get w3svc/1998432558/root/NTAuthenticationProviders or set it with
adsutil.vbs set w3svc/1998432558/root/NTAuthenticationProviders "Negotiate,NTLM"
(get Vir Dir Id from log file directory name)

3. SPN for main sharepoint site
Add SPNs to App Pool Identity.
HTTP/moss01
HTTP/moss01.litware.com
Change SharePoint app to negotiate
Use this link to get to stsadm
stsadm -o authentication -url http://moss01 -type windows -usewindowsintegrated
Browse to site.

Wednesday, April 28, 2010

Recipe: IIS Compression with IIS 6.0

CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "htm" "html" "txt" "css" "js"
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "txt" "css" "js"
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "exe" "axd" "aspx"
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "exe" "axd" "aspx"
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcDynamicCompressionLevel "9"
CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel "9"

blobcache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxsize="10" age="86400" enabled="false">

Wednesday, April 21, 2010

Commerce Server - Cannot connect to named instance

Have seen this several times during install or CSConfig, have found that the best solution is to give the exact port number of the SQL instance and to make sure that you are communicating over TCP.

Sunday, April 18, 2010

Bug in Catalog System - Error Cannot delete default Language

Haven't seen this documented anywhere.
If the default Catalog language is not en-US, it will not let you delete en-US, you get the error "cannot delete default language.
Heard the solution from one of the delegates in my Commerce Server Experts Training, you need to change the language of the Catalog Manager temporarily away from en-US.

With thanks to Ralf Höppner.

Wednesday, April 14, 2010

Publicly accessible CS2009 site on SharePoint!

Just came across this site built on SharePoint and Commerce Server 2009. Would be interested to hear of any other public sites on the same architecture.

Monday, April 12, 2010

Virtualpc has no networks when booted in hyper-v

Seems to be a HAL problem. Use MSconfig.exe to change boot options, advanced to detect HAL.

Thursday, April 8, 2010

CS: Direct Mailer

Reminder:
Add the Marketing Web Service account(not just the DM Service Account) to the DML_SG Group
Add CommerceDirectMailerAuthenticationModule to the HttpModule section of the web.config

Wednesday, April 7, 2010

Recipe: SharePoint Excel Services

From MSDN:

By default, cross-domain workbook and data connection access is not allowed. To allow workbooks in trusted file locations

stsadm.exe -o Set-EcsSecurity -Ssp -AllowCrossDomainAccess true|false

The requesting Web pages and the workbooks or data connections must reside in the same farm.

Tuesday, April 6, 2010

Recipe: Setting up Interfarm SSP

1. Parent farm
Find out Sql name and configdb name.
Give read rights to config db to whom?
msdn says child farm administrator account
Provide ssp to child farms
Give child farm user rights to parent ssp
blog says child farm CA app pool

2. Child farm
Set up to consume web services
msdn says parent farm admin must be granted Full Read to each child Web application using Web App policy
Assign WApps to parent ssp

Thursday, April 1, 2010

Schema changes CS 2007 SP2 and CS2009

Have been upgrading some systems from CS2007 SP1 to SP2 and then on to CS2009. The question came up if there are any schema changes between these versions. I took a backup of the product catalog before and after these changes and used Red Gate SQL Toolbelt to compare the databases. There were changes to contraints and stored procedures but no schema changes.

Friday, January 1, 2010

I survived the First User Group Meeting

The technology worked well. We used Live Meeting. It was a new experience for me to talk to the webcam instead of a room full of people. The interchange was interesting, it was interesting to hear about the present projects and hear why some are waiting for R2. Hope to put on a second meeting soon.