/** * Function to quickly check whether a product has child products or not * * @param int $pid The id of the product to check * @return boolean True when the product has childs, false when not */ function parent_has_children($pid) { $db = new ps_DB; if( empty($GLOBALS['product_info'][$pid]["parent_has_children"] )) { $q = "SELECT COUNT(product_id) as num_rows FROM #__{vm}_product WHERE product_parent_id='$pid' "; $db->query($q); $db->next_record(); if( $db->f('num_rows') > 0 ) { $GLOBALS['product_info'][$pid]["parent_has_children"] = True; } else { $GLOBALS['product_info'][$pid]["parent_has_children"] = False; } } return $GLOBALS['product_info'][$pid]["parent_has_children"]; }