Jump to:

23459 Posts in 18906 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Session::set set on one page, missing on the next

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1090 Views
  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Session::set set on one page, missing on the next Link to this post

    Hi all

    OK here's my process

    1. Checkout form on a heavily modified ecommerce module user fills out form, whose action is set to controller processPayment method.

    2. Among other things, this method does this ($data being the submitted form data):

    Session::set('orderForm.'.$cart->ID, $data);


    If I output this right after this call with Session::get('orderForm.'.$cart->ID);, all is fine and as expected.

    3. User is redirected to 3rd party secure credit card processing. On success, they are sent back to another page where the response is handled by the processOrder controller method.

    It is at this point where Session::get('orderForm.'.$cart->ID); returns nothing. Yes I have outputted $cart->ID to check that holds the correct value.

    I have also outputted the entire $_SESSION and the item I set in 2. is not present.

    Any ideas? What is the scope of these Session objects? Has the '.' after orderForm got anything to do with it?

    Ta
    Aaron

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: Session::set set on one page, missing on the next Link to this post

    Stuff it. I used $_SESSION instead. It works.

    Aaron

  • BenWu
    Avatar
    Community Member
    89 Posts

    Re: Session::set set on one page, missing on the next Link to this post

    my colleague got the same problem and have to use _SESSION at the end.

    does it mean there is problem with Session::set method??

    1090 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.