You are calling a weird parameter in line 24 which i dont understand… did you copy paste this function from elsewhere?
anyhow…
change line 24 from:
'$param_type' => array($term->term_id),
To this:
'cat' => array($term->term_id),
Good luck and dont forget to read @toscho comment for future questions.