My intended application is to provide a list of products in a simple Joomla list/table display with check boxes where the end user can click on one or more items, press the print button and the data behind those items is collected and passed to another Joomla component to manage the printing of the labels for those products selected.

There is planned to be multiple components(Component X) wanting to print various labels so I want to keep the printing side of things separate in its own component(Component P) and not embedded in each component, making it plug-able so I can replace it later on if a better solution becomes available.

In Component X I have the controller processing the selected items, calling the model to get extra information for those products and creating a data-set that is in JSON format, but will consider other options. After this processing occurs I plan to trigger a Plugin and pass the JSON file to the plugin.

The plugin will do a few checks and then call Component P, the print manager component, that will essentially display a Form with a couple of buttons and the data from Component X in a field or object, at least in some form that I can access it. There will be other controllers and helpers behind this form to find printers and layout templates etc. to do the actual printing.

And this is where I need help, I can't think of a way or find any suitable examples of how to get the data from Component X that is in my Plugin across to a view or model in Component P. Can anyone suggest some possible approaches I might be able to research?

I have considered putting the data to a SQL table to pass between the components but then it creates further issues with multiple requests happening at the same time, cleaning up afterwards and the fields used are not always going to be the same. Therefore I am reluctant to use a table if it can be avoided.

Thank you.

1 Answer 1


I think you probably want to use the session - see https://docs.joomla.org/How_to_use_user_state_variables.

Store the data in a session variable, then do a redirect to your component P, and then P retrieves them from the session data.

Don't forget to clear the relevant session data after you've finished with it.

  • Thank you for replying. I have had a read of the documentation a few times and it looks like it should work. I am assuming it can store an object or an array in the in a user state variable.
    – Irata
    Apr 14, 2020 at 23:07
  • Yes it's used, for example, to store the jform array of data entered into a form. So that if there's a server validation error and the form is re-presented, then it's pre-populated with what the user entered previously, picked out of the session. See FormController::save in libraries/src/MVC/Controller/FormController.php. Apr 15, 2020 at 7:40

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.