Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

getting URL parameters


Go to End


2 Posts   8926 Views

Avatar
wildflower1975

Community Member, 63 Posts

3 January 2013 at 9:06pm

Edited: 03/01/2013 9:31pm

I've got the eWay payment gateway returing to my site on the URL http://silverstripe/ewayctl/success/00073?debug_request=1

I'm trying to get the $ID value of 00073 so I can edit that record on the Database, but it looks like the values are NULL by the time it gets to my controller

Debug (line 155 of RequestHandler.php): Testing '$Action//$ID/$OtherID' with '' on eWay_Controller
Debug (line 163 of RequestHandler.php): Rule '$Action//$ID/$OtherID' matched to action 'handleAction' on eWay_Controller. Latest request params: array ( 'Action' => NULL, 'ID' => NULL, 'OtherID' => NULL, )

I'm trying to do this in the class eWay_Controller extends Controller - (I'm guessing the $this is wrong)

if($id = $this->param('ID')){
			$p =  DataObject::get_one('eWay',"\"ID\" = '$id'");
			$this->payment = $p;
			return $p;
		}

this is on SS 3.0.3

this is my routes.yml

---
Name: paymentroutes
After: framework/routes#coreroutes
---
Director:
  rules:
    'ewayctl/$Action/$ID/$OtherID' : 'eWay_Controller'

Update

I can do it using

Director::urlParam('ID')

in the controller but I get a deprecation notice:

Director::urlParam is deprecated. Use SS_HTTPRequest->param() instead.

I'm not sure what the SS_HTTPRequest object/variable name is from within the Controller to call it properly

thanks

Avatar
wildflower1975

Community Member, 63 Posts

4 January 2013 at 7:34pm

this is what i needed

http://www.silverstripe.org/general-questions/show/18118

just gotta ask Google the right question to find the right answer "Director::urlParam is deprecated"