Answer the question
In order to leave comments, you need to log in
How to define category, subcategory and product page in Opencart?
There is a task for 3 types of pages (category, subcategory, product) to generate title and description and h1 according to 3 templates, respectively. I decided to check in the head and display the appropriate template for the corresponding page type, but I don’t know how to determine which page is which (NC, i.e. category - mysite.ru/cat-1, subcategory - mysite.ru/cat-1/podcat -1, product page - mysite.ru/cat-1/prod-1 (yes, that's right)). Prompt solution
Answer the question
In order to leave comments, you need to log in
Despite the fact that you have CNC enabled, in the request class Opencart stores __path__ in the form 54_57, where 54 is the id of the parent category, 57 is the child category.
Do you have CNC from seo-pro?
Look at the seo-pro class, you will see how it works with path.
The second way is to check if the current category has a parent_id. If there is, then the category is a child, if not, then the category is the parent.
And the product page has its own separate template.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question