Перейти к публикации
Поиск в
  • Дополнительно...
Искать результаты, содержащие...
Искать результаты в...

Адаптация модуля с 2.3 на 2.1


Gann
 Поделиться

Рекомендованные сообщения

Приветствую!

 

Прошу посильной помощи в адаптации модуля с 2.3 на 2.1.

 

Вот часть кода, которую не могу адаптировать:

 

   <file path="admin/controller/startup/startup.php">
        <operation info="Add Shortcodes to admin $registry">
            <search><![CDATA[$this->registry->set('encryption']]></search>
            <add position="after"><![CDATA[
            // OpenCart Shortcodes
            $this->registry->set('shortcodes', new Shortcodes($this->registry));
            ]]></add>
        </operation>
    </file>
    <file path="catalog/controller/startup/startup.php">
        <operation info="Add Shortcodes to front $registry">
            <search><![CDATA[$this->registry->set('encryption']]></search>
            <add position="after"><![CDATA[
            // OpenCart Shortcodes
            $this->registry->set('shortcodes', new Shortcodes($this->registry));
            ]]></add>
        </operation>
    </file>
    <file path="catalog/controller/startup/maintenance.php">
        <operation>
            <search><![CDATA[function index()]]></search>
            <add position="after"><![CDATA[
            //========= OpenCart Shortcodes
            //=== Default shortcodes
            $this->load->helper('shortcodes_default');

            $class = new ShortcodesDefault($this->registry);
            $scDefaults = get_class_methods($class);
            foreach ($scDefaults as $shortcode) {
                $this->shortcodes->add_shortcode($shortcode, $class);
            }

            //=== Extensions shortcodes : for extensions developer
            $files = glob(DIR_APPLICATION . '/view/shortcodes/*.php');
            if ($files) {
                foreach ($files as $file) {
                   require_once($file);

                   $file     = basename($file, ".php");
                   $extClass = 'Shortcodes' . preg_replace('/[^a-zA-Z0-9]/', '', $file);

                   $class = new $extClass($this->registry);
                   $scExtensions = get_class_methods($class);
                   foreach ($scExtensions as $shortcode) {
                      $this->shortcodes->add_shortcode($shortcode, $class);
                   }
                }
            }

            //--------------- OLD theme OpenCart 2 compatible
            $theme = $this->config->get('config_theme');
            if ($this->config->get('config_theme') == 'theme_default') {
              $theme = $this->config->get('theme_default_directory');
            }

            //=== Themes shortcodes : for theme developer
            $file = DIR_TEMPLATE . $theme . '/shortcodes_theme.php';
            if (file_exists($file)) {
                require_once($file);

                $class      = new ShortcodesTheme($this->registry);
                $scThemes   = get_class_methods($class);
                foreach ($scThemes as $shortcode) {
                   $this->shortcodes->add_shortcode($shortcode, $class);
                }
            }

            $this->event->trigger('shortcodes/themes/after', array(&$data));

            //=== Custom shortcodes : user power!
            $file = DIR_TEMPLATE . $theme . '/shortcodes_custom.php';
            if (file_exists($file)) {
                require_once($file);

                $class      = new ShortcodesCustom($this->registry);
                $scCustom   = get_class_methods($class);
                foreach ($scCustom as $shortcode) {
                   $this->shortcodes->add_shortcode($shortcode, $class);
                }
            }
            //========= End:: OpenCart Shortcodes
            ]]></add>
        </operation>
    </file>

В 2.1 нет startup

Ссылка на комментарий
Поделиться на других сайтах

С первой частью вроде бы разобрался:

   <file path="index.php">
        <operation info="Add Shortcodes to admin $registry">
            <search><![CDATA[$registry->set('encryption', new Encryption($config->get('config_encryption')));]]></search>
            <add position="after"><![CDATA[
			$registry->set('shortcodes', new Shortcodes($config->get('config_shortcodes')));
            ]]></add>
        </operation>
    </file>

Дальше дело как то не пошло...

п.с. первую часть вероятно руками надо будет прописать

Ссылка на комментарий
Поделиться на других сайтах

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас
 Поделиться

×
×
  • Создать...

Важная информация

На нашем сайте используются файлы cookie и происходит обработка некоторых персональных данных пользователей, чтобы улучшить пользовательский интерфейс. Чтобы узнать для чего и какие персональные данные мы обрабатываем перейдите по ссылке. Если Вы нажмете «Я даю согласие», это означает, что Вы понимаете и принимаете все условия, указанные в этом Уведомлении о Конфиденциальности.