jondm Posted January 25, 2015 Share Posted January 25, 2015 I'm creating my first prestashop module and i have problem when i change the boolean value. If I click over icon of boolean value, it looks like it is changing, but, when finish the boolean value is the same and the other values are deleted. Someone know how can I fix it? Thanks! Link to comment Share on other sites More sharing options...
vekia Posted January 25, 2015 Share Posted January 25, 2015 i totally don't understand what feature you have and how it works please share some screenshot or part of code Link to comment Share on other sites More sharing options...
jondm Posted January 25, 2015 Author Share Posted January 25, 2015 Sorry, i'll try with images. I create a new bill, and add correctly. Here we can see the dates added correctly. When I click in the status icon to change (in the red "x" image), i get this: As you can see, when i click in the button, the data saved disappear and the status continue in the same value. thanks for your help Link to comment Share on other sites More sharing options...
vekia Posted January 26, 2015 Share Posted January 26, 2015 can you please show a part of controller where this field is defined ? Link to comment Share on other sites More sharing options...
jondm Posted January 26, 2015 Author Share Posted January 26, 2015 $this->fields_list = array( ... 'status' => array('title' => $this->l('Status'), 'class' => 'fixed-width-xs', 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => FALSE), ... ); and the renderList function public function renderList() { $this->addRowAction('view'); $this->addRowAction('edit'); $this->addRowAction('delete'); $this->simple_header = false; return parent::renderList(); } thanks Link to comment Share on other sites More sharing options...
FullCircles Posted January 28, 2015 Share Posted January 28, 2015 Can't see any issues offhand, had a check in one of my own admin helperlists, is pretty similar 'comment_status' => array( 'title' => $this->l('Status'), 'type' => 'bool', 'width' => '50', 'align' => 'center', 'active' => 'status', 'icon' => array( 0 => 'disabled.gif', 1 => 'enabled.gif', 'default' => 'disabled.gif' ), ), Is what I have on my $this->fields_list Hmm, maybe you need a custom status update method, might be that causing the issue, I also have this in there public function processStatus() { $db = Db::getInstance(); if(($id_comment = (int)Tools::getValue('id_comment'))){ $update = $db->execute('UPDATE `'._DB_PREFIX_.'comments` SET `comment_status` = (1 - `comment_status`) WHERE `id_comment` = '.(int)$id_comment.' LIMIT 1'); } if(isset($update) && $update){ $this->redirect_after = self::$currentIndex.$this->currentIndex.'&conf=5&token='.$this->token; return true; } else { $this->errors[] = Tools::displayError('An error occurred while updating the status.'); return false; } } Link to comment Share on other sites More sharing options...
jondm Posted January 29, 2015 Author Share Posted January 29, 2015 Thanks for your answer. The issue was i need write my own function to process the status 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