Good day. Please tell me, as an observer, add a parameter with the ID of the last order to the end of the url of the success page, that is, instead of
... / checkout / onepage / success /
It was
... / checkout / onepage / success / order_id = 10000000001
observer code in config.xml
.... <events> <controller_front_init_routers> <observers> <dk_images> <!-- <type>singleton</type> --> <class>DK_Images_Controller_Router</class> <method>initControllerRouters</method> </dk_images> </observers> </controller_front_init_routers> </events> </global> controller
<?php class DK_Images_Controller_Router extends Mage_Core_Controller_Varien_Router_Abstract { public function initControllerRouters($observer) { $front = $observer->getEvent()->getFront(); $front->addRouter('checkout/onepage', $this); return $this; } public function match(Zend_Controller_Request_Http $request) { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse() ->setRedirect(Mage::getUrl('install')) ->sendResponse(); exit; } $urlKey = Mage::helper('core/url')->getCurrentUrl();//trim($request->getPathInfo(), '/'); $parts = explode('/', $urlKey); if (count($parts) < 3) { return false; } if ($parts[5] == 'onepage' && $parts[6] == 'success') { $lastOrderId = Mage::getSingleton('checkout/session') ->getLastRealOrderId(); $request->setModuleName('checkout') ->setControllerName('onepage') ->setActionName('success') ->setParam('id', $lastOrderId); $request->setAlias( Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey ); return true; } return false; } } But this code, unfortunately, does not work. I would be very grateful for the help.