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

Полулить резульит рилиты модуля с помощью ajax


Recommended Posts

Здравствуйте.

Есть синдартный модуль для вывода html-контени

<?php
class ControllerExtensionModuleHTML extends Controller {
	public function index($setting) {
		if (isset($setting['module_description'][$this->config->get('config_language_id')])) {
			$data['heading_title'] = html_entity_decode($setting['module_description'][$this->config->get('config_language_id')]['title'], ENT_QUOTES, 'UTF-8');
			$data['html'] = html_entity_decode($setting['module_description'][$this->config->get('config_language_id')]['description'], ENT_QUOTES, 'UTF-8');

			return $this->load->view('extension/module/html', $data);
		}
	}
}

 

Помимо вывода его с помощью страницы "Дизайн - Макеты" хочу сгделать возможность полулить html по ссылке index.php?route=extension/module/html/getHTML

Для этого я создал новый метод getHTML, Сложность возникла в том, что я не знаю как в этом метогде полулить доступ к $setting, куда приходят все данные с базы.

Подскажите, как это сгделать?

Edited by YellowSnowman
Link to comment
Share on other sites


Вам нужно передать module_id из index() в getHTML() через ваш акакс, например гет-параметром.

По умолчанию переменной module_id в setting нет, чтобы она им появилась, надо сгделать описанное згдесь.

Дное, уже в getHTML() поймать её, и полулить данные конкретного модуля.

$module_id = $this->request->get['module_id'];
$this->load->model('setting/module');
$module_info = $this->model_setting_module->getModule($module_id);

 

  • +1 1
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.