Php – Magento Save Order function where it is

ajaxmagentoPHP

I'm checking since hours into magento files.
Now I'm in checkout onepage /checkout/onepage/reviews/info.phtml, the order is saved with this call to Ajax,

<script type="text/javascript">
//<![CDATA[
    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'));
//]]>
</script>

I'm new to this syntax, there is no saveOrder file in onepage template folder, I need to hack the saveOrder action to change the redirect from succes page to a payment gateway and come back.
Where this method is? I really don't understand this call to ajax like a new object instance.

Any help will be appreciated.

Best Answer

So checkout/onepage/saveOrder is a route which corresponds to module/controller/action. So that would map to:

INSTALL_PATH/app/code/core/Mage/Checkout/controllers/OnepageController.php

and the method you are looking for would be saveOrder.

That said you SHOULD NOT EVER go hacking core files. You can an observer or a class rewrite to override the functionality.