Tuesday, November 23, 2010

Product being added twice

I had some code to add a product to a basket like so-

Basket b = basketApi.GetDefaultBasket();
        b.AddProduct(productId, 1);

However, it was adding the product twice

result += "Count:" + b.Items.Count.ToString() + "<br />";
        foreach (BasketItem bi in b.Items)
         result += "Item " + bi.Id + ":" + bi.Quantity.ToString() + "<br />"; //product is listed twice

My first thought was that the page was being loaded twice (due to a postback bug or something). This was not the case.

The offending party turned out to be Ektron. Going into the Workarea, the product was showing up twice in the catalog (with different prices, but same title and id). Merely editing the product and saving was enough to collapse the waveform and destroy the evil twin. I'm not sure how this occurred - my money would be on eSync and L10n.

Monday, November 22, 2010

Guest Checkout Failing in Ektron Checkout: Debugging the Checkout process

We’d added some custom logic to the Checkout process (changing order of steps, showing extra information, additional resource strings) but were getting an error with the guest checkout. The order would complete, but user was stuck with the spinning loading image thingy.

 

Repro steps

1. Add item to your basket and go to page with Checkout control.

a. Expected and actual: User is shown initial checkout page, with “Returning customer”, “New customer” and “Guest Checkout” options.

2. Click Guest Checkout – “Checkout without profile”.

a. Expected and actual: “loading” image appears, then user is taken to Billing details page.

3. Fill in details and click “Continue”

a. Expected and actual – “loading” image appears , then User is taken to Payment Details page

4. Fill in payment details - "Visa", "4444333322221111", "999", "12", "2019" - and click process payment

a. Expected: loading image appears, then user is taken to order completed page, completed order is listed in Workarea

b. Actual: loading image appears. User is stuck with loading image. Completed order is listed in Workarea.

Network Responses (from Firebug)

Working

0|EKTRON_PACKET_START|1|0|268|#EktronCheckout_Checkout1

0|.EktronCheckout_WizardMode|1|<div class="EktronCheckout_OrderComplete

0|EktronCheckout_ProcBlock"><h3>Order Complete</h3><p><b>Thank

0|You!</b></p><p><b>Order ID<span

0|class="spacingContainer"></span>10034</b></p><p>Your order has been

0|approved, you will receive a confirmation email shortly.</p></div>

Broken

0|EKTRON_PACKET_START|1|0|0|#EktronCheckout_Checkout1

0|.EktronCheckout_WizardMode|1|

 

The standard control was working, and the problem was narrowed down to the handler for the PreProcessXml event. The offending line is -

if (Checkout1.CurrentPhase == Checkout.ControlPhase.SubmitOrder)

This was being used to conditionally alter the XML depending on the phase. The Checkout1.CurrentPhase code is what is causing the problem.

 

I was also intermittently getting the following build error-

'Checkout' does not contain a definition for 'ControlPhase'

which seems to be due to an ambiguous class reference that the compiler/intellisense is missing. This was fixed by cleaning up the “using” statements.

 

I tried using the full namespace of Ektron.Cms.Controls.Checkout.ControlPhase, however, the Guest Checkout still did not work.

I should be able to get the current phase some other way – possibly via the event args. But for now, I am avoiding the phase checking in the PreProcessXml event handler.

Thursday, November 18, 2010

Ektron License Modifiers

There doesn’t seem to be a list of these around anywhere. Makes it a bit easier than trying to remember if E is Enterprise or eCommerce….

 

XML eWebEditPro+XML (addition of XML editing on content editor?)
PR Professional
EN Enterprise
E eCommerce
Users-n Licensed for n number of users
flash  
exp-YYYY-MM-DD Expiry date of the license
-n at tail of license Major version number licensed for, i.e. –8 is for version > 8, –7 for 7  >= version > 8

 

Reference:

http://www.nimbleuser.com/blogs/Knowledge_Base/knowledge_base/Ektron_Licensing_101.aspx

Tuesday, November 9, 2010

Setting a Homepage

The order of precedence for setting the default page (i.e. where does www.example.com point you to?) is-

  1. URL aliasing
  2. Web config - Key ek_DefaultPage
  3. IIS default document

Notes-
  • You can't use an alias in ek_DefaultPage
  • You can’t use URL parameters with ek_DefaultPage so general Page Layouts are not supported unless you set the default content.
  • You can't setup the homepage via Manual Aliasing - it requires text to be entered into the alias field (though it may only be JS validation… but that’s another story)
  • You CAN use regex aliasing- set Expression to "^$" (minus the quotes, this matches an empty string)
  • Ektron grabs the request before IIS has a chance to resolve it, so the IIS default document setting is useless.

Sunday, November 7, 2010

Setting Locale via URL – good or bad?

One of the lessons of web development is “use GET to retrieve, POST to modify”. Using GET to delete data can lead to being attacked by vicious black-hat hackers web crawlers. There are some solid explanations on StackOverflow, summarized as “Use POST to modify data. Use GET to receive data.”

However, what isn’t really covered, is changing state on the client side. Ektron sets the client locale via URL. Once the new locale is set, nothing is changed on the server – no bits written to disk, no memory changed. The client’s cookie, however, is updated with the new locale and the web server serves up different content now and the user’s experience completely changes, especially if the new locale is not supported.

For example, Ektron’s new site in mono-lingual, restricted to en-US (id=1033). However, if you browse to http://www.ektron.com/?LangType=3081 (en-AU = 3081), you will see an error, as the Ektron site does not have any Australian content.

This is sort of expected – I’ve asked for an Australian homepage and there is none. (Ideally, your en-AU locale would degrade to a generic en locale, then optionally degrade to a specified default language. Ektron supports neither of these). Where the problem arises is in the relationship between locale and URL/aliasing in Ektron. Now, with your locale set to en-AU, most of the site will be broken. One of the goals (and strengths) of URLs is universality, that links are perpectual. If I tattoo my forehead with www.example.com/EatAtJoes , it is entirely within my power as to whether that URL lives or dies (notwithstanding domain name hosting fees, DNS poisioning)

So I guess I don’t like the idea of losing control over how my site visitors experience my site. What if one of Ektron’s competitors sent out a newsletter with an obfuscated link like
www.ektron.com/?AdvancesInIntranets=true&LangType=3081&ImportantWhitepaper=AmazingInsights .
“Oh 404, no worries, I’ll find the article from the homepage. Wait, the homepage doesn’t work either?”

 

What are your thoughts on setting locale via GET URL? Personally, I think Ektron should-

  • Require confirmation to change locale
  • Locale change should be via POST at very least
  • Provide better aliasing support for multilingual sites, such as-
    • allowing for a locale specifier in the URL, e.g. en.example.com or www.example.com/en
    • Show foreign language content for valid URLs in a different language, e.g. if your locale is en-US, www.example.com/Bonjour.aspx should show same or translated content as www.example.com/Hello.aspx .
  • Provide better multilingual support in general, such as-
    • allow proper language degradation
    • allow generic language content

 

What you can do to stop this-

  • Especially if you’re using a single language, set the locale back to the default on every request.
  • Customise the 404 error page to change the locale back to the default (if it isn’t already) and resubmit the request (watch out for cyclic requests).

 

Antidote: If you’ve clicked on any of the links above and wish to get your Ektron site experience back to normal, just browse to http://www.ektron.com/?LangType=1033

 

Repro steps-

  1. Browse to http://www.ektron.com/News-And-Events/ and confirm that it works.
  2. Browse to http://www.ektron.com/?LangType=3081 , which gives a 404, but sets your locale to en-AU
  3. Once again, browse to http://www.ektron.com/News-And-Events/ which now gives you a 404
  4. The majority of the Ektron site is now broken, until either clear your site cookie or browse to http://www.ektron.com/?LangType=1033

Monday, November 1, 2010

Twitter wars over Amplicate and Kentico Trolling

The #Ektron tag has been a bit fiery of late.

 

Firstly, this exchange between @robbins and

trobbins: Get started with #Kentico #CMS webinar - http://bit.ly/cBJG3R (expand)#marketing #web #ektron #sitecore

ektrondave: Hey @trobbins, Do you really get leads from calling out superior competitors in your Tweets? Just wondering. #kentico #Lame

trobbins: @ektrondave We get lots of leads from direct conversations. Lame products are an easy target. #Ektron #Fail

trobbins: @ektrondave if you believe your products better - how about a CMS bakeoff to see? #Kentico #Ektron Better than sniping

trobbins: @ektrondave We can if you want. I would be willing to pay for a hotel I know your budget is probably tight #Kentico #Ektron

twentworth12: @trobbins Since you tag #ektron so often, I figured you might want some of these http://bit.ly/9aAlLF (expand) ;) cc @ektrondave @DaBigCheeze

ektrondave: @trobbins Can we hold that bakeoff at your US HQ in Nashua, NH?

Just a bit of a friendly marketing war. Seems that Ektron are a bit thin-skinned here – I guess there are some interesting marketing dynamics at play.

 

Secondly, some two and fro about Amplicate

DaBigCheeze: I think I just stood up for Ektron - http://bit.ly/9ITpf0 (expand) - Search for my post. "DaBigCheeze" or "E-Cubed" #Ektron #CMS

serversideinc: @DaBigCheeze You should stand up for Ektron and against people who create bogus twitter accounts just to bash Ektron on Amplicate. #ektron

DaBigCheeze: @serversideinc I don't doubt there are frauds but there is enough bad blood already to justify the overall sentiment. I have talked to many.

serversideinc: @DaBigCheeze You should stand up for Ektron and against people who create bogus twitter accounts just to bash Ektron on Amplicate.#ektron

serversideinc: @DaBigCheeze Case in point? http://bit.ly/b5TO7B (expand)#ektron #kentico

Some more thin-skins. Instead of “fraud”, how about considering that Ektron has a steep learning curve?

 

What annoys me about these exchanges is that they are fiddling like Nero. Meanwhile, the Ektron forums are overflowing with unanswered questions and the developer community is stagnating. But I guess marketing is more important.

Adding Elmah to Ektron

Elmah is a great tool to log unhandled exceptions. It’s main advantage is that it is lightweight – you can easily add it to an existing site (and if you’re using NuGet, it’s even easier). Setup is as per the instructions from the Dot Net Slackers article, however there are a few Ektron specific things to watch out for-

  • System.websServer –> handlers -  Make sure you put the Elmah entry above the wildcard *.axd entries. If you get a 404, try putting this entry just after the <clear /> at the top of the handlers.
  • Securing the log – At this stage I’m just setting allowRemoteAccess to zero (false). I tried changing the path to workarea/elmah.axd to try and limit access to being logged in, but the authorization is happening within Ektron, not at the web server level.

 

Next things to look at are locking it down to allow secure remote viewing and using the database to store the log. I also want to investigate the inbuilt EkDiagnostics and see if Elmah can compliment it.