function onProcessProductMassFiltercategoryColumn(&$elements,&$query,$filter,$num){
if(empty($filter['type']) || $filter['type']=='all') return;
if(!isset($this->massaction))$this->massaction = hikashop_get('class.massaction');
$db = JFactory::getDBO();
if(count($elements)){
foreach($elements as $k => $element){
if(!empty($element->categories)){
if(!is_array($element->categories)) $element->categories = array($element->categories);
JArrayHelper::toInteger($element->categories);
$db->setQuery('SELECT * FROM '.hikashop_table('category').' WHERE category_id IN('.implode(',',$element->categories).')');
$categories = $db->loadObjectList();
$del = true;
foreach($categories as $category){
$in = $this->massaction->checkInElement($category, $filter);
if($in) $del = false;
}
if($del) unset($elements[$k]);
}
}
}else{
if(!empty($filter['value']) || (empty($filter['value']) && in_array($filter['operator'],array('IS NULL','IS NOT NULL')))){
$query->leftjoin['product_category'] = hikashop_table('product_category').' AS hk_product_category ON hk_product_category.product_id = hk_product.product_id';
$query->leftjoin['category'] = hikashop_table('category').' AS hk_category ON hk_category.category_id = hk_product_category.category_id';
$query->where[] = $this->massaction->getRequest($filter,'hk_category');
$tQuery = '';
if(!empty($query->select)) $tQuery .= ' SELECT '.$query->select;
if(!empty($query->from)) $tQuery .= ' FROM '.$query->from;
if(!empty($query->join)) $tQuery .= ' JOIN '.implode(' JOIN ',$query->join);
if(!empty($query->leftjoin)) $tQuery .= ' LEFT JOIN '.implode(' LEFT JOIN ',$query->leftjoin);
if(!empty($query->where)) $tQuery .= ' WHERE ('.implode(') AND (',$query->where).')';
if(!empty($query->ordering)) $tQuery .= ' ORDER BY '.implode(',',$query->ordering);
if(!empty($query->direction) && is_string($query->direction)) $tQuery .= ' '.$query->direction;
if(!empty($query->group) && is_string($query->group)) $tQuery .= ' GROUP BY '.$query->group;
$db->setQuery($tQuery);
$mainProducts = $db->loadObjectList();
$ids = array();
foreach($mainProducts as $mainProduct){
$ids[] = $mainProduct->product_id;
}
$query->join = array();
$query->leftjoin = array();
$query->where = array('product_id IN ('.implode(',',$ids).') OR product_parent_id IN ('.implode(',',$ids).')');
}
}
}