Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

Нужно сделать  отображение модуля в header, пробовал сам создать новую схему размещения модулей из найденных тем и материалов на этом форуме, но к сожалению безрезультатно!

 Т.е. есть модуль личного кабинета и соответственно размещается он только в 4-х стандартных местах опенкарта, а нужно чтобы он был в шапке сайта.5a527a7a93387_.thumb.jpg.643295483ca0be5d8cde68e0fb2224a6.jpg

 

Буду благодарен за помощь!

Edited by 7777
Link to comment
Share on other sites


13 часов назад, 7777 сказал:

а нужно чтобы он был в шапке сайта.

в контроллере -  catalog/controller/common/header.php подгружаем модуль

как-то так

$data['my_module'] = $this->load->controller('path_in_module');

в шаблоне - catalog/view/theme/ваша_тема/template/common/header.tpl, выводим где нужно

<?php echo $my_module; ?>

 

Link to comment
Share on other sites

p.s.

не досмотрел, вам нужно на 1.5

в контроллере, добавляем в массив нужный модуль

$this->children = array(
	'module/language',
	'module/currency',
	'module/cart',
    'module/my_module'
);

в  шаблоне

<?php echo $my_module; ?>

 

  • +1 1
Link to comment
Share on other sites

14 часов назад, fanatic сказал:

p.s.

не досмотрел, вам нужно на 1.5

в контроллере, добавляем в массив нужный модуль


$this->children = array(
	'module/language',
	'module/currency',
	'module/cart',
    'module/my_module'
);

в  шаблоне


<?php echo $my_module; ?>

 

 

 

Благодарю! Вы лучший! Все получилось, теперь осталось только стилизовать и все гуд!

Link to comment
Share on other sites


А я пытался создать новое расположение для всех модулей, но в хедере не удалось сделать. Ваш вариант не додумался сделать) Спасибо!

Link to comment
Share on other sites


В 08.01.2018 в 12:16, fanatic сказал:

p.s.

не досмотрел, вам нужно на 1.5

в контроллере, добавляем в массив нужный модуль


$this->children = array(
	'module/language',
	'module/currency',
	'module/cart',
    'module/my_module'
);

в  шаблоне


<?php echo $my_module; ?>

 

 

Можно еще один вопрос!  Подскажи пожалуйста как можно вывести переменную <?php echo $cart; ?> - корзина   и <?php echo $total; ?> - баланс покупателя  ,    они у меня реализованы в модуле "логин" ,  вставляя их в шаблон home.tpl или heder.tpl   н  они отображаются и работают как надо, но мне их нужно поставить в форму которая у меня   установлена непосредственно в файле content_top.tpl, перед стандартным кодом этого файла:

 

<?php foreach ($modules as $module) { ?>
<?php echo $module; ?>
<?php } ?>

 

  и  соответственно подставляя в него эти переменные не работают!   Подскажите пожалуйста как нужно сделать чтобы эти переменные отображались в шаблоне content_top.tpl  !?!?!?!  

 

Заранее благодарен!

Edited by 7777
Link to comment
Share on other sites


в контроллере content_top.php  добавил следующее

$this->children = array(
     'module/currency',
    'module/cart'
 );

 

корзина заработала, а вот баланс клиента нет(

Link to comment
Share on other sites


Решилось все следующей незатейливой конструкцией в контроллере   content_top.php  :

 

$this->id       = 'login';
            $this->children = array(
            'module/language',
            'module/currency',
            'module/cart'
        );

if($this->customer->isLogged()) {
            $this->data['heading_title'] = 'Приветствуем';
            $this->data['name']     = $this->customer->getFirstName() .' '. $this->customer->getLastName();
            $this->data['email'] = $this->customer->getEmail();    
            $this->data['shopping_cart'] = $this->url->link('checkout/cart');
            
            $this->data['logout'] = $this->url->link('account/logout');
                $this->data['total'] = $this->currency->format($this->customer->getBalance());
            $this->load->model('account/customer_group');
            
            $customer_group_id = $this->customer->getCustomerGroupId();
            $customer = $this->model_account_customer_group->getCustomerGroup($customer_group_id);
            if($this->customer->isLogged() == NULL) {  $customer['discount'] = '0'; }
        $this->data['user_discount'] = $customer['discount'];
                $this->data['usergroup_name'] = $customer['name'];
        
        if (isset($this->request->get['filter_name'])) {
            $this->data['filter_name'] = $this->request->get['filter_name'];
        } else {
            $this->data['filter_name'] = '';
        }

}
 

 

 

 

Ну и получилось что и хотел. Когда клиент залогинен, то отображается текущий баланс с корзиной 

5a554b4626ef4_1.thumb.jpg.d60df74e6bf201c9285fcda54b5a1864.jpg

 

 

 

 

И когда не залогинен, то только корзина

 

5a554d7bb05b6_2.thumb.jpg.116cdf7c03d6fd17789ba132be151dfe.jpg

 

 

 

Извиняюсь что развел тут демагогию, но учиться все таки приятно!)))

Edited by 7777
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

×
×
  • 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.