View Single Post
  #4  
Old 12-20-2011, 12:01 PM
Matt Ecwid's Avatar
Matt Ecwid Matt Ecwid is offline
Ecwid Team
 
Join Date: Oct 2011
Posts: 4,947
Default

Quote:
Originally Posted by Susan Living1 View Post
Hi Helpful Souls!

I too would like to re-direct all successful orders through ecwid to a custom thank you page on my site.

I have set it up for paypal to do this already so that's fine.

I would like to be able to redirect orders through credit card (not paypal) to a custom page also.

Please help and thank you!

Hello,

In order to redirect your customers from the order confirmation page to a custom one, you should use a special JavaScript code which will use the Ecwid Javascript API for handling the Ecwid 'OnPageLoad' event. The code looks like this:
Code:
<script>
var confirmationPageURL = "http://google.com";

// Add handler for Ecwid's OnPageLoad event
if (
  typeof(Ecwid) == 'object'
  && typeof(Ecwid.OnPageLoad) == 'object'
) {
  Ecwid.OnPageLoad.add(function(page) {
    // Redirect user if needed
    if (
      typeof(page) == 'object'
      && 'ORDER_CONFIRMATION' == page.type
    ) {
      window.location = confirmationPageURL;
    }
  });
}
</script>
The line 'window.location = confirmationPageURL' will be executed (a visitor will be redirected) right after the confirmation page page is loaded. As you can see, a custom page URL is stored in the variable 'confirmationPageURL' (it is set as 'http://google.com' in the beginning of the code). Please put your 'thank you' page's address in there.

Please notice, that the code above should be inserted after the Ecwid integration code on the page where your store is installed.
__________________
Matt K
Ecwid Team

Ecwid Guide for Beginners

Ecwid Help Center

Ecwid video tutorials

Last edited by Makfruit; 12-29-2011 at 05:44 AM.
The Following User Says Thank You to Matt Ecwid For This Useful Post:
Rick G (08-17-2015)