Hardcoded check on Product.aspx -- ouch


Recently I found out about a very nasty issue inside the commerce framework.
We noticed that on our product detail page, the multi language switch didn't work and showed errors about pages not being found.
The url path looked strange so I took a look with Reflector and had to dig deep to find out about this nasty bugger:

Inside the ProductUrlRewriteModule there was this method UrlRewriteProvider_ConvertingToExternal that contained the following check:

 if (e.Url.Path.EndsWith(this._productViewTemplateName, StringComparison.OrdinalIgnoreCase))

I noticed that the original demo site passed this check, but our code didn't.
And then I saw what lay behind the productViewTemplateName property:

private void GetProductViewTemplateName()
    this._productViewTemplateName = "Product.aspx";
A conditional check on a hardcoded string of your product display template?!
A template that you can change without any warning...
I don't see why there is a site setting that allows you to state the product page dynamically,
while the template that is bound to this page is completely ignored?
Please fix this in a next release.
Jan 24, 2011 23:26


This has been noted and will be fixed for the next release.


Jan 26, 2011 23:24
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.