Typo3 Extbase Set and Get values from Session

Ganybhat-kalpatech picture Ganybhat-kalpatech · Jul 3, 2013 · Viewed 13.6k times · Source

I am writing an extbase extension on typo3 v6.1 That extension suppose to do a bus ticket booking. Here what my plan is, user will select date and number of seats and submit the form.

Here my plan to push the date and rate of the selected seat to session (Basket). And while making payment, I wanted to get that values from session and after payment I need to clear that particular session.

So In short, How to Push and retrieve the values to and from the session in extbase. Any suggestions ? Thank you.

Answer

freshp picture freshp · Jul 4, 2013

There are different ways. The simplest would be for writing in the session

$GLOBALS['TSFE']->fe_user->setKey("ses","key",$value)

and for reading values from the session

$GLOBALS["TSFE"]->fe_user->getKey("ses","key")