Developer forum

Forum » Development » Redirect not called in CheckoutHandler

Redirect not called in CheckoutHandler

Anders Ebdrup
Reply

Hello!

 

I have a problem with the method: "Redirect" which is not called in the CheckoutHandler when the user clicks "back" in his browser. That means that the "order" is not converted back into a cart again and because of that the basket is empty.

 

Anyone know how to solve this problem?

 

Best regards, Anders


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Anders,

 

When you say "user clicks 'back'", where does this happen? The problem is, that if it happens at the gateway, you may not have the option of passing the needed parameter. CartV2 looks for a specific parameter in the request, and calls CheckoutHandler.Redirect(Order) if it finds it. Whether you can handle the 'back' click depends on your options to add the parameter to the request. Normally, the gateway tries to encourage using the 'Cancel' button as the action for this is normally something you can override.

 

The reason for this is that CartV2 removes the order from the users context when redirecting to the gateway. At this point CartV2 awaits callbacks and redirects from the gateway. In order for CartV2 to know about the order, the gateway has to pass the OrderID as the value for a specific parameter in the request (the parameter mentioned above). If this value is missing--as it most likely will be in this scenario--CartV2 has no idea about the order or the CheckoutHandler associated with it. Therefore, it tries to render an empty cart.

 

You could probably work around this by adding the OrderID to a session parameter and creating a notification subscriber for Cart.BeforeRenderingEmptyCart. Then read the OrderID from the session and downgrade the order and set it as the context cart, then redirect back to CartV2.

 

- Jeppe

 
Anders Ebdrup
Reply

Hi Jeppe,

 

Thanks for reply! The session parameter is also my workaround, but as it is a generel problem then I think that it should be solved directly into Dw.

 

I hope you agree?

 

Best regards, Anders

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

I definitely see the issue. The challenge is, how do we change a fundamental part of how CartV2 works with regard to CheckoutHandlers without changing CartV2 completely?

 

I'm sure it can be done, but it's something we have to discuss internally.

 

- Jeppe

 
Anders Ebdrup
Reply

Great! I'll be looking forward to a generic solution of the problem :-)

 

It will be nice to have an estimated time for the problem to be solved?

 

Best regards, Anders

 
Anders Ebdrup
Reply

Great! I'll be looking forward to a generic solution of the problem :-)

 

It will be nice to have an estimated time for the problem to be solved?

 

Best regards, Anders

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

I'll get back to you when I have more information, but I think the earliest feasible release time would be with 8.3 in August. This is not a promise though as I don't make the release plans :)

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

The reason for this is that CartV2 removes the order from the users context when redirecting to the gateway.

I have always perceived this as a somewhat flawed implementation. Cancelling or backing out of the gateway is quite a common scenario, especially with gateways that offer multiple payment methods that you need to select on the eCommerce site and that are forwarded to the gateway. It's not uncommon to overlook, say, the credit card options and accept any default. Then at the gateway you realize you don't have a Master Card but a Visa. You click Back to correct that and poof, your order is gone.

 

It would be nice if there was a consistent solution for cases like this directly in Cart v2.

 

Cheers,

 

Imar

 
Nicolai Høeg Pedersen
Reply

@Imar and @Anders

 

Good points. Will discuss this with the team and see if we need to make some changes to this.

 

Thanks, Nicolai

 
Anders Ebdrup
Reply

Hi Nicolai,

 

Any news regarding this topic?

 

/Anders

 
Nicolai Høeg Pedersen
Reply

No, not yet.

 

Nicolai

 
Asger Munkholm Højfeldt
Reply

Hi guys - we have discussed this internal and have decided to implement Jeppes suggestion in the platform. 

I will try to get it into the 8.3 release, but can't promise anything right now as the release is almost closed for new features. 

BR - Asger - Product Manager

 
Anders Ebdrup
Reply
         Original message by Asger Munkholm Højfeldt posted on 06/06/2013, 14:33:

Hi guys - we have discussed this internal and have decided to implement Jeppes suggestion in the platform. 

I will try to get it into the 8.3 release, but can't promise anything right now as the release is almost closed for new features. 

BR - Asger - Product Manager

Hi Asger,

Will this be fixed in the 8.3 release?

Best regards, Anders

 
Anders Ebdrup
Reply

Hi Asger

 

Is this problem fixed in the latest release?

 

Best regards, Anders

 
Peter Bille Larsen
Reply

Could it be possible with a release date please, several customers complaining. :-) 
I think we need to throw some kind of date for this.

 
Asger Munkholm Højfeldt
Reply
This post has been marked as an answer

Hi - this is planned for 8.3.1 (last Tuesday in October). Item 12282.

//Asger - Product Manager

Votes for this answer: 1
 
Asger Munkholm Højfeldt
Reply

Hi - we have started implementing this solution but have run into problems that do not seem to be solvable within the timeframe available. We need to postpone this for 8.4.

//Asger

 

 
Anders Ebdrup
Reply

Hi Asger,

Is this fixed?? As I can still reproduced the problem.

Best regards, Anders

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Anders, just a question. Did you activate this feature? You need to check the box "Management Center -> Ecommerce -> Advanced configuration -> Shopping Cart -> Keep cart in context after checkout step".

 

- Jeppe

 
Anders Ebdrup
Reply

Hi Jeppe!

No, didn't know the feature - thanks! :-) But it seems that the customer should upgrade to 8.4?

Is there any drawbacks that I should be aware of by activating this box??

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

This is indeed an 8.4 feature.

 

I don't foresee any issues by checking that box, but the internal flow of the cart is a bit different so you may experience something unexpected. I have done extensive testing locally and our QA department has also tested rigoriously and we have not found anything. If your testing shows anything different, please let us know so we can get on it.

Note, we have only tested with our standard checkout handlers and in order to use this in a custom checkout handler, you just need to verify that you call one of the SetOrderComplete overloads on the callback/redirect from the payment gateway and either call RedirectToCart or in some other way redirect the user to the receipt page on the redirect from the payment gateway.

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Also note that this change is global. If you activate this, it's turned on for all CartV2's on the solution.

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

There is currently a bug where discounts and taxes are not available on the order after checkout when using this feature. We are working to resolve this issue. Hopefully, this will be fixed with a hotfix today or early next week.

 

- Jeppe

 

You must be logged in to post in the forum