longy Posted June 7, 2014 Share Posted June 7, 2014 I'm trying from a module to interact with products list in bo. I can add custom columns but i can't filter/interact/order them. To add custom columns i just need to override AdminProductController in this way: parent::__construct(); $this->_select .= ", (date_upd - date_add) as talu "; $this->fields_list['talu'] = array( 'title' => 'An Amazing Field', 'width' => 70, 'align' => 'center', 'type' => 'bool' ); But i don't know how to apply filter or order by this column. Link to comment Share on other sites More sharing options...
vekia Posted June 8, 2014 Share Posted June 8, 2014 im affraid that it's not possible to order list with combined field, in fact, this field doesnt exist in database table, so it can be problematic anyway, you can try to add there filter_key value 'filter_key' => 'talu' Link to comment Share on other sites More sharing options...
longy Posted June 9, 2014 Author Share Posted June 9, 2014 (edited) AdminProductController extends AdminController that has _where and _orderBy properties, i don't remember if they are protected or public however my class has also these properties. So i could do something like: parent::__construct(); $this->_where .= "and (date_upd - date_add) = $something"; And something similar also for $this->_orderBy. However if I active "filter" and "order" in fields_list array for key 'talu', 'talu' attribute is appended to query and generate sql exception because 'talu' isn't a real field. Maybe I can solve removing unwanted parts of the query using str_replace but I've to find the right method to override, because these parts aren't appended in AdminController constructor . I would also know how to customize visualization for custom fields in order to allow interaction (something similar to enable/disable button for product status). Edited June 9, 2014 by longy (see edit history) Link to comment Share on other sites More sharing options...
logan871 Posted June 9, 2014 Share Posted June 9, 2014 (edited) AdminProductController extends AdminController that has _where and _orderBy properties, i don't remember if they are protected or public however my class has also these properties. So i could do something like: parent::__construct(); $this->_where .= "and (date_upd - date_add) = $something"; And something similar also for $this->_orderBy. However if I active "filter" and "order" in fields_list array for key 'talu', 'talu' attribute is appended to query and generate sql exception because 'talu' isn't a real field. Maybe I can solve removing unwanted parts of the query using str_replace but I've to find the right method to override, because these parts aren't appended in AdminController constructor . I would also know how to customize visualization for custom fields in order to allow interaction (something similar to enable/disable button for product status). I had the same problem and yes, if you remove the unwanted part of query it works...I would know the answer of your second question... Edited June 10, 2014 by logan871 (see edit history) 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