This patch adds an extra pane to the checkout complete page.
This pane redirects the user to a page when the checkout is complete.

This is useful when you don't want to use rules to redirect after checkout is complete.
When you use commerce_ogone the ogone redirect page can send to 2 redirects.
One javascript redirect and one button, when both are used the rule is executed before the user gets
to the checkout-complete page and the default completion message is shown.

This way the user is always redirect to the destination page.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, commerce-commerce_checkout-redirect_pane.patch, failed testing.

Jax’s picture

FileSize
831 bytes

The approach above solves the problem that when an order already has been completed and the user goes back to a page in the checkout that was completed he will still be redirected to the correct checkout message (which isn't the case if you used a rule to redirect).

The issue that remains is that if you use the checkout progress block this block won't be visible anymore. The module attached solves this by showing the node contents instead of redirecting to it. There is initial integration with i18n variable so that you can configure a nid per language.

Currently there is no token support but it would be trivial to pass the node's body through token with the order to add support for it.

rszrama’s picture

"The approach above solves the problem that when an order already has been completed and the user goes back to a page in the checkout that was completed he will still be redirected to the correct checkout message."

Hmm, that's actually working as designed. Why would that be a problem?

Jax’s picture

The _complete checkout_ event only triggers once, when the checkout is completed the first time. So if you have a rule to redirect the user to a custom page he will see that page the first time the checkout is completed. But if the user, by for example clicking the back button, finds himself in old checkout pages the checkout process will redirect him to the _default_ checkout completion message and not the one he is supposed to be.

The scenario above happens a lot with third party payment sites that have a button to redirect and redirect automatically at the same time (eg. Ogone if you don't disable that option in the settings which some customers want).

So we first developed a custom pane that redirects the user which solves the issue to always show the correct message. The additional module I developed has the additional benefit to show the message in the checkout progress so that the checkout progress bar stays visible.

So it would be nice to have that option in commerce core.

Hopefully that's more clear.

rszrama’s picture

Status: Needs work » Closed (won't fix)

Revisiting this issue, I'm not sure a form builder function is really the appropriate place to have a redirect. I'm thinking instead this sort of thing should be handled in the checkout router (which is pluggable via hook_commerce_checkout_router()), which is the approach I took for routing custom steps in the PayPal Express Checkout integration of http://drupal.org/project/commerce_paypal. I'm gonna close this out and recommend that alternate approach, but if we wanted to create a UI for it, it would most likely need to be in a custom checkout routing module.

drugan’s picture

Hope it will be useful for you to review this post:
Add "Checkout complete page is viewed" event

drugan’s picture

Issue summary: View changes

update

bsandor’s picture

Issue summary: View changes

I can't see this working:
Am I right that the purpose if this module is redirecting the user after succesful payment?
If so than after adding a nid on admin/commerce/config/checkout/form/pane/desk02_checkout_completion_message i can not see this happening.

Maybe my issue is:
I use 'commerce node checkout' that leaves order in 'pending' state instead of turning it into 'completed' even after delivering a published node.
Is my issue related to this pending vs completed state? https://drupal.org/node/2235965

What I'd like to achieve is:
Redirecting user to a node that I set with a php code. After succesfull payment (pending vs completed???) user goes to a node that i set with a php code (basically to the node that the user publishes when she uses commerce_node_publish module.

Thanks for any help