include("inc/header.php"); ?> include("inc/header_articoli.php"); ?> $title = "Articoli"; ?> if (($parent=="")&& ($step!="2")) { ?>
";
//************ S T E P 1
if ($step=="1")
{
if ($parent!="-1")
{
$count="1";
$cat1=$parent;
$done="0";
$currid=$parent;
$level=$parent;
#############################################################
// Inizio percorso
while (!$done)
{
$count=$count+1;
$query="SELECT id, parent FROM category WHERE id='$level'";
$result = mysql_query($query,$db);
if ($myrow = mysql_fetch_array($result))
{
$parent_id=$myrow['id'];
$parent_parent=$myrow['parent'];
$level=$parent_parent;
${"cat".$count}=$level;
$currid=$level;
if ($orphan)
{
$count=$count-1;
$done="1";
}
if ($level=="-1")
{
$done="1";
$grandparent=$parent_id;
}
if ($level==$lastlevel)
{
$count=$count-1;
$done="1";
}
$lastlevel=$level;
}
else {$done="1";}
}
/* ---- Visualizza le categorie superiori e quella attiva ---- */
$cont = 1;
$path[0] ="$prod_base";
for ($i=$count; $i>=1; $i=$i-1)
{
$display=${"cat".$i};
// $spacer=(($count - $i) * 15);
$query="SELECT c.id, c.name, c.active, c.picture, c.description FROM category c WHERE c.id='$display'";
$result = mysql_query($query,$db);
if ($myrow=mysql_fetch_array($result))
{
$display_id=$myrow['id'];
$display_name=$myrow['name'];
$display_active=$myrow['active'];
$display_picture=$myrow['picture'];
$display_description=$myrow['description'];
$cont ++;
$titolo = $display_name;
$rif="";
$path[$cont] = "$display_name";
}
mysql_free_result($result);
}
$path = implode (" › ", $path);
$path = "".$title."".$path;
}
// fine percorso #############################################################
if ($titolo == '')
{
$titolo = $prod_base;
}
// Visualizzazione stringa path
//echo "$path "; ?> if ($parent!="-1") { ?> print"$display_name"; ?>
} ?> if ($parent=="-1") { /* ------ Lista delle categorie per poter verificare l'esistenza di categorie 'orfane' ------ */ $catlist="0"; $query="SELECT id FROM category "; $result = mysql_query($query,$db); while ($myrow = mysql_fetch_array($result)) { $cat_id=$myrow['id']; $catlist =$catlist.",".$cat_id; } mysql_free_result($result); $query="SELECT c.id, c.name, c.active FROM category c WHERE c.parent='-1' AND c.active "; $result = mysql_query($query,$db);?>
include("box/novita.php"); ?> mysql_free_result($result); ?> $query="SELECT c.id, c.name, c.code, c.active FROM category c WHERE c.parent !='-1' AND c.parent NOT IN ($catlist) AND c.active "; $result = mysql_query($query,$db); while ($myrow=mysql_fetch_array($result)) { $cat_id=$myrow['id']; $cat_name=$myrow['name']; $cat_active=$myrow['active']; ?> } mysql_free_result($result); } else { /* ------- [Categoria già selezionata] --------- */ $count="1"; $cat1=$parent; $done="0"; $currid=$parent; $level=$parent; /* ------- [Conta le categorie superiori] --------- */ while (!$done) { $count=$count+1; $query="SELECT id, parent FROM category WHERE id='$level'"; $result = mysql_query($query,$db); if ($myrow = mysql_fetch_array($result)) { $parent_id=$myrow['id']; $parent_parent=$myrow['parent']; $level=$parent_parent; ${"cat".$count}=$level; $currid=$level; if ($orphan) { $count=$count-1; $done="1"; } if ($level=="-1") { $done="1"; $grandparent=$parent_id; } if ($level==$lastlevel) { $count=$count-1; $done="1"; } $lastlevel=$level; } else {$done="1";} } /* ---- Visualizza le categorie superiori e quella attiva ---- */ for ($i=$count; $i>=1; $i=$i-1) { $display=${"cat".$i}; $query="SELECT c.id, c.name, c.active, c.picture, c.description FROM category c WHERE c.id='$display'"; $result = mysql_query($query,$db); if ($myrow=mysql_fetch_array($result)) { $display_id=$myrow['id']; $display_name=$myrow['name']; $display_active=$myrow['active']; $display_picture=$myrow['picture']; $display_description=$myrow['description']; if ($display_id==$parent) { $catname=$display_name; if ($display_picture!="none") {$haspic=1; $catpicture=$display_picture;} else {$haspic=0;} if ($display_description=="none") {$catdescription="";} else {$catdescription=$display_description;} } } mysql_free_result($result); } /* ---- Visualizza le categorie sotto a quella attiva ----- */ $query="SELECT c.id, c.code, c.name, c.active FROM category c WHERE c.parent='$parent' AND c.active"; $result = mysql_query($query, $db); ?> while ($myrow = mysql_fetch_array($result)) { $display_id=$myrow['id']; $display_name=$myrow['name']; $display_code=$myrow['code']; $display_active=$myrow['active']; ?> }?> mysql_free_result($result); ?> //Prova calcolo prodotti if (!isset($numc)) { $numc=5; $begin=0; } if (!isset($pagina)) $pagina=1; // Serve solo per contare il numero totale di news $pre_query="SELECT DISTINCT p.novita as novita ,p.discount as discount, p.catalogoid as catalogoid , p.shortdesc as shortdesc, p.picture as picture,p.marcaid as marcaid, p.catalogoid as catalogoid, p.id AS id, p.name as name, p.sell AS sell, cl.catid AS catid FROM products p, catlink cl WHERE p.id=cl.prodid AND p.active=1 AND cl.catid='$parent' AND p.deleted=0 "; $result_num= mysql_query($pre_query,$db); $tot_ricerca=mysql_num_rows($result_num); if ($tot_ricerca > 0) { // ci sono news $num_pagine=ceil($tot_ricerca / $numc); // Se la pagina è la 1 partiamo da 0 $begin=($pagina-1) * $numc; /* ----- Mostra i prodotti della categoria ------ */ $query="SELECT DISTINCT p.novita as novita ,p.discount as discount, p.catalogoid as catalogoid , p.shortdesc as shortdesc, p.picture as picture,p.marcaid as marcaid, p.catalogoid as catalogoid, p.id AS id, p.name as name, p.sell AS sell, cl.catid AS catid FROM products p, catlink cl WHERE p.id=cl.prodid AND p.active=1 AND cl.catid='$parent' AND p.deleted=0 order by p.marcaid, p.name LIMIT $begin, $numc"; $result = mysql_query($query,$db); while ($myrow = mysql_fetch_array($result)) { mysql_assign($query,$myrow,"display_"); if ($display_picture=='none' || $display_picture=='') {$this_img=""; unset($w); unset($h); ;} else {$this_img="prodimg/$display_picture"; $h = "height='100'"; $w = "width='150'"; } /*$qq = "select * from produttori where id = '$display_marcaid'"; $resultM = mysql_query($qq,$db); $myrow = mysql_fetch_array($resultM);*/ if ($i) { $i=false; $colore="#F9F9F9"; } else {$i=true; $colore="#FFFFFF"; } /*$qq2 = "select * from catalogo where id = '$display_catalogoid'"; $resultC = mysql_query($qq2,$db); $myrowC = mysql_fetch_array($resultC); */ ?>
Marche e siti di riferimento
"; ?>
|