entepede Posted November 13, 2016 Share Posted November 13, 2016 Hi everybody, I am trying to develop my first AdminModule. I have managed to add a new tab as a child. I can view the list, there is no problem. I have changed the select and join parameters of renderList() method because i need to join the table with another table. It is no problem. When I add two rows to the table, i can see the filter elements which is good. My problem here is when I enter a value in one of the filter and press search button, i cannot get that value using Tools::getValue. Although I do not get the value, the value is seen in the filter element after page refreshes. I have looked at the code again and again, what am i missing? Your help is very appreciated. Here is the code class AdminSellerSurveyController extends ModuleAdminController { public function __construct() { $this->bootstrap = true; $this->table = 'seller_survey'; $this->className = 'SellerSurvey'; $this->lang = false; $this->context = Context::getContext(); parent::__construct(); } public function initPageHeaderToolbar() { parent::initPageHeaderToolbar(); } public function renderList() { $this->addRowAction('view'); //SELECT ss.id_seller_survey, s.name, ss.date_add, ss.date_upd FROM ps_seller_survey ss //left join ps_seller s on s.id_seller=ss.id_seller WHERE 1 $this->_select = 's.name'; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'seller` s on s.id_seller=a.id_seller'; if (Tools::isSubmit('submitFilter')) { if (Tools::getValue('seller_surveyFilter_id_seller_survey')) $this->_where = 'AND a.id_seller_survey = '.(int)Tools::getValue('seller_surveyFilter_id_seller_survey'); if (Tools::getValue('seller_surveyFilter_name') != '') $this->_where = 'AND s.name LIKE "%'.pSQL(Tools::getValue('seller_surveyFilter_name')).'%"'; if (Tools::getValue('seller_surveyFilter_date_add[0]') != '') $this->_where = 'AND a.date_add >='.pSQL(Tools::getValue('seller_surveyFilter_date_add[0]')); if (Tools::getValue('seller_surveyFilter_date_add[1]') != '') $this->_where = 'AND a.date_add <='.pSQL(Tools::getValue('seller_surveyFilter_date_add[1]')); if (Tools::getValue('seller_surveyFilter_date_upd[0]') != '') $this->_where = 'AND a.date_upd >='.pSQL(Tools::getValue('seller_surveyFilter_date_upd[0]')); if (Tools::getValue('seller_surveyFilter_date_upd[1]') != '') $this->_where = 'AND a.date_upd <='.pSQL(Tools::getValue('seller_surveyFilter_date_upd[1]')); } $this->fields_list = array( 'id_seller_survey' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 25, 'havingFilter' => true, ), 'name' => array( 'title' => $this->l('Seller name'), 'width' => 90, 'havingFilter' => true, ), 'date_add' => array( 'title' => $this->l('Date add'), 'type' => 'datetime', 'havingFilter' => true, ), 'date_upd' => array( 'title' => $this->l('Date update'), 'type' => 'datetime', 'havingFilter' => true, ), ); return parent::renderList(); } return parent::renderList(); } } public function postProcess() { parent::postProcess(); } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now