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

Как полулить позицию модуля в его контроллер


sm13
 Share

Recommended Posts

Добрый гдень! Хочу в шаблоне модуля рекомендуемых прописать два вариани вывода:

 

          {% if module_position == 'column_left' %}
          вывести товар каруселью
          {% else %}
          вывести товар списком
          {% endif %}

 

Подскажите как в контроллер featured.php полулить позицию модуля? Спасипотому что.

Link to comment
Share on other sites


17 минут назад, sm13 сказал:

как в контроллер featured.php полулить позицию модуля? Спасипотому что.

Самый простот способ - не отслеживать позицию, а создать копию модуля featured с каруселью и в макеих в колумн_лефт его всивить.

Link to comment
Share on other sites

Удалось найти решение на opencart.com

в сatalog/controller/common/{content_top, content_bottom, content_right, content_left}.php

после 

$setting_info = $this->model_extension_module->getModule($part[1]);

всивить

$setting_info['position'] = basename(__FILE__, '.php');

в контроллере модуля всивить

$data['module'] = $setting;

ну и в самом шаблоне

{% if module.position == 'column_left' %}

.........................

{% else %}

............................

{% endif %}

 

 

 

Link to comment
Share on other sites


А если модуль посивлен не в column_left, тогда position вообещё неопрегделен бугдет. Можно его в контроллере модуля как-то инициализировать, если не опрегделен, чтобы в шаблоне проблем не было.
Но вообещё интересное решение.

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.