Вот так работает:
class ControllerShippingMyModule extends Controller {
private $error = array();
public function index() {
$this->load->language('shipping/mymodule');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('setting/setting');
#......... стандартный код обычной доставки
$this->template = 'shipping/mymodule.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());
}
public function getData($filter, $order) {
$json = array();
#какой-то код
$this->response->setOutput(json_encode($json));
}
private function validate() {
if (!$this->user->hasPermission('modify', 'shipping/mymodule')) {
$this->error['warning'] = $this->language->get('error_permission');
}
if (!$this->error) {
return true;
} else {
return false;
}
}
}
Когда делаю запрос при помощи jquery
index.php?route=shipping/mymodule/getData&filter=1&order=2&token=...
Все работает! Ну когда запихиваю метод в библиотеку
system/library/mymodule.php
С кодом
class MyModule {
public function getData($filter, $order) {
#code
}
#...
}
Щас нету возможности скопировать код с инстанцированием класса библиотеки, ну что-то дальше не идет. Может есть пример в двух словах? Как с методами быть чтобы запрос сработал?
index.php?route=shipping/mymodule/getData&filter=1&order=2&token=...
Чтото я уже в трех соснах запутался... Уже и через конструктор контроллера и через $registry и просто подключал load->library(...);