Hello! The site has the output of goods by the grid (i.e., each product has a width of col-md-4). It is necessary to do so that the user can choose in what form to display, list or grid (col-md-4 or col-md-12). Now I did this, when I click on a button (for example: to display a list) using js, I delete the class col-md-4 and add the class col-md-12. Naturally, everything works, but only if you do not reload the page. How to make it so that when you reload the page settings do not get lost? Where to store the settings?

    1 answer 1

    When you switch a view, you can send ajax to a server where you will report that the view has switched. On the server, write the current view to the cookie, and when reloading the page, check the cookie and draw the view to which the user last switched.

    • Thought about it too. But in opencart there is such a function, and like there such settings are not stored in sessions or in cookies - r.mcreal
    • If the user has an account, you can store the value for which the user is viewing the list in the database. Look to identify through cookies, but store the value in the database. In any case, you need to know that this is the user who switched the view - Grulex