0) { foreach($_SESSION['pricebook_check'][$_SESSION['pricebook_id']] as $key=>$value){ if($_SESSION['pricebook_check'][$_SESSION['pricebook_id']][$key]!="true" && $_SESSION['pricebook_check'][$_SESSION['pricebook_id']]['all']=="true"){ $where_clauses[]="i.id!='".$key."'"; $orand=' and '; } elseif($_SESSION['pricebook_check'][$_SESSION['pricebook_id']][$key]=="true" && $_SESSION['pricebook_check'][$_SESSION['pricebook_id']]['all']!="true"){ $where_clauses[]="i.id='".$key."'"; $orand=' or '; } } if(count($where_clauses)>0)$where="(".implode($orand,$where_clauses).") and "; elseif($_SESSION['pricebook_check'][$_SESSION['pricebook_id']]['all']!="true" && count($where_clauses)==0)$where="ecmpricekopias_ecmproducts.id='9999999999999999' and "; } else $where="i.id='9999999999999999' and "; $w=$GLOBALS['db']->query("select i.ecmproduct_id from ecmpricekopias_ecmproducts as i inner join ecmproducts as p on p.id=i.ecmproduct_id where ".$where." i.ecmpricekopia_id='".$_REQUEST['record']."' and i.deleted='0' order by p.product_category_name asc,p.code asc"); include_once("include/html2fpdf/html2fpdf.php"); include_once("modules/EcmProducts/productCard.php"); $p=new HTML2FPDF(); $i=0; while($r=$GLOBALS['db']->fetchByAssoc($w)){ $i++; $id=$r['ecmproduct_id']; if($i%2>0)$p->AddPage(); $p=printCatalogue($p,$id,$_REQUEST['language'],true,true,false); } $p->Output("Catalogue.pdf","D"); ?>