Task: replace the category.tpl template with your (modified) one. Opencart 2.1, so that in the future you can follow the link to watch the modified template index.php?route=product/category
If you leave the category.tpl file name, then the new template is visible. If you change the name of the template to any other name - an error: a blank screen .
Change in file: catalog / controller / product / category.php

 if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category1.tpl')) { $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/category1.tpl', $data)); } else { $this->response->setOutput($this->load->view('default/template/product/category1.tpl', $data)); } 

It was made on this manual .

What could be the problem?

  • one
    There is no blank screen. Either turn on the display of errors, or see errors in the OpenCart log. - Andrew Hobbit
  • $ this-> data ['my_custom_text'] - In oc2.x $ data ['my_custom_text'] - Kirill Korushkin

2 answers 2

In oc1.5.x:

 $this->data['my_custom_text']; $this->children = array( 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header' ); $this->response->setOutput($this->render()); 

In oc2.x:

 $data['my_custom_text']; $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); 

$ this-> render () is not used in Response :: setOutput (), the template output when the controller is called:

 $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/product/category.tpl', $data)); 

    There is no OC prototype now, so in words

    Most likely the problem is not this. In the core of the opencard, there is a modificate folder - like so called. There are copies of controllers that are associated with modules and other add-ons.

    OC creates xml maps when adding modules (not for all) and based on them creates copies with modified code and places them in the folder from which it pulls.

    Solving the problem: go to the admin panel. In modules \ add-ons and update (in the upper right corner button). After entering the settings, reset the system cache

    This should help.

    and go to the system and find this folder (google the exact path) and see if there is a copy of the controller you are editing.