Jump to content

cannot call function in admin controller with custom module


Recommended Posts

I'm using prestashop 1.5.6, in my module, i create models folder with name SolrProduct, in there i write a function,

class SolrProduct extends ObjectModel{
    protected $limit;
	protected $offset;
	protected $status;
	protected $current;
	protected $inputData;
	protected $beginData;
	protected $totalproduct;
    protected $lengthArray;
    protected $dataJson;
    protected $currentArray;
	public function __contruct(){
		$this->limit = (int)Configuration::get('PS_SOLRBRIGHT_COMMIT_ITEM');
		$this ->offset = 0;
		$this ->status = 'start';
		$this->current = '';
		$this->totalproduct = 0;
		parent::__contruct();
	}
	
   public static function json_is($string){
        try{
            json_decode($string);
        }
        catch (ErrorException $e) {
            return false;
        }
        return json_decode($string);
     }

and in my admin controller i, i call

class SolrBrigdeGetProductController extends ModuleAdminController{
	
	public function __construct() {
		//$this->className 	= 'SolrProduct';
		parent :: __construct();
		$id_lang = $this->context->language->id;
		echo SolrProduct::json_is('aaa') ;die();
	}

but i get error:

"NetworkError: 500 Internal Server Error - http://localhost:81/prestashop02/admin123/index.php?controller=SolrBrigdeGetProduct&token=a2153264281fbb48a3a840588ffdcd7a"

 

Please help me! thank advance.

Link to comment
Share on other sites

turn on error reporting, then you will see what exactly doesnt work in this code

here error is: Fatal error: Class 'SolrProduct' not found in C:\xampp\htdocs\prestashop02\modules\testing\controllers\admin\SolrBrigdeGetProductController.php on line 8

Link to comment
Share on other sites

here error is: Fatal error: Class 'SolrProduct' not found in C:\xampp\htdocs\prestashop02\modules\testing\controllers\admin\SolrBrigdeGetProductController.php on line 8

i found that, i only call this class in front-end controller, so, how could i call it from admin controller?

Link to comment
Share on other sites

×
×
  • Create New...