php - Create and load Modules in OpenCart? -
i want add model php file, in new folder in catalog/model dir.
<?php class modelopaginacion extends model{ public function contargarages(){ $query = $this->db->query ("select count(*)as total `" . db_prefix . "vendors`"); return $query->row['total']; //return "29"; }//fin funcion }//fin class ?>
when want load model in home.php controller whole project appear broke, cuze doesn't show on browser. , ther error generated load in home controller. when comment lines, proyect work fine.
can me issue??
there couple of issues above. firstly, you're not naming model right, it's never going work. lets assume going in folder in catalog/model/tool/
called paginacion.php
you start defining model as
class modeltoolpaginacion extends model {
then call in controller, first need load , call it
$this->load->model('tool/paginacion'); $this->model_tool_paginacion->contargarages();
which should work you. notice naming conventions throughout linked (tool , paginacion)
Comments
Post a Comment