$prenom = $post['prenom'];
} else {
    $prenom = null;
}
if (!empty($post['login'])) {
    $login = $post['login'];
} else {
    $login = null;
}
if (!empty($post['dateDeb'])) {
    $date_com_deb = $post['dateDeb'];
} else {
    $date_com_deb = null;
}
if (!empty($post['dateFin'])) {
    $date_com_fin = $post['dateFin'];
} else {
    $date_com_fin = null;
}
try {
    $listeCom = Commande::getCommandesBy($id_com, $id_utilisateur, $nom, $prenom, $login, $date_com_deb, $date_com_fin);
    $parameters['commande'] = $listeCom;
} catch (Exception $e) {
    $parameters['error'] = $e->getMessage();
}
$smarty->assign('parameters', $parameters);
$ligneCom = array();
foreach ($parameters['commande'] as $key => $value) {
    $ligneCom[] = Commande::getLigneCom($value['id_com']);
}
$smarty->assign('ligneCom', $ligneCom);
<?php

if (isset($_POST['id_com'])) {
    $ligneCom = Commande::getLigneCom($_POST['id_com']);
    $smarty->assign('ligneCom', $ligneCom);
}