шаблон для страницы категории OpenCart 2.2.0.0 - PullRequest
0 голосов
/ 27 ноября 2018

Я бы попросил небольшой помощи

Я хотел бы создать еще один шаблон для своих трех категорий (ID категории 119 / ID 125 / ID 140).

I found one solution for version 2.2.0.0.

 find $this->response->setOutput($this->load->view('product/category', $data)); 
        in catalog/controller/product/category.php 

        and replace it with above codes, here is:


        $config_theme = $this->config->get('config_theme') == 'theme_default' ? 'default' : $this->config->get('config_theme'); if (file_exists(DIR_TEMPLATE . $config_theme . '/template/product/category_' . $category_id . '.tpl'))   {
            $view = 'product/category_' . $category_id;
        } else {
            $view = 'product/category';
        }

$ this-> response-> setOutput ($ this-> load-> view ($ view, $ data));

I created category_119 however, it does not work. I tried to complete this code but nothing works  

   perhaps I have to complete code by:

         * entering the name of my new template (category_bezkoszyka or category_119) = but I do not know exactly where to sign

        * enter the category ID (119/125/140) = = but I do not know exactly where to sign


        * probably enter the name of my template - although I have default - (Default (Default Store Theme)

Link to the solution:
<https://stackoverflow.com/questions/40755573/specific-template-for-category-and-product-page-in-opencart-2-2-0-0/53498989#53498989>


Information:
* opencart 2.2.0.0.
* my new temple category = category_bezkoszyka
* Id category to change = 119 / 125 / 140
* I have a standard theme: Default (Default Store Theme)


How to enter correctly, because I try but it fails.

Thank you for your help

Best Regards. Adam.

1 Ответ

0 голосов
/ 27 ноября 2018
        I would like to make a second category template without a basket so:

        I made a copy of the template category - I named it: category_bezkoszyka and removed the basket in it.

        I was looking for a solution to what to do for my other template to work for selected categories (I would like for the ID category 119/125 and 140) and I found only one:

        find $this->response->setOutput($this->load->view('product/category', $data)); 
        in catalog/controller/product/category.php 

        and replace it with above codes, here is full code:

        $config_theme = $this->config->get('config_theme') == 'theme_default' ? 'default' : $this->config->get('config_theme');
        if (file_exists(DIR_TEMPLATE . $config_theme . '/template/product/category_' . $category_id . '.tpl')) {
            $view = 'product/category_' . $category_id;
        } else {
            $view = 'product/category';
        }
        $this->response->setOutput($this->load->view($view, $data));


  I created category_119 however, it does not work. I tried to complete this code but nothing works  

    and now I have to complete it by:

         * entering the name of my new template (category_bezkoszyka or category_119)

        * perhaps enter the category ID (119/125/140)

        * probably the name of my template - although I have default - (Default (Default Store Theme)



I tried but the template category does not change - it still remains a category, not a category_bezkoszyka

        I tried replace category_ for my new category_bezkoszyka , and enter my category ID 

        but I do not know the code and my attempts have failed. For someone who is experienced this is a minute but it is difficult for me.

        thank you very much for your help
...