include_once "myconnect.php";
function main()
{
/////////////getting null char
include "myutente.php";
$config=mysql_fetch_array(mysql_query("select * from astevirtuali_configurazione"));
$null_char[0]=$config["null_char"];
//////////////////////////////leggi dati utente eshop /////////
$rsu=mysql_fetch_array(mysql_query("select * from astevirtuali_utenti where id=$uid"));
///////////////////////////////////session/////////
session_start();
if (!isset($_SESSION['cart'])) {
$_SESSION['cart'] = array();
setcookie("cart",time()+777600);
setcookie('cart'.'pez',time()+777600);
setcookie('cart'.'not',time()+777600);
setcookie('cart'.'pag',time()+777600);
setcookie('cart'.'sco',time()+777600);
setcookie('cart'.'dove',time()+777600);
setcookie('cart'.'myg',time()+777600);
}
//-----------------------------------------///
if (($_GET['azzera']==1)) {
unset ($_SESSION['cart']);
header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
exit();
}
if (($_GET['empty']==1)) {
$_SESSION['cart'.'pez'][$_GET['pz']] = "0";
echo '';
}
if (isset($_GET['modif'])) {
// Empty the $_SESSION['cart'] array
$_SESSION['cart'.'pez'][$_GET['pz']] = $_GET['qt'];
$_SESSION['cart'.'not'][$_GET['pz']] = $_GET['note']; // $_REQUEST['note'];
// echo '';
}
if (isset($_GET['nota'])) {
$_SESSION['cart'.'not'][$_GET['pz']] =$_REQUEST['note'];
echo '';
}
if($cid>=1)
{
if($cid<=1){$cid="1";} //deve essere 743
$scelta=1;
}
elseif ( isset( $_REQUEST["cid"] ) && $_REQUEST["cid"]!="" )
{
$cid=$_REQUEST["cid"];
$scelta=3;
$_SESSION["u_categ"]=$cid ;
// header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
}
elseif($_SESSION['u_categ']>=1)
{
$cid=$_SESSION['u_categ'];
$scelta=2;
}
else
{
$cid=4; // 743
$scelta=4;
$_SESSION["u_categ"]=0 ;
//header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
}
if(!isset($_REQUEST["type"]))
{
$type=1;
}
else
{
$type=$_REQUEST["type"];
}
// ------------ elimina spazi vuoti proima e dopo la stringa ------
$_REQUEST["keyword"]= trim($_REQUEST["keyword"]);
// ------------ fine -----
$strpass="";
if ( isset($_REQUEST["keyword"] ) )
{
$strpass=$strpass . "&keyword=" . $_REQUEST["keyword"];
}
if ( isset($_REQUEST["radio"] ) )
{
$strpass=$strpass . "&radio=" . $_REQUEST["radio"];
}
$strpass=$strpass . "&cid=" . $cid;
$strpass=$strpass . "&uid=" . $uid;
$strpass=$strpass . "&type=" . $type;
$strpass1=$strpass;
$rs_query=mysql_query("Select * from astevirtuali_categorie where id=" . $cid );
if ($rs=mysql_fetch_array($rs_query))
//if ($cid>1)
{
$catname=$rs["cat_name"];
$category=$rs["id"];
$cid=$rs["id"];
$descrizione=$rs["cat_desc"];
$foto1=$rs["cat_foto1"];
$foto2=$rs["cat_foto2"];
}
else
{
$catname="";
$category=0;
$cid=0;
}
$catpath="";
$rs_query=mysql_query("Select * from astevirtuali_categorie where id=" . $category );
while ($rs=mysql_fetch_array($rs_query))
{
$catpath ="> " .$rs["cat_name"]."" . $catpath;
$rs_query=mysql_query("Select * from astevirtuali_categorie where id=" . $rs["pid"] );
}
//$recperpage=12 ; //$config["recperpage"];
$recperpage= $config["recperpage"];
// ---- inizio SQL proncipale .............
$sql="select ";
if ($_REQUEST["radio"]>=1)
{$sql.=" id, product_name, product_subt, soddisfatti, tempi, peso, codice, location, raffina2, raffina3, raffina0, raffina4, raffina, codice, pezzi, pezzi_sconto, sconto_mom, min_sconto, min_bid, max_price,";}
else
{$sql.=" *,";}
$sql.=" DATE_FORMAT(date_submitted,'%d-%b-%Y %r') as postedon,DATE_FORMAT(DATE_ADD(date_submitted,INTERVAL auction_period DAY),'%d-%b-%Y %r') as endson,UNIX_TIMESTAMP(DATE_ADD(date_submitted,INTERVAL auction_period DAY)) as expiry from astevirtuali_prodotti where aucid in (1,3,5,6,7,10,20,25,30)";
if (($type==1) || ($type==9))
{
$date1=date(time());
//$sql.=" and UNIX_TIMESTAMP(DATE_ADD(date_submitted,INTERVAL auction_period DAY)) > $date1 and status='open' and uid=" . $uid;
//$date1=date(time());
//$sql.=" and status='open' and uid=" . $uid;
}
////// leggi pure ditta dalu(12) SEMPRE e se in RICERCA TUTTE /////////////////////////////////////////
$sql.=" and status='open' "; //,'conclusa vend','Venduto'
if (($_REQUEST["radio"]>=1) || ($cid>10))
{ $sql.=" and uid in (175,31,28,27,11,12,14,37,45,72,30,36,38,39,3,4,5,7,8,21,10)";} // 7 è ditta solo lancette e orologio (da fare a parte)
else
{ $sql.=" and uid in (175,31,28,27,11,12,14,37,45,72,30,36,38,39,3,4,5,7,8,21,10) and gallery_featured='yes'";} // gallery_featured = in evidenza .. senpre No ditta 7!
///////////////////////////////////////////////
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==1)
{
$sql=$sql." and ( product_name like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or product_subt like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or codice like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or raffina like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or raffinaa like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or raffinab like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or raffina3 like'%".str_replace("'","''",$_REQUEST["keyword"])."%' or id like'%".str_replace("'","''",$_REQUEST["keyword"])."%' )";
}
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==2)
{
$sql=$sql." and ( product_name like '%".str_replace("'","''",$_REQUEST["keyword"])."%')";
}
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==3)
{
$sql=$sql." and ( product_name like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or product_desc like '%".str_replace("'","''",$_REQUEST["keyword"]). "%')";
}
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==4)
{
$sql=$sql." and ( codice='".str_replace("'","''",$_REQUEST["keyword"])."') ";
}
if ( isset($_REQUEST["keyword"] ) && $_REQUEST["keyword"]!="" && isset($_REQUEST["radio"] ) && $_REQUEST["radio"]==3)
{
$sql0=mysql_query("select id from astevirtuali_utenti where (username like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or fname like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or lname like '%".str_replace("'","''",$_REQUEST["keyword"])."%' or c_name like'%".str_replace("'","''",$_REQUEST["keyword"])."%')");
$u_list="-1";
while($rs_t1=mysql_fetch_array($sql0))
{ $u_list.=",".$rs_t1["id"]; }
// // $sql=$sql." and uid in (".$u_list.")"; già esluso .. percio inutile ---
}
///////////////////////////////////////////////
if ($cid>10)
{
$rst1_query=mysql_query("Select * from astevirtuali_categorie where pid=" . $cid );
$clist=$cid;
while ( $rst1=mysql_fetch_array($rst1_query) )
{
$clist.="," . $rst1["id"];
$rst1_query=mysql_query("Select * from astevirtuali_categorie where pid IN (" . $clist . ") and id not in ( ". $clist . ")") ;
}
$sql.=" and cid in (" . $clist . ") ";
}
//else
//{
//$clist="1";
//$sql.=" and cid=1 ";
//}
////////////////////////////////////////////
//$sql.= " order by endson desc" ;
if($type==9)
{
//$sql.= " order by featured desc, aucid, date_submitted desc" ;
$sql.= " order by featured desc" ;
}
else
{
//$sql.= " order by featured desc, aucid, pezzi desc, date_submitted " ;
$sql.= " order by pezzi desc" ;
}
$rs_query=mysql_query($sql);
///////////////////////////////////PAGINATION /////////
if($pg>=1)
{$scelta=1;}
elseif($_REQUEST['pg']>=1)
{
$pg=$_REQUEST["pg"];
$scelta=3;
$_SESSION["u_pagina"]=$pg ;
//header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
$pag=$_SESSION['u_pagina'];
}
elseif($_SESSION['u_pagina']>=1)
{
$pg=$_SESSION['u_pagina'];
$pag=$_SESSION['u_pagina'];
$scelta=2;
}
else
{
$pg=1;
$scelta=4;
$_SESSION["u_pagina"]=1 ;
//header('location: ' . $_SERVER['PHP_SELF'] . '?' . SID);
$pag=$_SESSION['u_pagina'];
}
////////////////////////////////FINE ///PAGINATION /////////
$rcount=mysql_num_rows($rs_query);
if ($rcount==0 )
{
$pages=0;
}
else
{
$pages=floor($rcount / $recperpage);
if (($rcount%$recperpage) > 0 )
{
$pages=$pages+1;
}
}
$jmpcnt=1;
while ( $jmpcnt<=($pg-1)*$recperpage && $row = mysql_fetch_array($rs_query) )
{
$jmpcnt = $jmpcnt + 1;
}
$label=1;
$featured_label=1;
?>
////////////////////////////////FINE ///categoria cid /////////
$_SESSION["visita"][$uid] =$cid; // sta visitando
$_SESSION["pagina"]="listata_merce"; // sta visitando
///////////////////////////////////////////////////////////////
?>
|
echo $_REQUEST["radio"]; ?> Home echo $catpath; ?>
if ($cid==630)
{?>
vendite tele limitata alle cf. in magazzino!
}
if (($cid>10) && ($descrizione<>""))
{?>
echo $descrizione; ?>
}
?>
|
|
if ($pages<1)
{
?>
|
echo " ";
}
else
{
?>
|
$cnt=0;
while (($rs0=mysql_fetch_array($rs_query)) && $cnt<$recperpage )
{
//$cur=mysql_fetch_array(mysql_query("select * from astevirtuali_valuta where id=".$config["cur_id"]));
if(($rs0["featured"]=="yes") && ($featured_label==1))
{
?>
Prodotti in Promozione |
|
Prezzo IVA Compresa |
$featured_label=0;
}// end if featured label
if(($rs0["featured"]=="no") && ($label==1))
{
if($featured_label==0)
{
?>
|
}?>
Pagina echo $_SESSION['u_pagina'] ?>/ |
|
Prezzo IVA Compresa |
$label=0;
}// end non featured label
?>
" >
$rs_t0=mysql_fetch_array(mysql_query("select * from astevirtuali_immagini where pid=".$rs0["id"]." group by pid"));
if($rs_t0)
{
?>
&uid= echo $uid;?>" class="biglink">
$largo=150;
$alto=110;
?>
switch($rs_t0["formato"])
{
case 1: $largo=150;$alto=110; break;
case 2: $largo=110;$alto=150; break;
case 3: $largo=130;$alto=130; break;
case 4: $largo=140;$alto=60; break;
}
?>
" alt="clicca su immagine per consultare dettagli, vedere altre foto e ordinare echo $rs0["product_name"];?>" title="clicca su immagine per consultare dettagli, vedere altre foto e ordinare echo $rs0["product_name"];?>" width= echo $largo ?> height= echo $alto ?> border="0">
} ?> |
" >
echo $rs0["product_subt"];?>
|
" >
" >
if ($rs0["tipo"]=="Mag.Principale")
{ echo "Nuovo !"; }
else
{ echo $rs0["tipo"]; }
?>
if ($rs0["soddisfatti"]==3)
{?> }
if ($rs0["soddisfatti"]==3.5)
{?> }
if ($rs0["soddisfatti"]==4)
{?> }
if ($rs0["soddisfatti"]==4.5)
{?> }
if ($rs0["soddisfatti"]==5)
{?> }
if ($rs0["soddisfatti"]==5.5)
{?> }
?>
if ($rs0["tempi"]<1)
{$ggm="4"; $ggp="6";}
else
{$ggm=$rs0["tempi"]-1; $ggp=$rs0["tempi"];}
if ($rs0["tempi"]<30)
{ ?>
Generalmente Spedito entro(**)
echo $ggm ."-" .$ggp;?>
// 1 pz-- calcolo spese trasporto presunte ----- //
if ((($rs0["peso"].value)<3) && (($rs0["peso"].value)>0.01))
{
$peso1=$rs0["peso"];
if ($peso1<=($rsu["peso_leg"].value))
{$costop1=$rsu["costospe_leg"]; }
else
{
if ($peso1<=20)
{$costop1=$rsu["costospe1"]; } else {$costop1=$rsu["costospe1"]*2; }
}
}
// fine 1 pz-- calcolo spese trasporto presunte ----- //
}
else
{}
?>
$asin=$rs0["codice"];
$cod_id= $rs0["id"];
if ($rs0["codice"]=='')
{ ?>
&uid= echo $uid;?>">Maggiori Descrizioni e Immagini Corrispondenze su " target="_blank" >Dalù ');" onmouseout="writetxt(0)">
}
else
{
if ($rs0["location"]==30)
{
?>
&uid= echo $uid;?>">Maggiori Descrizioni e Immagini Corrispondenze su " target="_blank" >eOk e su " target="_blank" >Amazon');" onmouseout="writetxt(0)">**
}
else
{ ?>
&uid= echo $uid;?>">Maggiori Descrizioni e Immagini Corrispondenze su " target="_blank" >eOk ');" onmouseout="writetxt(0)">*
}
}
?>
echo $rs0["raffina2"];?>
if($rs0["raffina2"]=="Marchio")
{ ?> echo $rs0["raffina3"]; ?> }
else
{ echo $rs0["raffina3"];}
?>
echo $rs0["raffina0"];?> echo $rs0["raffina1"];?>
echo $rs0["raffina4"];?> echo $rs0["raffina5"];?>
if($rs0["raffina"]<>'')
{ ?>
BarCode:
echo $rs0["raffina"]?> -
}
?>
if($rs0["codice"]<>'')
{ ?>
SKU:
echo $rs0["codice"]?> -
}
?>
Cod:
( echo $rs0["id"]?>)
|
" >
if ($rs0["pezzi"]==0)
{$colore="#FF0000"; }
else
{$colore="#006699"; }
if ($rs0["pezzi"]>0)
{
if (($rs0["tempi"]=="1 gg.")||($rs0["tempi"]=="2 gg.")||($rs0["tempi"]=="3 gg.")) {$colore="#009933"; }
if (($rs0["tempi"]=="5 gg.")||($rs0["tempi"]=="1 sett.")) {$colore="#0033FF"; }
if (($rs0["tempi"]=="2 sett.")||($rs0["tempi"]=="10 gg.")) {$colore="#009999"; }
if (($rs0["tempi"]=="1 mese") || ($rs0["tempi"]=="2 mesi")){$colore="#FF0000"; }
?>
Cf.Disp.
: echo $rs0["pezzi"];?>
} ?>
|
" >
$si = 0;
for ($ni = 0; $ni <= count($_SESSION['cart'.'art']); $ni++)
{
if ($_SESSION['cart'.'art'][$ni]==$rs0["id"] )
{
$si = 1;
}
}
if ($si==0)
{
if ($rs0["pezzi_sconto"]>=2 && $rs0["pezzi"]>=$rs0["pezzi_sconto"])
{
?>
if($rs0["sconto_mom"]>=1)
{
$sconto=$rs0["min_sconto"]*$rs0["sconto_mom"]/100;
$scontato=$rs0["min_sconto"]-$sconto;
}
else
{
$scontato=$rs0["min_sconto"];
}
?>
Prezzo su Conf. cad:
€. echo $scontato;?>
per Min. echo $rs0["pezzi_sconto"];?> pz.
&pz= echo $rs0["pezzi_sconto"] ?>" target="_self">
oppure
}
//$_SESSION['u_pagina']=$pg;
if ($cid==0)
{
if ($rs0["pezzi"]==0)
if ($rs0["tempi"]=="2 Mesi")
{ ?> Non sappiamo Quando sarà daccapo disponibile }
else
{echo "- in arrivo -"; }
else
{
if ($rs0["pezzi"]<0)
{?> &pz=1"> }
else
{?> &pz=1"> }
}
//echo "listata_merce.php?uid=" . $uid . "&pg=" . $pg . "&buy=" . $rs0["id"]. "&pz=1"
}
else
{
if ($rs0["pezzi"]==0)
if ($rs0["tempi"]=="2 Mesi")
{ ?> - Non sappiamo Quando sara' daccapo disponibile - }
else
{echo "- in arrivo -"; }
else
{
if ($rs0["pezzi"]<=0)
{?> &pz=1"> }
else
{?> &pz=1"> }
}
}
}
else
{
?>
Nel Carrello
} ?>
if ($rs0["pezzi"]<=0)
{
// -------- listino 1 -------
include "consiglio1.php";
}
else
{
// -------- listino 1 -------
include "listino1.php";
}
?>
|
$cnt=$cnt+1;
}//while
$cnt=0;
?>
}// else
?>
|
|
// echo "L:" . $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>
|
if ($pages>1)
{
?>
|
|
|
}
?>
}// end main
?>
include_once "tools5.php";
?>