How to display order detail at the "Order-Complete" page on e-commerce site.

Nattawut Comlon asked on August 12, 2016 09:50

hi all,

I am trying to find the way to show the order detail after the checkout and the payment is completed.

From the sample e-commerce site on CMS version 8.2, when the payment is done, how can we pass the new order id to the page "/Special-Pages/Order-Completed.aspx" by url param, like this "/Special-Pages/Order-Completed.aspx?orderid=12345".

If I can get the order id, I think I can get the order detail by API in the web part to display on the page. But so far, I am not sure how add the order id to the URL param after the payment form has submitted.

Anyone has any solutions for this one?

Correct Answer

Kristian Bortnik answered on August 12, 2016 15:20

Hello,

Assuming that you have a payment page with the "Payment form" webpart, where the "Thank you page URL" setting is set to "/Special-Pages/Order-Completed.aspx", you could customise the webpart to append a query string with the order ID.

In the ~/CMS/CMSWebParts/Ecommerce/Checkout/Forms/PaymentForm.ascx.cs file, append the order ID in the get of the RedirectAfterPurchase property.

public string RedirectAfterPurchase
{
    get
    {
        return ValidationHelper.GetString(GetValue("RedirectAfterPurchase"), "") + "?orderid=" + orderId;
. . .

Please note that in the webpart that will consume this order ID, remember to do a security check to ensure that the order belongs to the customer (if possible). Furthermore, it is good practice to duplicate webparts before customising them.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Dawid Jachnik answered on August 12, 2016 11:01

Hello,

it depens which payment provider do you use. Almost every provider have parameter like returnurl etc. there you can specify the URL which leads customer to the Thank your page etc.

You need to add parameter to the redirect url in your payment provider.

0 votesVote for this answer Mark as a Correct answer

Nattawut Comlon answered on August 12, 2016 14:52

Hi Dawid,

Unfortunately, the payment provider will be no-redirection. In this case, is there a way to add the URL param?

0 votesVote for this answer Mark as a Correct answer

Nattawut Comlon answered on August 16, 2016 03:29

Kristian, your way works well for me.

thank you heap, Nattawut

0 votesVote for this answer Mark as a Correct answer

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