D
D
Dmitry2019-03-08 10:50:53
opencart
Dmitry, 2019-03-08 10:50:53

Opencart 2 how to customize the execution order of modules?

I am writing a module for opencart that changes the title and description for pages by url because the SEO wants something strange.
you need the module to process the page last because on some pages other modules change the same parameters

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
zoozag, 2019-03-11
@zoozag

1. If we are talking about ocmod extensions, remove redundant code in modules that operate on the same code sections.
2. If we are talking about modules, they are loaded like this:

$modules = $this->model_design_layout->getLayoutModules($layout_id, 'content_bottom');

    foreach ($modules as $module) {
// Подгружаются модули
}

Load your module manually after this cycle. But other modules are most likely directly modified by the header controller according to the first option.

P
Pavel, 2019-03-08
@PavelMonro

Well, load the controller of other modules and check if the condition is worth it:

<? if (isset($code['title'])) { ?>Код модуля если есть<? } else if (isset($code['title_vashego_modlya'])) { ?>Вывод ваших данных<? } else { >Стандартный title<? } ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question