Jump to content

SQL Query AdminMyModuleController $this->table

Recommended Posts

I'm trying to get a table from the categories. I would need the ID and the Name combined from table ps_category & ps_category_lang.

I found this structure in order to add the function on the AdminMyModuleController.

My knowledge in SQL are limitated and I don't get how to strudcutre the query. I also don't understand clearly the prefixe c & cl.


	 protected function categeoryList()
        $this->table = 'category';
        $this->identifier = '`id_category`';
        $this->_select = 'c.`id_category`, `name`, `description`' ;

		$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
			ON (c.`id_category` = cl.`id_category`)
			AND (`id_lang` = '.(int)$this->context->language->id.')';

		$this->fields_list = array(
            `id_category` => array(
                'title' => $this->l('ID'),
                'align' => 'center',
            'name' => array(
                'title' => $this->l('Outlet Name'),
                'align' => 'center',
                'havingFilter' => true

Here is the error massage :


Champ 'c.id_category' inconnu dans field list

, c.`id_category`, `id_parent`, `active`, `name`, `description`, `position`
FROM `liloshop_category` a 

 LEFT JOIN `liloshop_category_lang` cl
			ON (c.`id_category` = cl.`id_category`)
			AND (`id_lang` = 1) 

 ORDER BY id_configuration ASC  LIMIT 0, 50

any idea how to get the correct syntax ?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More