I'm using a third party API to communicate and get data to my module. The module is to get available flight details according to the search query submitted by the user. At this point I'm getting around 10 results via API.

What is the best approach to keep these search results data until the user loggedin?

If I use registry, it may be null some times when I try to access data in some other file. So saving them in the session is the only possible way? Are there any alternatives?

2 Answers 2


My guess is that using the session would be the simplest approach for you. The registry data will not persist and only accessible for the current request (a single HTTP request). Session data will persist across multiple HTTP requests until the application clears the session or it expires.

To get a reference of the customer session use:

$session = Mage::getSingleton('customer/session');

You can then call Magento's magic methods, setSomeData or getSomeData.

Depending on your requirements session storage might not be optimal but only you can decide if you need greater guarantee of data persistence to justify storing the data in a custom table.


You can create your own table in the database with the fields you need to save the info you are getting from the API plus a field to relate that info to the user with customer_id. See this guide to create your table in your module.

You will also have to create a model for this to save and retrieve the info from the DB.

Another option is to create a cache entry for this with a lifetime and a key relating the entry to the customer_id. See this for some more info. With the session approach you already tried, these are the 3 approaches available to save information.

  • I tried this earlier. But for one user this is fine. When multiple users are using the system, this will be a huge performance issue.
    – Sukeshini
    Nov 9, 2014 at 5:34
  • I made an edit to my answer with another approach. Please advise.
    – mbalparda
    Nov 9, 2014 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.