Answer the question
In order to leave comments, you need to log in
Opencart2 change the style of displaying a list of products in a category?
Interested in how to change the style of displaying a list of products in a category in Opencart2 depending on the selected category? Can this be done with layout and layout selection in category design? Perhaps there are some other ways to do this? I would appreciate any information on this topic.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
In general, the display of products in a list or grid is determined by the presence of additional classes for the div element with the class "product-layout", when clicking on the icons of the display type, the additional classes change prntscr.com/bcartm
If you need to set a specific display style for any branch of categories, I would catch the path value (full or partial occurrence of a substring), if everything is inconsistent, then you can make a flag in the admin panel and an additional field in the category table in the database, but if there is any import / export, then it also needs to be adjusted, therefore I think that it is advisable not to touch the standard structure of tables in the database, unless there is no other choice.
In general, essentially: you need to add a certain class at the stage of rendering the page, depending on any conditions.
And in the layout, route is specified as the path, where the layout goes for one type of page, i.e. for some specific categories it cannot be set, or I don’t know something :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question