cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to stay on the onepage Checkout when the 'Place Order' button is pressed?

Is there a way to stay on the onepage Checkout when the 'Place Order' button is pressed?

Hi. I am going to re-phrase a question I asked a few days ago. Is there a way to stay on the onepage Checkout when the 'Place Order' button is pressed? Currently I am calling a controller at this point, and get re-directed to the controller page. Should I be using a controller or another method if I want to perform some tasks but stay in the final onepage Checkout page? Thanks for any pointers in advance as I am new to Magento.

3 REPLIES 3

Re: Is there a way to stay on the onepage Checkout when the 'Place Order' button is pressed?

You need to either Ajax the data to your controller, or forward them back to the checkout procedure from your controller.   

 

Typically, there is a better way to accomplish what you want than changing the flow of checkout.   Can you provide more information on what your custom controller does?

Certified Plus Magento Developer | Top 50 Magento Contributor for 2017 | CEO/Founder at Jamersan | I make Magento videos at Ecommerce-aholic

Re: Is there a way to stay on the onepage Checkout when the 'Place Order' button is pressed?

Hello MasterJonny,

 

We meet again!

I think we shouldn't stay on the checkout One page. I have two suggestions for you:

1. Currently, I use rwd package, you find:

 

#app/design/frontend/rwd/default/template/checkout/onepage/review/info.phtml

 

review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder', array('form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));

 

You can change success redirect URL: <?php echo $this->getUrl('checkout/onepage/success') ?> to your controller.

 

2. This solution is better for us. We use Observer to open our doors. After placing an order successful, Magento triggers an Event (sales_order_place_after), you can catch this event and then inject your code into this workflow.

For example, in your config.xml:

 

<events>
     <sales_order_place_after>
        <observers>
           <custom_module>
              <class>custom_module/observer</class>
              <method>AfterPlaceOrder</method>
           </custom_module>
       </observers>
    </sales_order_place_after>
</events>

 

In your Model Observer:

public function AfterPlaceOrder($observer)
{
$order = $observer->getEvent()->getOrder();
//Do something after placing order successful.
}

 

Hope my suggestion is useful for you.

Problem solved? Click Accept as Solution!

Re: Is there a way to stay on the onepage Checkout when the 'Place Order' button is pressed?

Yes - it displays a payment payment lightbox, so it does some processing such as creating a session ID with the payment gateway and then displays a lightbox for the customer to enter the payment details. It works fine, but I would like the order page to be the background instead of a new Magento page. Is there an easy way to re-direct back to the checkout before I display the lightbox or is there major code changes required? Thanks again.