This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello everyone I'm relatively new to October, and some parts are really intuitive which is great. Today I am really stuck with a task that I cannot seem to progress with.
I have a third party payment being processed and it returns to me with a url that contains some queries, e.g. http://www.mysite.com/response-page?orderid=789&status=1&anothervar=567
I would simply like to get the parameters and use them in my page. I've tried using some of the helper functions like
$value = get('orderid')
And the examples on this page: https://octobercms.com/docs/services/request-input
But I simply cannot access these parameters. Does anybody have any advice for me?
thanks Nikki
Hi Crazymodder Thanks for your reply. Unfortunately I have tried that too and no luck! I've tried fvarious:
$value = Request::get('orderid');
$value = Input::get('orderid');
It seems simple, and I know how to achieve it in plain PHP with $_GET. I wonder if I've totally got the wrong approach. Is there any other way to achieve getting this data from the url?
This might be helpful -> http://octobercms.com/forum/post/getting-params-from-url
@nikki15963,
Does input('orderid')
work?
If not can you please post some code of your controller?
Last updated
Hi This is the code I've got... it's on a page that receives a direct HTTP request from Barclaycard after a successful transaction.
The first part of this code successfully writes JSON of the request as key:value pairs into the Event log in the backend.
The next part looks for a parameter called 'COMPLUS' and this is where I just cannot fathom why it's not writing to my Orders table on execution.
use Feegleweb\Octoshop\Models\Order;
use Feegleweb\Octoshop\Models\Product;
use Feegleweb\Octoshop\Classes\Currency;
use System\Models\EventLog;
function onStart() {
// ---------------------------------------
// save IN to events
$eventLog = new EventLog();
$data = array();
$data["name"] = "Payment Response";
$data["post"] = post();
$eventLog->message = json_encode($data);
$eventLog->save();
// ---------------------------------------
$token = post("COMPLUS");
$order = Order::where("barclays_token",$token)->orderBy("id","desc")->first();
if ($order != null) {
// create date payTO for order
$payTo = date("Y-m-d H:i:s",strtotime("now +1 years"));
if ($order->is_paid==0) {
$order->barclays_txn_id = post("PAYID");
$order->is_paid = 1;
$order->barclays_date_of_payment = date("Y-m-d H:i:s",strtotime("now"));
$order->barclays_paid_to = $payTo;
$order->save();
}
}
}
Any advice would be so appreciated!
1-6 of 6