B
B
Bogdan2018-09-24 15:46:57
opencart
Bogdan, 2018-09-24 15:46:57

Routing to a custom page?

Hello, please advise. I created my own custom page,
in the controller and in the view I made the files according to the instructions , but how to make the menu link automatically in the menu

<ul class="main-navigation">
  ...
    <li><a href="{{ guarantee }}">{{ text_guarantee }}</a></li>    
    <li><a href="{{ contact }}">{{ text_contact }}</a></li>
  </ul>

For contact it creates a link, but not for guarantee . If you make a direct transition to the page, through the address bar of the browser, then everything works /index.php?route=information/guarantee
catalog/controller/guarantee.php
<?php
class ControllerInformationGuarantee extends Controller {
  public function index() {
    // Optional. This calls for your language file
    $this->load->language('information/guarantee');
    
    // Optional. Set the title of your web page
    $this->document->setTitle($this->language->get('heading_title'));

    // Breadcrumbs for the page
    $data['breadcrumbs'] = array();

    $data['breadcrumbs'][] = array(
      'text' => $this->language->get('text_home'),
      'href' => $this->url->link('common/home')
    );
    
    $data['breadcrumbs'][] = array(
      'text' => $this->language->get('heading_title'),
      'href' => $this->url->link('information/guarantee')
    );

    // Get "heading_title" from language file
    $data['heading_title'] = $this->language->get('heading_title');
    
    // All the necessary page elements
    $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');
    
    // Load the template file and show output
    $this->response->setOutput($this->load->view('information/guarantee', $data));
  }
}
template/information/guarantee.twig
{{ header }}
<div id="information-information" class="container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
    <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
  <div class="row">{{ column_left }}
    {% if column_left and column_right %}
    {% set class = 'col-sm-6' %}
    {% elseif column_left or column_right %}
    {% set class = 'col-sm-9' %}
    {% else %}
    {% set class = 'col-sm-12' %}
    {% endif %}
    <div id="content" class="{{ class }}">{{ content_top }}
      <h1>{{ heading_title }}</h1>
rwerwrewer	  
      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>
{{ footer }}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2018-09-24
@politon

Transfer the file or change the path, whatever you have.
in
catalog/controller/information/guarantee.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question