K
K
kamisarlapsha2018-09-19 19:03:37
opencart
kamisarlapsha, 2018-09-19 19:03:37

How to make a separate header for category pages?

Hello. Opencart version 2.3. It is necessary to swap the blocks in the header on the category pages. Did it like this:

if ($_SERVER['REQUEST_URI']=="/shiny" || $_SERVER['REQUEST_URI']=="/index.php?route=product/category") {

But if you apply sorting, then it already stops working, because the url changes. Becomes: /shiny?sort=p.price&order=DESC. How can this be fixed? Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoozag, 2018-09-20
@kamisarlapsha

Do a similar check in your header controller:

$data['is_category'] = false;
if (isset($this->request->get['route']) && $this->request->get['route'] == 'product/category') {
  $data['is_category'] = true;
}

Then the $is_category variable will be available to you in the header

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question