Help needed with a Kentico 8 C# custom checkout.

Chris Paynter asked on September 22, 2014 10:28

Hi guys,

Firstly, this post might take slightly more effort than say your average question to answer, so I'd like to say thankyou very much in advance.

I am having trouble with some code I inherited on a new project regarding ecommerce in kentico 8

To set you up: the following product you will see costs $3000 AUD and has a 10% tax class set on it (GST).

I'm having multiple problems and I'm struggling to work out if it's the CMS or the code I inherited. I've also found it difficult to find some real world checkout process code examples for Kentico.

1 - Invoice issues: After successful payment, the invoice I am emailed (SEE HERE), and the invoice I see in the order section of the CMS (SEE HERE) are completely different. Notably, the lack of totals and subtotals on the emailed version. I also need the one I see in the CMS emailed. It is set as the global invoice but no matter what I do the default invoice continues to be emailed.

2 - Tax issues: The code used to generate the order IS HERE - pastebin has cut off in the browser, but press the red button that says raw to see the full snippet. I seem to have trouble with the tax of the order items sticking after payment. If you (SEE HERE), the item is missing the 10% tax on the line, but it is included in the total which is very confusing.

3 - Regenerating the invoice loses all taxes: If I regenerate the invoice in the order section, then all the taxes are lost, but the total price is still correctly totaled using the 10% tax. SEE HERE

I'm reaching deadline, and I don't know if I'm fighting the CMS or the code that got given to me.

Is anybody able to shed some light on these issues and also possibly link me to a proper checkout code example?

Many thanks

Chris

Recent Answers


Jerreck McWilliams answered on September 22, 2014 17:26

1. I had this same issue just the other day. The problem was that the invoice I was creating in CMS Desk (still using version 7) is NOT the invoice that is sent to the customer.

The actual invoice that is sent when an order is placed can be found in CMS Site Manager > Administration > Email Templates (not sure where they would be in v8).

There are 6 different templates, one for when an order is placed, one for when the status is changed, one for when payment is received, and each of these have a twin for the admin.

Kentico is VERY misleading about this. I'm not even sure what the invoice you edit in the ecommerce tab is even used for (if it's not sent to the customer and doesn't appear in the checkout process, where is it used and why?).

2 & 3 - It looks like you're basically recreating Kentico's OrderInfo and OrderInfoProvider classes, and I can't see anything custom in the method you've created that the default classes aren't already doing. Have you tried instantiating an OrderInfo object, populating it with the data you need, then passing the isntance as an argument to OrderInfoProvider.SetOrderInfo() ?

1 votesVote for this answer Mark as a Correct answer

Bill Tran answered on September 25, 2014 18:43

Kentico will calculate taxes in its products totals. You'll need to setup a custom provider to modify it's behaviours, or when displaying the totals, factor that tax is included and deduct the taxes from the total before displaying it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.