[Решено] Добавить ссылку кнопки из footer в header

Тема в разделе "OpenCart", создана пользователем butikstickerov, 12 янв 2014.

Статус темы:
Закрыта.
  1. butikstickerov

    butikstickerov

    Регистрация:
    9 сен 2013
    Сообщения:
    57
    Симпатии:
    1
    Не могу до конца разобраться как ссылку из нижнего меню подключить в верхнее. Ссылку хочу вытащить из раздела (доставка и оплата) можно посмотреть тут

    Смотрю здесь catalog/view/theme/моя тема/template/common/header :
    Код:
    <div id="menu" class="wrapper-center">
            <ul class="fm">
              <li class="fmLi"><a href="<?php echo $home; ?>" class="fmLihr icoHomeBig <?php if($_SERVER['REQUEST_URI'] == '/' ||  $_SERVER['QUERY_STRING'] == 'route=common/home') echo "active"; ?>" ><i class="icon-home"></i></a></li>
              <?php foreach ($categories as $category) { ?>
              <li class="fmLi"><?php if ($category['active']) { ?>
                    <a href="<?php echo $category['href']; ?>" class="fmLihr active <?php if ($category['children']) { ?> withSub <?php } ?>"><?php echo $category['name']; ?></a>
                    <?php } else { ?>
                    <a href="<?php echo $category['href']; ?>" class="fmLihr <?php if ($category['children']) { ?> withSub <?php } ?>"><?php echo $category['name']; ?></a>
                    <?php } ?>
    
                <?php if ($category['children']) { ?>
                <div>
               
                  <?php for ($i = 0; $i < count($category['children']);) { ?>
                  <ul>
                    <?php $j = $i + 4; ?>
                    <?php for (; $i < $j; $i++) { ?>
                    <?php if (isset($category['children'][$i])) { ?>
                   <li class="fmLiLi"><a href="<?php echo $category['children'][$i]['href']; ?>"><img src="<?php echo $category['children'][$i]['image2']; ?>" alt="<?php echo $category['children'][$i]['name']; ?>" /><span><?php echo $category['children'][$i]['name']; ?></span></a>
                        <?php if ($category['children'][$i]['children2']) { ?>
                 
                          <?php for ($c = 0; $c < count($category['children'][$i]['children2']);) { ?>
                          <ul>
                            <?php $r = $c + ceil(count($category['children'][$i]['children2']) / 1); ?>
                            <?php for (; $c < $r; $c++) { ?>
                            <?php if (isset($category['children'][$i]['children2'][$c])) { ?>
                            --!<li><a href="<?php echo $category['children'][$i]['children2'][$c]['href']; ?>"><i class="icon-angle-right"></i><?php echo $category['children'][$i]['children2'][$c]['name']; ?></a></li>--!
                            <?php } ?>
                            <?php } ?>
                          </ul>
                          <?php } ?>
                        <?php } ?>               
                    </li>
                    <?php } ?>
                   
                    <?php } ?>
                  </ul>
                  <?php } ?>
                </div>
                <?php } ?>
              </li>
              <?php } ?>         
             
       
             
            </ul>
    это код footer.tpl :
    Код:
    <div class="column">
              <h3><?php echo $text_service; ?></h3>
              <ul>
                <?php foreach ($informations as $information) { ?>
                <li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>
                <?php } ?>
                <li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
                <li><a href="<?php echo $sitemap; ?>"><?php echo $text_sitemap; ?></a></li>
              </ul>
     
  2. udaff

    udaff

    Регистрация:
    3 янв 2013
    Сообщения:
    139
    Симпатии:
    28
    Ну так нужна прямая ссылка на статью про эту оплату.
    footer смотреть особо не за чем, тк $information где находится ссылка на доставку\оплату, может еще и другие статьи содержать.
     
  3. yurets86

    yurets86

    Регистрация:
    13 апр 2013
    Сообщения:
    394
    Симпатии:
    328
  4. butikstickerov

    butikstickerov

    Регистрация:
    9 сен 2013
    Сообщения:
    57
    Симпатии:
    1
    Спасибо за статью,но по ней проблему не решил.
    нужна помощь куда теперь это вставить, зашел сюда catalog/controller/common/footer =>

    Код:
    <?php 
    class ControllerCommonFooter extends Controller {
        protected function index() {
            $this->language->load('common/footer');
           
            $this->data['text_information'] = $this->language->get('text_information');
            $this->data['text_service'] = $this->language->get('text_service');
            $this->data['text_extra'] = $this->language->get('text_extra');
            $this->data['text_contact'] = $this->language->get('text_contact');
            $this->data['text_return'] = $this->language->get('text_return');
            $this->data['text_sitemap'] = $this->language->get('text_sitemap');
            $this->data['text_manufacturer'] = $this->language->get('text_manufacturer');
            $this->data['text_voucher'] = $this->language->get('text_voucher');
            $this->data['text_affiliate'] = $this->language->get('text_affiliate');
            $this->data['text_special'] = $this->language->get('text_special');
            $this->data['text_account'] = $this->language->get('text_account');
            $this->data['text_order'] = $this->language->get('text_order');
            $this->data['text_wishlist'] = $this->language->get('text_wishlist');
            $this->data['text_newsletter'] = $this->language->get('text_newsletter');
    $this->data['text_contact_information'] = $this->language->get('text_contact_information');
    $this->data['text_about_shop'] = $this->language->get('text_about_shop');       
            $this->load->model('catalog/information');
           
            $this->data['informations'] = array();
    
            foreach ($this->model_catalog_information->getInformations() as $result) {
                if ($result['bottom']) {
                    $this->data['informations'][] = array(
                        'title' => $result['title'],
                        'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
                    );
                }
            }
    
            $this->data['contact'] = $this->url->link('information/contact');
            $this->data['return'] = $this->url->link('account/return/insert', '', 'SSL');
            $this->data['sitemap'] = $this->url->link('information/sitemap');
            $this->data['manufacturer'] = $this->url->link('product/manufacturer');
            $this->data['voucher'] = $this->url->link('account/voucher', '', 'SSL');
            $this->data['affiliate'] = $this->url->link('affiliate/account', '', 'SSL');
            $this->data['special'] = $this->url->link('product/special');
            $this->data['account'] = $this->url->link('account/account', '', 'SSL');
            $this->data['order'] = $this->url->link('account/order', '', 'SSL');
            $this->data['wishlist'] = $this->url->link('account/wishlist', '', 'SSL');
            $this->data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL');       
    
            $this->data['powered'] = sprintf($this->language->get('text_powered'), $this->config->get('config_name'), date('Y', time()));
           
            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/footer.tpl')) {
                $this->template = $this->config->get('config_template') . '/template/common/footer.tpl';
            } else {
                $this->template = 'default/template/common/footer.tpl';
            }
           
            $this->render();
        }
    }
    ?>

    А потом сюда catalog/controller/common/header =>
    Код:
    <?php  
    class ControllerCommonHeader extends Controller {
        protected function index() {
            $this->data['title'] = $this->document->getTitle();
           
            if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
                $this->data['base'] = $this->config->get('config_ssl');
            } else {
                $this->data['base'] = $this->config->get('config_url');
            }
           
            $this->data['description'] = $this->document->getDescription();
            $this->data['keywords'] = $this->document->getKeywords();
            $this->data['links'] = $this->document->getLinks();    
            $this->data['styles'] = $this->document->getStyles();
            $this->data['scripts'] = $this->document->getScripts();
            $this->data['lang'] = $this->language->get('code');
            $this->data['direction'] = $this->language->get('direction');
            $this->data['google_analytics'] = html_entity_decode($this->config->get('config_google_analytics'), ENT_QUOTES, 'UTF-8');
    
            // Whos Online
            if ($this->config->get('config_customer_online')) {
                $this->load->model('tool/online');
       
                if (isset($this->request->server['REMOTE_ADDR'])) {
                    $ip = $this->request->server['REMOTE_ADDR'];   
                } else {
                    $ip = '';
                }
               
                if (isset($this->request->server['HTTP_HOST']) && isset($this->request->server['REQUEST_URI'])) {
                    $url = 'http://' . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI'];   
                } else {
                    $url = '';
                }
               
                if (isset($this->request->server['HTTP_REFERER'])) {
                    $referer = $this->request->server['HTTP_REFERER'];   
                } else {
                    $referer = '';
                }
                           
                $this->model_tool_online->whosonline($ip, $this->customer->getId(), $url, $referer);
            }
                   
            $this->language->load('common/header');
            $this->data['contact'] = $this->url->link('information/contact');
           
            if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
                $server = HTTPS_IMAGE;
            } else {
                $server = HTTP_IMAGE;
            }   
                   
            if ($this->config->get('config_icon') && file_exists(DIR_IMAGE . $this->config->get('config_icon'))) {
                $this->data['icon'] = $server . $this->config->get('config_icon');
            } else {
                $this->data['icon'] = '';
            }
           
            $this->data['name'] = $this->config->get('config_name');
                   
            if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
                $this->data['logo'] = $server . $this->config->get('config_logo');
            } else {
                $this->data['logo'] = '';
            }
           
            $this->data['text_home'] = $this->language->get('text_home');
            $this->data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
            $this->data['text_shopping_cart'] = $this->language->get('text_shopping_cart');
            $this->data['text_search'] = $this->language->get('text_search');
            $this->data['text_welcome'] = sprintf($this->language->get('text_welcome'), $this->url->link('account/login', '', 'SSL'), $this->url->link('account/register', '', 'SSL'));
            $this->data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', 'SSL'), $this->customer->getFirstName(), $this->url->link('account/logout', '', 'SSL'));
            $this->data['text_account'] = $this->language->get('text_account');
            $this->data['text_checkout'] = $this->language->get('text_checkout');
    
    $this->data['text_telephone'] = $this->language->get('text_telephone');
    $this->data['text_continfo'] = $this->language->get('text_continfo');
    $this->data['text_enter_in_site'] = $this->language->get('text_enter_in_site');
    $this->data['text_enter_email'] = $this->language->get('text_enter_email');
    $this->data['text_enter_pass'] = $this->language->get('text_enter_pass');
    $this->data['text_forgot_pass'] = $this->language->get('text_forgot_pass');
    $this->data['text_in_registr'] = $this->language->get('text_in_registr');
    $this->data['text_in_login'] = $this->language->get('text_in_login');
    $this->data['text_gor_menu_brands'] = $this->language->get('text_gor_menu_brands');
    $this->data['text_gor_menu_akcii'] = $this->language->get('text_gor_menu_akcii');
           
            $this->data['home'] = $this->url->link('common/home');
            $this->data['wishlist'] = $this->url->link('account/wishlist', '', 'SSL');
            $this->data['logged'] = $this->customer->isLogged();
            $this->data['account'] = $this->url->link('account/account', '', 'SSL');
            $this->data['shopping_cart'] = $this->url->link('checkout/cart');
            $this->data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');
           
            if (isset($this->request->get['filter_name'])) {
                $this->data['filter_name'] = $this->request->get['filter_name'];
            } else {
                $this->data['filter_name'] = '';
            }
           
            // Menu
            if (isset($this->request->get['path'])) {
                $parts = explode('_', (string)$this->request->get['path']);
            } else {
                $parts = array();
            }
    
            $this->load->model('catalog/category');
            $this->load->model('tool/image');
            $this->load->model('catalog/product');
           
            $this->data['categories'] = array();
                       
            $categories = $this->model_catalog_category->getCategories(0);
           
    foreach ($categories as $category) {
    if ($category['top']) {
    $children_data = array();
    $children = $this->model_catalog_category->getCategories($category['category_id']);
    foreach ($children as $child) {
    $data = array(
    'filter_category_id' => $child['category_id'],
    'filter_sub_category' => true
    );
    $children2_data = array();
    $children2 = $this->model_catalog_category->getCategories($child['category_id']);
    foreach ($children2 as $child2) {
    $data = array(
    'filter_category2_id' => $child2['category_id'],
    'filter_sub_category2' => true
    );
    $children2_data[] = array(
    'name' => $child2['name'],
    'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'] . '_' . $child2['category_id'])
    );}
    $product_total = $this->model_catalog_product->getTotalProducts($data);
    if ($child['image']) {
    $picSubCat = $this->model_tool_image->resize($child['image'], 45, 45);
    } else {
    $picSubCat = './image/no_image.jpg';
    };
    $children_data[] = array(
    'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
    'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']),
    'children2' => $children2_data,
    'image2' => $picSubCat
    );}
    $this->data['categories'][] = array(
    'name' => $category['name'],
    'children' => $children_data,
    'active' => in_array($category['category_id'], $parts),
    'column' => $category['column'] ? $category['column'] : 1,
    'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
    );}}
           
            $this->children = array(
                'module/language',
                'module/currency',
                'module/cart'
            );
                   
            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/header.tpl')) {
                $this->template = $this->config->get('config_template') . '/template/common/header.tpl';
            } else {
                $this->template = 'default/template/common/header.tpl';
            }
           
            $this->render();
        }    
    }
    ?>
     
    Последнее редактирование: 12 янв 2014
  5. nix

    nix php, MySQL, UNIX, MikroTik ROSAPI

    Регистрация:
    16 янв 2013
    Сообщения:
    1.000
    Симпатии:
    890
    Вставте в шаблон ссылку напрямую и не засырайте код

    PHP:
    <a href="<?=$this->url->link('information/information''information_id=10'?>"> Названия меню</a>
    Где 10 ето ID статьи, посмотреть можно в админке наведя курсор мыши на нужную статью и кнопку ИЗМЕНИТЬ
     
    x-guest и butikstickerov нравится это.
  6. butikstickerov

    butikstickerov

    Регистрация:
    9 сен 2013
    Сообщения:
    57
    Симпатии:
    1
    Самое простое решение от nix спасибо .Проблема РЕШЕНА.
     
Статус темы:
Закрыта.