1 ORDER BY product_cat.ordre"; $res = $conn->real_query($sql); $res = $conn->use_result(); if(!empty($res)){ while ($row = $res->fetch_assoc()) { if($row['friendlyurl']==$_REQUEST["cat"]){$buffstrong=" strong";$currentcat=$row['ID'];}else{$buffstrong="";} $buffcat = $buffcat . '
' .$row["titre"]. '
'; } } unset($res); unset($result); ########################################### # LIST MANUFACTURER ########################################### $sql = "SELECT DISTINCT manufacturer FROM product WHERE LENGTH(manufacturer)>2 AND showitem=1 AND ID>1 ORDER BY manufacturer"; $res = $conn->real_query($sql); $res = $conn->use_result(); if(!empty($res)){ while ($row = $res->fetch_assoc()) { if($row['manufacturer']==$_REQUEST["manufacturer"]){$buffstrong=" strong";$currentmanufacturer=$row['manufacturer'];}else{$buffstrong="";} $buffmanufacturer = $buffmanufacturer . '
' .$row["manufacturer"]. '
'; } } unset($res); unset($result); ########################################### # LIST PRODUCTS ########################################### $nbproduct=0; if(!empty($currentcat)){#SEARCH CATEGORIES $sql = "SELECT * FROM product WHERE ID>1 AND showitem=1 AND idcategorie=" .$currentcat. " ORDER BY promotion DESC, newproduct DESC,showhomepage DESC, datecreated DESC, ID DESC"; #GET CATEGORY DESCRIPTION $sql2= 'SELECT description FROM product_cat WHERE ID=' .$currentcat; $res2=$conn->query($sql2); $row2 = $res2->fetch_assoc(); $catdescription=$row2["description"]; #UPDATE COUNTER if($_SESSION['product_cat']!=$currentcat){ $sql2= 'UPDATE product_cat SET nbvisits=nbvisits+1 WHERE ID=' .$currentcat; if ($conn->query($sql2) !== TRUE) { aff("ERROR:" .$sql2); echo "Error: " . $conn->error; die(); } } $_SESSION['product_cat']=$currentcat; }elseif(!empty($currentmanufacturer)){#SEARCH MANUFACTURER $sql = "SELECT * FROM product WHERE ID>1 AND showitem=1 AND manufacturer='" .$currentmanufacturer. "' ORDER BY promotion DESC, newproduct DESC,showhomepage DESC, datecreated DESC, ID DESC"; }elseif(!empty($_REQUEST['search'])){#SEARCH KEYWORD #SAVE KEYWORD if($_SESSION['keyword']!=$_REQUEST['search']){ $sql = "SELECT ID FROM searchstats WHERE word='" .$_REQUEST['search']. "'"; $res=$conn->query($sql); $row = $res->fetch_assoc(); $IDsearchstats=$row["ID"]; if(empty($IDsearchstats)){ $sql2 = 'INSERT INTO searchstats(word,nbsearch) VALUES("' .$_REQUEST['search']. '",0)'; }else{ $sql2= 'UPDATE searchstats SET nbsearch=nbsearch+1 WHERE ID=' .$IDsearchstats; } if ($conn->query($sql2) !== TRUE) { aff("ERROR:" .$sql2); echo "Error: " . $conn->error; die(); } unset($res); $_SESSION['keyword']=$_REQUEST['search']; } $sql = "SELECT * FROM product WHERE ID>1 AND showitem=1 AND (titre LIKE '%" .$_REQUEST['search']. "%' OR description LIKE '%" .$_REQUEST['search']. "%' OR manufacturer LIKE '%" .$_REQUEST['search']. "%') ORDER BY promotion DESC,newproduct DESC, showhomepage DESC, datecreated DESC, ID DESC"; $ResultTitle = 'Result for "' .$_REQUEST['search']. '"

'; }else{#DEFAULT HOME PAGE (NEW, THEN PROMOTION, THEN SHOW ON HOME PAGE, THEN NEWEST $sql = "SELECT valeur FROM variables WHERE ID=2"; $res=$conn->query($sql); $row = $res->fetch_assoc(); $nbitemshomepage=$row["valeur"]; unset($res); $sql = "SELECT * FROM product WHERE ID>1 AND showitem=1 ORDER BY promotion DESC,newproduct DESC, showhomepage DESC, datecreated DESC, ID DESC LIMIT ".$nbitemshomepage; } $res=$conn->query($sql); if(!empty($res)){ while ($row = $res->fetch_assoc()) { #IMAGE $sql2="SELECT * FROM product_img WHERE productid=" .$row["ID"]. " ORDER BY ordre LIMIT 1"; $res2=$conn->query($sql2); $row2 = $res2->fetch_assoc(); if(file_exists($path . $row2["filename"]) && !empty($row2["filename"])){ $buffshowimage = "products/tn/" .$row2["filename"]; }else{ $buffshowimage = "no_image_available.jpg"; } unset($res2); #PRICE if($row['price']>0 && $row['specialprice']>0 ){ $buffprice='Price: $' .$row['specialprice']. '
'; }elseif($row['price']>0){ $buffprice='Price: $' .$row['price']. '
'; }else{ $buffprice=" 
"; } #NEW ITEM $newitem=''; if($row['newproduct']==1){ $newitem='
New Item!
'; } #PROMOTION $promotion=''; if($row['promotion']==1){ $promotion='
In Promotion!
'; } //OLD $buffproduct = $buffproduct . '
' .$row["titre"]. '
' .$row[' .$buffprice. '
More Info
'; $buffproduct = $buffproduct . '
' .$promotion.$newitem. '
' .$row["titre"]. '
' .$row[
' .$buffprice. '
More Info
'; $nbproduct+=1; } } unset($res); if($nbproduct==0 && !empty($_REQUEST['search'])){ #IF NO SEARCH RESULT, SHOW SAME LIST AS HOMEPAGE $buffproduct .= "
Sorry with didn't find anything containing " . $_REQUEST['search']. ". Maybe you would be interested in these items.


"; #NB ITEM TO SHOW $sql = "SELECT valeur FROM variables WHERE ID=2"; $res=$conn->query($sql); $row = $res->fetch_assoc(); $nbitemshomepage=(int)$row["valeur"]/2; unset($res); $sql = "SELECT * FROM product WHERE ID>1 AND showitem=1 ORDER BY promotion DESC,newproduct DESC, showhomepage DESC, datecreated DESC, ID DESC LIMIT ".$nbitemshomepage; $res=$conn->query($sql); if(!empty($res)){ while ($row = $res->fetch_assoc()) { #IMAGE $sql2="SELECT * FROM product_img WHERE productid=" .$row["ID"]. " ORDER BY ordre LIMIT 1"; $res2=$conn->query($sql2); $row2 = $res2->fetch_assoc(); if(file_exists($path . $row2["filename"]) && !empty($row2["filename"])){ $buffshowimage = "products/tn/" .$row2["filename"]; }else{ $buffshowimage = "no_image_available.jpg"; } unset($res2); #PRICE if($row['price']>0 && $row['specialprice']>0 ){ $buffprice='Price: $' .$row['specialprice']. '
'; }elseif($row['price']>0){ $buffprice='Price: $' .$row['price']. '
'; }else{ $buffprice=" 
"; } #NEW ITEM $newitem=''; if($row['newproduct']==1){ $newitem='
New Item!
'; } #PROMOTION $promotion=''; if($row['promotion']==1){ $promotion='
In Promotion!
'; } //OLD $buffproduct = $buffproduct . '
' .$row["titre"]. '
' .$row[' .$buffprice. '
More Info
'; $buffproduct = $buffproduct . '
' .$promotion.$newitem. '
' .$row["titre"]. '
' .$row[
' .$buffprice. '
More Info
'; } } unset($res); } $conn->close(); ?>

Search


Categories

Categories


Manufacturers

Manufacturers


Newsletter

Sign up to our monthly newsletter to get updates on new equipment offerings

Sign up