Example #1
0
sort($match);
$idprod = (! empty($match[0]) ? $match[0] : '');

if (! isset($_GET[$htmlname]) && ! isset($_GET[$idprod])) return;

// When used from jQuery, the search term is added as GET param "term".
$searchkey=(! empty($_GET[$idprod])?$_GET[$idprod]:'');
if (empty($searchkey)) $searchkey=$_GET[$htmlname];
$outjson=isset($_GET['outjson'])?$_GET['outjson']:0;

// Get list of product.
$status=-1;
if (isset($_GET['status'])) $status=$_GET['status'];

$form = new Form($db);
if (empty($_GET['mode']) || $_GET['mode'] == 1)
{
	$arrayresult=$form->select_produits_do("",$htmlname,$_GET["type"],"",$_GET["price_level"],$searchkey,$status,2,$outjson);
}
if ($_GET['mode'] == 2)
{
	$arrayresult=$form->select_produits_fournisseurs_do($_GET["socid"],"",$htmlname,$_GET["type"],"",$searchkey,$status,$outjson);
}

$db->close();

if ($outjson) print json_encode($arrayresult);

//print "</body>";
//print "</html>";
?>