I am doing a module that has different steps before the checkout and in one of the screens i need to save a value to add in the order.

I don't have any trouble to get the value and sending via ajax to the controller but i am not sure the best way to keep this value and get it after the client refresh the page select the product and goes to the checkout.

Not sure if it is better to use e session, cookie or save in a custom table with some kind of session id ?

  • What kind of data you are trying to store? Dec 8, 2017 at 11:14
  • just a string but i need to retrieve it after the payment and add it to the order pragmatically. so when i get the string I don't even have a quote because the customer didn't choose the product yet. Dec 8, 2017 at 11:18
  • Ok, wrong question. Not type,; what kind of data? I am asking because it will help us understand where to keep these data. It is something on quote? address? products? customer? Dec 8, 2017 at 11:19
  • It is a complicated scenario. But basicaly it have nothing to do with the magento catalog. It is only related with the order. You can think about an extra attribute in the order. But as I said when I know the string I want to save I don't even have a login, quote or order thats why i need to keep it somehow to use it at the success page. Dec 8, 2017 at 11:28

1 Answer 1


General answer will be:

IF you want more secure and long term persistence of data which should accessible anytime also for logging and history purpose IF data belongs to existent entity Store it in relevant entity table probably by extending model and adding column ELSE data do not fit any existent entity Create new model and store data in custom table ELSE Use local storage to keep data and retrieve them while required

Avoid using sessions and cookies. Local storage should be a better solution unless some additional arguments strengthen one of the former approach.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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