Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Не изменяется файлы с расширением twig


meln1337
 Share

Recommended Posts

Здраствуйте! У меня есть сайт на opencart 3.0.2, я хотел сгделать два хегдера (один для главной страницы, другой для всех осильных), и у меня возникла проблема - файлы не изменяются(Сайт на шаблоне Journal 3) допустим у меня есть файлы    /catalog/view/theme/journal3/template/journal3/headers/desktop/classic.twig,      /catalog/view/theme/journal3/template/common/header.twig   и     /catalog/controller/common/header.php. И допустим я хочу сгделать проверку на главный файл, я всивляю код в header.twig {%  if home %} <style>...</style>{% endif %} Изменяю стили, но в файле в меня всё меняется, а на сервере нет, что гделать? Переменная home есть в header.php

 

Код

 

/catalog/view/theme/journal3/template/journal3/headers/desktop/classic.twig

<div class="header header-classic header-lg">
<div class="top-bar navbar-nav">
{{ j3.settings.get('desktop_top_menu') }}
{% if j3.settings.get('langPosition') == 'top' %}
<div class="language-currency top-menu">
<div class="desktop-language-wrapper">
{{ language }}
</div>
<div class="desktop-currency-wrapper">
{{ currency }}
</div>
</div>
{% endif %}
<div class="third-menu">{{ j3.settings.get('desktop_top_menu_3') }}</div>
{% if j3.settings.get('secondaryMenuPosition') == 'top' %}
<div class="top-menu secondary-menu">{{ j3.settings.get('desktop_top_menu_2') }}</div>
{% endif %}
</div>
<div class="mid-bar2">
<div class="desktop-logo-wrapper">
<div id="logo">
{% if j3.settings.get('logo_src') %}
<a href="{{ home }}">
<img src="{{ j3.settings.get('logo_src') }}" {% if j3.settings.get('logo2x_src') %}srcset="{{ j3.settings.get('logo_src') }} 1x, {{ j3.settings.get('logo2x_src') }} 2x"{% endif %} width="{{ j3.settings.get('logo_width') }}" height="{{ j3.settings.get('logo_height') }}" alt="{{ name }}" title="{{ name }}"/>
</a>
{% else %}
<h1><a href="{{ home }}">{{ name }}</a></h1>
{% endif %}
</div>
</div>
{% if j3.settings.get('headerMainMenu2Position') == 'top' %}
{{ j3.settings.get('desktop_main_menu_2') }}
{% endif %}
<div class="desktop-search-wrapper full-search default-search-wrapper">
{{ search }}
</div>
{% if j3.settings.get('langPosition') == 'search' %}
<div class="language-currency top-menu">
<div class="desktop-language-wrapper">
{{ language }}
</div>
<div class="desktop-currency-wrapper">
{{ currency }}
</div>
</div>
{% endif %}
<div class="classic-cart-wrapper">
{% if j3.settings.get('secondaryMenuPosition') == 'cart' %}
<div class="top-menu secondary-menu">{{ j3.settings.get('desktop_top_menu_2') }}</div>
{% endif %}
{% if j3.settings.get('cartPosition') == 'top' %}
<div class="desktop-cart-wrapper default-cart-wrapper">
{{ cart }}
</div>
{% endif %}
</div>
</div>
<div class="desktop-main-menu-wrapper2 menu-{{ j3.settings.get('headerMenuLayout') }} {% if j3.settings.get('desktop_main_menu_2') %}has-menu-2{% endif %} navbar-nav">
{{ j3.document.hasClass('mobile-header-active') ? '' : j3.settings.get('desktop_main_menu') }}
{% if j3.settings.get('headerMainMenu2Position') == 'menu' %}
{{ j3.settings.get('desktop_main_menu_2') }}
{% endif %}
{% if j3.settings.get('cartPosition') == 'menu' %}
<div class="desktop-cart-wrapper default-cart-wrapper">
{{ cart }}
</div>
{% endif %}
</div>
</div>
 
/catalog/view/theme/journal3/template/common/header.php
 
{% if j3 is not defined %}
<style>
body {
display: none !important;
}
</style>
<script>
window.location = 'index.php?route=journal3/startup/error';
</script>
{% endif %}
<!DOCTYPE html>
<html dir="{{ direction }}" lang="{{ lang }}" class="{{ j3.document.getClasses() | join(' ') }}" data-jv="{{ j3 is defined ? constant('JOURNAL3_VERSION') : '' }}" data-ov="{{ constant('VERSION') }}">
<head typeof="og:website">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-RU-Compatible" content="IE=edge">
<title>{{ title }}</title>
<base href="{{ base }}" />
{% if description %}
<meta name="description" content="{{ description }}" />
{% endif %}
{% if keywords %}
<meta name="keywords" content="{{ keywords }}" />
{% endif %}
{% if not j3.document.isPopup() %}
{% for key, tag in j3.loadController('journal3/seo/meta_tags') %}
<meta {{ tag.type }}="{{ key }}" content="{{ tag.content }}"/>
{% endfor %}
{% endif %}
<script>window['Journal'] = {{ j3.document.getJs() | json_encode }};</script>
{% if not j3.document.isPopup() %}
<script>{{ j3.loadController('journal3/mql') }}</script>
{% endif %}
{% if j3.document.hasFonts() %}
{% if j3.settings.get('performanceAsyncFontsStatus') %}
<script>WebFontConfig = { google: { families: {{ j3.document.getFonts(true) }} } };</script>
{% else %}
<link href="https://fonts.googleapis.com/css?family={{ j3.document.getFonts(false) }}" type="text/css" rel="stylesheet"/>
{% endif %}
{% endif %}
{% for style in j3.document.getStyles(styles) %}
{% if style.content %}
<style>{{ style.content }}</style>
{% else %}
<link href="{{ j3.document.staticUrl(style.href, false) }}" type="text/css" rel="{{ style.rel }}" media="all" />
{% endif %}
{% endfor %}
{% for link in links %}
<link href="{{ link.href }}" rel="{{ link.rel }}" />
{% endfor %}
{% for analytic in analytics %}
{{ analytic }}
{% endfor %}
<style>
{{ j3.document.getCss() }}
</style>
{% if j3.settings.get('customCSS') %}
<style>{{ j3.settings.get('customCSS') }}</style>
{% endif %}
{% for script in j3.document.getScripts('header', scripts) %}
<script src="{{ j3.document.staticUrl(script, false) }}" {% if j3.settings.get('performanceJSDefer') %} defer {% endif %}></script>
{% endfor %}
{% if j3.settings.get('customCodeHeader') %}
{{ j3.settings.get('customCodeHeader') }}
{% endif %}
{# {% if isHome %}
<style>
body {
background: none;
}
</style>
{% endif %} #}
</head>
<body class="{{ class }}" {% if j3.document.isMobile() %}ontouchstart{% endif %}>
 
{% if j3.settings.get('oldBrowserStatus') %}
<div class="old-browser">
<div class="ob-content">
<h2 class="ob-title">{{ j3.settings.get('oldBrowserTitle') }}</h2>
<span class="ob-text">{{ j3.settings.get('oldBrowserText') }}</span>
<div class="ob-links">
<a href="https://www.google.com/chrome/" target="_blank" rel="nofollow">
<img src="{{ j3.settings.get('oldBrowserChrome') }}" alt="Chrome" />
<span class="ob-name">Chrome</span>
</a>
<a href="https://www.mozilla.org/firefox/new/" target="_blank" rel="nofollow">
<img src="{{ j3.settings.get('oldBrowserFirefox') }}" alt="Firefox" />
<span class="ob-name">Firefox</span>
</a>
<a href="https://www.microsoft.com/en-us/windows/microsoft-edge" target="_blank" rel="nofollow">
<img src="{{ j3.settings.get('oldBrowserEdge') }}" alt="edge" />
<span class="ob-name">Microsoft Edge</span>
</a>
<a href="https://www.opera.com/" target="_blank" rel="nofollow">
<img src="{{ j3.settings.get('oldBrowserOpera') }}" alt="opera" />
<span class="ob-name">Opera</span>
</a>
<a href="https://www.apple.com/lae/safari/" target="_blank" rel="nofollow">
<img src="{{ j3.settings.get('oldBrowserSafari') }}" alt="safari" />
<span class="ob-name">Safari on Mac</span>
</a>
</div>
</div>
</div>
{% endif %}
 
{% if not j3.document.isPopup() %}
<div class="mobile-container mobile-main-menu-container">
<div class="mobile-wrapper-header">
<span>{{ j3.settings.get('headerMobileMenuTitle') }}</span>
{% if j3.settings.get('mobileLangPosition') == 'menu' %}
<div class="language-currency top-menu">
<div class="mobile-currency-wrapper">
{{ j3.document.hasClass('mobile-header-active') ? currency : '' }}
</div>
<div class="mobile-language-wrapper">
{{ j3.document.hasClass('mobile-header-active') ? language : '' }}
</div>
</div>
{% endif %}
<a class="x"></a>
</div>
<div class="mobile-main-menu-wrapper">
{{ j3.document.isPhone() or (j3.document.isTablet() and j3.settings.get('mobileHeaderOn') == 'tablet') ? j3.settings.get('mobile_main_menu') : '' }}
</div>
</div>
 
<div class="mobile-container mobile-filter-container">
<div class="mobile-wrapper-header"></div>
<div class="mobile-filter-wrapper"></div>
</div>
 
<div class="mobile-container mobile-cart-content-container">
<div class="mobile-wrapper-header">
<span>{{ j3.settings.get('headerMobileCartTitle') }}</span>
<a class="x"></a>
</div>
<div class="mobile-cart-content-wrapper cart-content"></div>
</div>
{% endif %}
 
{{ j3.loadController('journal3/layout', 'popup') }}
 
<div class="site-wrapper">
 
{{ j3.loadController('journal3/layout', 'header_notice') }}
 
{% if not j3.document.isPopup() %}
<header class="header-{{ j3.settings.get('headerType') }}">
{% if not j3.document.hasClass('mobile-header-active') and j3.settings.get('headerType') %}
{% include 'journal3/template/journal3/headers/desktop/' ~ j3.settings.get('headerType') ~ '.twig' %}
{% endif %}
{% if j3.settings.get('mobileHeaderType') %}
{% include 'journal3/template/journal3/headers/mobile/header_mobile_' ~ j3.settings.get('mobileHeaderType') ~ '.twig' %}
{% endif %}
</header>
{% endif %}
 
/catalog/controller/common/header.php
 
<?php
// *  @source   See SOURCE.txt for source and other copyright.
// *  @license  GNU General Public License version 3; see LICENSE.txt
 
class ControllerCommonHeader extends Controller {
  public function index() {
    // Analytics
    $this->load->model('setting/extension');
 
    $data['analytics'] = array();
 
    $analytics = $this->model_setting_extension->getExtensions('analytics');
 
    foreach ($analytics as $analytic) {
      if ($this->config->get('analytics_' . $analytic['code'] . '_status')) {
        $data['analytics'][] = $this->load->controller('extension/analytics/' . $analytic['code'], $this->config->get('analytics_' . $analytic['code'] . '_status'));
      }
    }
 
    if ($this->request->server['HTTPS']) {
      $server = $this->config->get('config_ssl');
    } else {
      $server = $this->config->get('config_url');
    }
 
    if (is_file(DIR_IMAGE . $this->config->get('config_icon'))) {
      $this->document->addLink($server . 'image/' . $this->config->get('config_icon'), 'icon');
    }
 
    $data['title'] = $this->document->getTitle();
 
    $data['base'] = $server;
    $data['description'] = $this->document->getDescription();
    $data['keywords'] = $this->document->getKeywords();
    $data['links'] = $this->document->getLinks();
    $data['robots'] = $this->document->getRobots();
    $data['styles'] = $this->document->getStyles();
    $data['scripts'] = $this->document->getScripts('header');
    $data['lang'] = $this->language->get('code');
    $data['direction'] = $this->language->get('direction');
 
    $data['name'] = $this->config->get('config_name');
 
    if (is_file(DIR_IMAGE . $this->config->get('config_logo'))) {
      $data['logo'] = $server . 'image/' . $this->config->get('config_logo');
    } else {
      $data['logo'] = '';
    }
 
    $this->load->language('common/header');
    
    
    $host = isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1')) ? HTTPS_SERVER : HTTP_SERVER;
    if ($this->request->server['REQUEST_URI'] == '/') {
      $data['og_url'] = $this->url->link('common/home');
    } else {
      $data['og_url'] = $host . substr($this->request->server['REQUEST_URI'], 1, (strlen($this->request->server['REQUEST_URI'])-1));
    }
    
    $data['og_image'] = $this->document->getOgImage();
    
 
    // Wishlist
    if ($this->customer->isLogged()) {
      $this->load->model('account/wishlist');
 
      $data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), $this->model_account_wishlist->getTotalWishlist());
    } else {
      $data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
    }
 
    $data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', true), $this->customer->getFirstName(), $this->url->link('account/logout', '', true));
    
    $data['home'] = $this->url->link('common/home');
    $data['wishlist'] = $this->url->link('account/wishlist', '', true);
    $data['logged'] = $this->customer->isLogged();
    $data['account'] = $this->url->link('account/account', '', true);
    $data['register'] = $this->url->link('account/register', '', true);
    $data['login'] = $this->url->link('account/login', '', true);
    $data['order'] = $this->url->link('account/order', '', true);
    $data['transaction'] = $this->url->link('account/transaction', '', true);
    $data['download'] = $this->url->link('account/download', '', true);
    $data['logout'] = $this->url->link('account/logout', '', true);
    $data['shopping_cart'] = $this->url->link('checkout/cart');
    $data['checkout'] = $this->url->link('checkout/checkout', '', true);
    $data['contact'] = $this->url->link('information/contact');
    $data['telephone'] = $this->config->get('config_telephone');
    
    $data['language'] = $this->url->link('common/home');
    $data['currency'] = $this->load->controller('common/currency');
    $data['currency'] = $this->load->controller('common/currency');
    if ($this->config->get('configblog_blog_menu')) {
      $data['blog_menu'] = $this->load->controller('blog/menu');
    } else {
      $data['blog_menu'] = '';
    }
    $data['search'] = $this->load->controller('common/search');
    $data['cart'] = $this->load->controller('common/cart');
    $data['menu'] = $this->load->controller('common/menu');
 
    return $this->load->view('common/header', $data);
  }
}
 
{{ j3.loadController('journal3/layout', 'fullscreen_slider') }}
Edited by meln1337
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.