Page 1 of 1

[1.4.0] [FIX] Route actions from POST in addition to GET

Posted: Tue Mar 02, 2010 9:26 pm
by ipse
Sometimes you may want to send action using POST instead of GET. This patch allows you to do so.

Especially, this is required to make 2checkout module working because of their GET/POST policy and other implementation details, I mentioned in this post: http://forum.opencart.com/posting.php?m ... 22&t=11535.

Here is an excerpt from their API guide:
2Checkout.com will also POST the information to your return URL in all cases, regardless of whether Direct Return is enabled or disabled. It is important to note that we will not allow a mix of GET and POST in the return process. If you are trying to return the customer to “http://www.yoursite.com/your_script.php?param=value” then we actually return the customer to “http://www.yoursite.com/your_script.php” and the ‘param=value’ will be returned as POST information with the rest of the sales information that we normally pass back.

Code: Select all

diff -r 01b836fa2a9d index.php
--- a/index.php	Tue Mar 02 15:27:10 2010 +0300
+++ b/index.php	Tue Mar 02 15:27:24 2010 +0300
@@ -183,6 +183,8 @@ Registry::set('cart', new Cart());
 // Router
 if (isset($request->get['route'])) {
 	$action = new Action($request->get['route']);
+} else if (isset($request->post['route'])) {
+	$action = new Action($request->post['route']);
 } else {
 	$action = new Action('common/home');
 }


Re: [1.4.0] [FIX] Route actions from POST in addition to GET

Posted: Thu Dec 08, 2011 6:28 am
by dizarter
+200

This should be part of the core!