Jump to content

It does not hide comment in the front office


pippo67

Recommended Posts

Hello to all,

I made a simple comment module, but I have a problem that I can not solve: when I deactivate the comment from the back-office the status is updated without errors, but in the front-office the comment is not hidden. How should I resolve this ?I also looked in the ManufacturerCore extends ObjectModel class and tried to follow the instructions, but without success.
This is the code 

public static function getComments($active = true, $p = false, $n = false)
{                      
        $comments = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
        SELECT com.*, cust.`firstname`, cust.`lastname`
        FROM `'._DB_PREFIX_.'comments` com
        INNER JOIN `'._DB_PREFIX_.'customer` cust ON (com.`id_customer` = cust.`id_customer`)
        '.($active ? 'WHERE com.`active` = 1' : '').'
        '.($p ? ' LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n : ''));   
        if($comments === false){
                return false;
        }       
         $counts = array();        
         if (count($counts) {
            foreach ($comments as $key => $comment){
                if (array_key_exists((int)$comment['id'], $counts)){
                    $comment[$key]= $counts[(int)$comment['id']];
                } else{
                    $comment[$key]= 0;
                }
            }
        }
        return $comments;
    }        
}    

Thanks in advance

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...