Jump to content

"Free" orders - how to redirect to order-confirmation.tpl instead of user account on completion


jucedupp

Recommended Posts

We have a use case where clients subscribe to a club, for which they will be debited later.  Our client wants to be able to track these sales via the gananlytics module. 

 

For free orders, the client is redirected to his account page, so the ganalytics module is not firing. 

 

How / where in code can I redirect the user to order confirmation (which has a hook for the ganalytics module) instead of the user's account / orders?

 

Thanks..

 

Jacques

Link to comment
Share on other sites

you need modify or override (better) following controller classes

 

/controllers/front/OrderController.php

 

                // Bypass payment step if total is 0
                if (($id_order = $this->_checkFreeOrder()) && $id_order) {
                    if ($this->context->customer->is_guest) {
                        $order = new Order((int)$id_order);
                        $email = $this->context->customer->email;
                        $this->context->customer->mylogout(); // If guest we clear the cookie for security reason
                        Tools::redirect('index.php?controller=guest-tracking&id_order='.urlencode($order->reference).'&email='.urlencode($email));
                    } else {
                        Tools::redirect('index.php?controller=history');
                    }
                }
Link to comment
Share on other sites

  • 2 years later...
  • 10 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...