<?php
$tds1='<td valign="top" class="listViewThS1" style="vertical-align:top;">';
$trs='<tr onmouseover="this.style.backgroundColor=\'#cccccc\';" onmouseout="this.style.backgroundColor=\'#ffffff\';">';
$tre='</tr>';
$tds='<td valign="top" class="oddListRowS1" style="border-bottom:1px solid #cccccc;vertical-align:top;">';
$tde='</td>';
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" style="width:100%;">';
$tbe='</table>';
echo $tbs;
echo $trs.$tds1.'<b>Indeks</b>'.$tde.$tds1.'<b>Nazwa</b>'.$tde.$tds1.'<b>Kategoria</b>'.$tde.$tds1.'<b>EAN</b>'.$tde.$tre;
$w=$GLOBALS['db']->query("select name,code,id,product_category_name,product_category_id from ecmproducts where product_active='1' and code!='' and code is not null order by code asc");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
	$ean="";
	$eans=array();
	$ww=$GLOBALS['db']->query("select ean from ecmproduct_language where ean!='' and ean is not null and ecmproduct_id='".$r['id']."'");
	while($rr=$GLOBALS['db']->fetchByAssoc($ww)){
		if($rr['ean'])$eans[$rr['ean']]=$rr['ean'];
	}
	$ean=implode("<br>",$eans);
	echo $trs.$tds.$r['code'].$tde.$tds.'<a href="index.php?module=EcmProductB2Bs&action=DetailView&record='.$r['id'].'">'.$r['name'].'</a>'.$tde.$tds.'<a href="index.php?module=EcmProductB2BCategories&action=DetailView&record='.$r['product_category_id'].'">'.$r['product_category_name'].'</a>'.$tde.$tds.$ean.'&nbsp;'.$tde.$tre;
}
echo $tbe;

?>