I google it everywhere but didn't get any help I want to redirect to success page after saving order.I am using Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure'=>true)) in my payment controller. Here is my code.
public function responseAction()
{
$data = $this->getRequest()->getParams();
if ($data['data']){
$quoteObj = Mage::getModel('sales/quote')->load($data['data']);
$quoteObj->assignCustomer(Mage::getSingleton('customer/session')->getCustomer());
$quoteObj->collectTotals()->getPayment()->setMethod('payme');
$quoteObj->collectTotals()->save();
//Feed quote object into sales model
$service = Mage::getModel('sales/service_quote', $quoteObj);
//submit all orders to MAGE
$service->submitAll();
//Setup order object and gather newly entered order
$order = $service->getOrder();
//Now set newly entered order's status to complete so customers can enjoy their goods.
$order->setStatus('complete');
//Finally we save our order after setting it's status to complete.
$order->save();
Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure'=>true));
}
What class is your controller extending? /app/code/community/Phoenix/Moneybookers/controllers/ProcessingController.php and /app/code/core/Mage/Paypal/controllers/StandardController.php seem to be doing something similiar to what you are trying to accomplish; take a look at their source. They both extend Mage_Core_Controller_Front_Action. Try extending the Mage_Core_Controller_Front_Action class in your controller and using
$this->_redirect('checkout/onepage/success', array('_secure'=>true));
instead of
Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure'=>true));
In other words, don't call the _redirect method as a static method, but from within the controller itself.
you can try Mage::getUrl($route, $params);
First, you need to load the session and set some required parameter. Otherwise you'll be redirected to the cart as you can see in Mage_Checkout_OnepageController::successAction()
Try
$session = Mage::getSingleton('checkout/type_onepage')->getCheckout();
$quoteId = $reorder->getQuote()->getId(); // just an example
$orderId = Mage::getModel("sales/order")->getCollection()->getLastItem()->getEntityId()
$incrementId = Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId();
$session->setLastSuccessQuoteId($quoteId);
$session->setLastQuoteId($quoteId);
$session->setLastOrderId($orderId); // Required, otherwise getOrderId() is empty on success.phtml
$session->setLastRealOrderId($incrementId);
// Now the redirect supposed to work
$this->_redirect('checkout/onepage/success', array('_secure'=>true));