I followed Below procedure But still i m getting permission denied error . I am using opencart 2.x
1) Create a new file in admin/controller/custom/helloworld.php
Your filename and controller name should be the same in desc order:
helloworld.php
<?
class ControllerCustomHelloWorld extends Controller{
public function index(){
// VARS
$template="custom/hello.tpl"; // .tpl location and file
$this->load->model('custom/hello');
$this->template = ''.$template.'';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());
}
}
?>
2) Create a new file in admin/view/template/custom/hello.tpl
Hello.tpl
<?php echo $header; ?>
<div id="content">
<h1>HelloWorld</h1>
<?php
echo 'I can also run PHP too!';
?>
</div>
<?php echo $footer; ?>
3) Create a new file in admin/model/custom/hello.php
<?php
class ModelCustomHello extends Model {
public function HellWorld() {
$sql = "SELECT x FROM `" . DB_PREFIX . "y`)";
$implode = array();
$query = $this->db->query($sql);
return $query->row['total'];
}
}
?>
4) You then need to enable the plugin to avoid permission denied errors:
Opencart > Admin > Users > User Groups > Admin > Edit Select and Enable the Access Permission.