Jump to:

2082 Posts in 1002 Topics by 452 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » getting URL parameters

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, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2784 Views
  • wildflower1975
    Avatar
    Community Member
    59 Posts

    getting URL parameters Link to this post

    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

  • wildflower1975
    Avatar
    Community Member
    59 Posts

    Re: getting URL parameters Link to this post

    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"

    2784 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.