=$coup_from) && ($toda<=$coup_to)) { $goodcoupon = stripslashes($row["cou_coupcode"]); $defcoup = $goodcoupon; $coup_desc = stripslashes($row2["ec_description"]); $coup_freepost = $row2["ec_freepostage"]; $coup_minspend = $row2["ec_min_spend"]; $coup_discountperc = $row2["ec_discountperc"]; $coup_includedbrands = stripslashes($row2["ec_includedbrands"]); $coup_excludedbrands = stripslashes($row2["ec_excludedbrands"]); } } } if ($nooflines > 0) { $qualifyingspend = 0; // this is to calculate money for products which are allowed! while($rowlines = mysqli_fetch_array($reslines)) { $li_ref = $rowlines["scl_auto"]; $li_prodid = $rowlines["scl_prodid"]; $li_qty = $rowlines["scl_qty"]; // see if we are on a spare part? if($li_prodid>0) { $sparepart = checksparepart($li_prodid); } // pick up and check product details $sqlp = "SELECT * FROM shopprods WHERE pr_prodref = $li_prodid"; $resp = query_db($sqlp); if($rowp = mysqli_fetch_array($resp)) { $prodname = stripslashes($rowp["pr_name"]); $productbrand = ucfirst(strtolower(stripslashes($rowp["pr_brand"]))); $li_price = $rowp["pr_price"]; $li_vat = $rowp["pr_vat"]; $toda = date("Y-m-d"); $onsale = $rowp["pr_onsale"]; // Y/N/D $salestart = $rowp["pr_salestart"]; $saleend = $rowp["pr_saleend"]; $saleprice = $rowp["pr_saleprice"]; $prodonsale = false; if(($onsale=='Y') || (($onsale=='D') && (((strlen($salestart)<1) || ($salestart<=$toda) ) && ((strlen($saleend)<10) || ($saleend>=$toda))))) { $li_price = $saleprice; // override price if on sale $prodonsale = true; } if($dovat) { $newprice = getprice($li_price, $li_vat); } else { $newprice = $li_price; } $linepriceinc = $li_qty * $newprice; $linepriceex = $li_qty * $li_price; $totalpriceinc += $linepriceinc; $totalpriceex += $linepriceex; $incbrandok = true; if(strlen($coup_includedbrands)>0) { $incbrandok = false; $incarr = explode(',', $coup_includedbrands); $x = 0; while(($x0) { $excarr = explode(',', $coup_excludedbrands); $x = 0; while(($x0) { if($totalpriceinc>0.0) { if($dovat) { if(strlen($defcoup) == 10) { if($totalpriceinc>=$coup_minspend) { if($coup_discountperc>0) { $saving = $qualifyingspend * $coup_discountperc / 100; $finalpayable = $totalpriceinc - $saving; //echo '[inc Finalpayable '.$finalpayable.']'; } } } else { // no coupon $finalpayable = $totalpriceinc; //echo '[incnc Finalpayable '.$finalpayable.']'; } } else { if(strlen($defcoup) == 10) { if($totalpriceex>=$coup_minspend) { if($coup_discountperc>0) { $saving = $qualifyingspend * $coup_discountperc / 100; $finalpayable = $totalpriceex - $saving; //echo '[exc Finalpayable '.$finalpayable.']'; } } } else { // no coupon $finalpayable = $totalpriceex; //echo '[exnc Finalpayable '.$finalpayable.']'; } } } } //echo '

Returning '.$finalpayable.'

'; return $finalpayable; } function subscribemessage2( ) { return 'Subscribe to our Newsletter'; } function showavailability ($prodid, $newline) { // if size and/or colour variants, show availability $retval = ''; $sqlvar = "SELECT * FROM shopprodvariant WHERE pv_prodref = $prodid ORDER BY pv_colour, pv_variantid"; $resvar = query_db($sqlvar); $noofvar = mysqli_num_rows($resvar); $rowvar = mysqli_fetch_array($resvar); $sizeid = $rowvar["pv_size"]; $colourid = $rowvar["pv_colour"]; $colour = getproperty($colourid); $oldcolour = 'xxx'; $resvar = query_db($sqlvar); // back to start if(($sizeid>0) && ($colourid>0)) { // show size & colour availability situation $lineout = ''; $oldcolour = 'xxx'; while($rowvar = mysqli_fetch_array($resvar)) { $colourid = $rowvar["pv_colour"]; $colour = getproperty($colourid); $sizeid = $rowvar["pv_size"]; $size = getproperty($sizeid); $avail = stripslashes($rowvar["pv_available"]); // y,n if($oldcolour == 'xxx') { // start a line with a colour $oldcolour = $colour; $lineout = $colour.': '; } if($colour == $oldcolour) { // just add size with availability if($avail == 'y') { if(strlen($lineout) > (strlen($colour) + 2)) { $lineout .= ', '; } $lineout .= $size; } } else { //colour changing $retval .= $lineout.$newline; $lineout = $colour.': '; $oldcolour = $colour; if($avail == 'y') { if(strlen($lineout) > (strlen($colour) + 2)) { $lineout .= ', '; } $lineout .= $size; } } } // now output final line $retval .= $lineout; } elseif(($sizeid>0) || ($colourid>0)) { // show availability for whatever it is $lineout = ''; if($sizeid>0) { $sqlvar = "SELECT * FROM shopprodvariant WHERE pv_prodref = $prodid ORDER BY pv_size, pv_variantid"; $lineout = 'Sizes: '; } else { $sqlvar = "SELECT * FROM shopprodvariant WHERE pv_prodref = $prodid ORDER BY pv_colour, pv_variantid"; $lineout = 'Colours: '; } $resvar = query_db($sqlvar); $noofvar = mysqli_num_rows($resvar); $rowvar = mysqli_fetch_array($resvar); $sizeid = $rowvar["pv_size"]; $colourid = $rowvar["pv_colour"]; $colour = getproperty($colourid); $oldprop = 'xxx'; $resvar = query_db($sqlvar); // back to start while($rowvar = mysqli_fetch_array($resvar)) { if($sizeid>0) { $propid = $rowvar["pv_size"]; } else { $propid = $rowvar["pv_colour"]; } $proptext = getproperty($propid); $avail = stripslashes($rowvar["pv_available"]); // y,n $firstprop = true; if($oldprop == 'xxx') { // start a line $oldprop = $proptext; //$lineout = ''; } else { if($oldprop!='xxx') { $lineout .= ', '; } } if($proptext == $oldprop) { // just add property with availability if($avail == 'y') { $lineout .= $proptext; } } else { //property changing $oldprop = $proptext; if($avail == 'y') { $lineout .= $proptext; } } } // now output final line $retval .= $lineout; } if(strlen($retval) == 0) { return 'Yes'.$newline; } else { return $retval.$newline; } } function postmessage2( ) { $retval = ''; $suff = " AND sd_country<2"; //echo ''; //echo '
'; //echo 'Fast delivery'; $holname = ''; $holgreet = ''; $holbank = ''; $dasql = date("Y-m-d"); $dano = date("w"); // 0 sunday to 6 saturday $showday = date("l"); // eg Thursday $showtime = date("g:i a"); // eg 11:14 am $usehour = date("G"); // 0 - 23 $useday = date("j"); // 1..31 $usemonth = date("m"); $useyear = date("Y"); // is today a bank holiday? $sql = "SELECT * FROM shopdays WHERE sd_date='$dasql'".$suff; $res = query_db($sql); $bankhol = false; if($row = mysqli_fetch_array($res)) { $holname = stripslashes($row["sd_name"]); $holgreet = stripslashes($row["sd_greeting"]); $holbank = $row["sd_bankhol"]; if($holbank == 'Y') { $bankhol = true; } $holcountry = $row["sd_bankhol"]; echo ''.$holgreet.'
'; } $deliveryadd = 0; $skipmes = ''; while(($usehour>=15) || ($dano==0) || ($dano==6) || $bankhol) { // evaluate next day $usehour = 0; // not needed now $deliveryadd++; $targetdespatch = mktime(0,0,0,$usemonth,$useday+$deliveryadd,$useyear); // evaluate that day $dano = date("w", $targetdespatch); // 0 sunday to 6 saturday $dasql = date("Y-m-d", $targetdespatch); $sql = "SELECT * FROM shopdays WHERE sd_date='$dasql'".$suff; //echo $sql; $res = query_db($sql); $bankhol = false; if($row = mysqli_fetch_array($res)) { $holname = stripslashes($row["sd_name"]); $holgreet = stripslashes($row["sd_greeting"]); $holbank = $row["sd_bankhol"]; if($holbank == 'Y') { $bankhol = true; } $holcountry = $row["sd_bankhol"]; if($bankhol) { $skipmes .= ' ('.date("l",$targetdespatch).' is '.$holname.')'; } } } if($deliveryadd==0) { $clever = 'TODAY'; } else { $clever = 'on '.date("l", $targetdespatch); } //echo 'DELIVERY: Items ordered now ('.$showday.' '.$showtime.') will normally be despatched '.$clever.$skipmes; // now find arrival day $arrivaladd = $deliveryadd + 1; $skipmes2 = ''; $targetarrival = mktime(0,0,0,$usemonth,$useday+$arrivaladd,$useyear); $dano = date("w", $targetarrival); // 0 sunday to 6 saturday $dasql = date("Y-m-d", $targetarrival); $sql = "SELECT * FROM shopdays WHERE sd_date='$dasql'".$suff; $res = query_db($sql); $bankhol = false; if($row = mysqli_fetch_array($res)) { $holname = stripslashes($row["sd_name"]); $holgreet = stripslashes($row["sd_greeting"]); $holbank = $row["sd_bankhol"]; if($holbank == 'Y') { $bankhol = true; } $holcountry = $row["sd_bankhol"]; if($bankhol) { $skipmes2 .= ' ('.date("l",$targetarrival).' is '.$holname.')'; } } while(($dano==0) || $bankhol) { // evaluate next day $usehour = 0; // not needed now $arrivaladd++; $targetarrival = mktime(0,0,0,$usemonth,$useday+$arrivaladd,$useyear); // evaluate that day $dano = date("w", $targetarrival); // 0 sunday to 6 saturday $dasql = date("Y-m-d", $targetarrival); $sql = "SELECT * FROM shopdays WHERE sd_date='$dasql'".$suff; $res = query_db($sql); $bankhol = false; if($row = mysqli_fetch_array($res)) { $holname = stripslashes($row["sd_name"]); $holgreet = stripslashes($row["sd_greeting"]); $holbank = $row["sd_bankhol"]; if($holbank == 'Y') { $bankhol = true; } $holcountry = $row["sd_bankhol"]; if($bankhol) { $skipmes2 .= ' ('.date("l",$targetarrival).' is '.$holname.')'; } } } $showarrival = date("l",$targetarrival); $sextra = ''; if($showarrival == 'Saturday') { $sextra = ' (if you receive Royal Mail deliveries on Saturday)'; } //echo '
UK deliveries will cost �4.95 and usually arrive on '.$showarrival.$skipmes2.$sextra; if ($deliveryadd == 0) { //echo ' Place your order before 3pm for despatch today!'; $deadline = mktime("15", "00", "00", date("n"), date("j"), date("Y")); $now = time(); $diffmins = 0; $diffhours = 0; $lessmins = 0; if($now<$deadline) { $diffmins = round(round($deadline-$now) / 60, 0, PHP_ROUND_HALF_DOWN); //echo '

START MINS '.$diffmins.'

'; if($diffmins >= 60) { $diffhours = floor($diffmins / 60); //echo '

HOURS '.$diffhours.'

'; $lessmins = $diffmins - ($diffhours*60); //echo '

MINS '.$lessmins.'

'; } $retval = '
Order in next '; if($diffhours>0) { if($diffhours>1) { $plh = 's'; } else { $plh = ''; } $retval .= $diffhours.' hour'.$plh; } if($lessmins>0) { if($diffhours>0) { $retval .= ' and '; } if($lessmins>1) { $plm = 's'; } else { $plm = ''; } $retval .= $lessmins.' minute'.$plm; } if(($deliveryadd==0) && (($diffhours>0) || ($lessmins>0))) { $retval .= ' for despatch today.
'; } else { $retval = ''; } //echo '

['.$retval.']

'; } } $toda = date("Y-m-d"); if($toda == '2011-12-23') { //echo '
Deliveries are no longer guaranteed before Christmas'; } // echo '
'; return $retval; } ensurecanon (''); // just '' for home page $searchquery = ''; if(isset($_POST["fsearchsub"])) { if(isset($_POST["fsearchquery"])) { $searchquery = addslashes(strip_tags(stripslashes($_POST["fsearchquery"]))); } } // Possible cart update if(isset($_POST["flineup"])) { $limes = 'Error changing quantity'; $testnewqty = $_POST["fnewqty"]; if (is_numeric($testnewqty)) { if(($testnewqty>0) && ($testnewqty<100)) { $myline = $_POST["flineref"]; if(is_numeric($myline)) { $sqlup = "UPDATE shopcartlines SET scl_qty=$testnewqty WHERE scl_auto=$myline"; if($resup = query_db($sqlup)) { $limes = 'Quantity changed'; } } } } } // Possible cart line delete if(isset($_POST["fremline"])) { $remlimes = 'Error Removing Product'; $myline = $_POST["flineref"]; if(is_numeric($myline)) { $sqlup = "DELETE FROM shopcartlines WHERE scl_auto=$myline"; if($resup = query_db($sqlup)) { $remlimes = 'Product Removed'; $sqlup = "DELETE FROM shopcartlinedetail WHERE scld_lineref = $myline"; $resup = query_db($sqlup); } } } function login_member( $email, $pass ) { $mData = array(); $sql = 'SELECT * FROM shopregister WHERE sr_email = "'.$email.'" AND MD5(sr_password) = "'.md5($pass).'" LIMIT 1'; $result = query_db( $sql ) or die ('ERROR COM.MEM.200' ); if( $result != false ) { while( $data = mysqli_fetch_assoc( $result ) ) { $mData = $data; } mysqli_free_result( $result ); //if( isset( $mData['sr_auto'] ) ) //{ //log visit // $sql = "UPDATE shopregister SET sr_confirmed = 'Y', sr_noofvisits = (sr_noofvisits + 1), sr_lastvisit = NOW() WHERE sr_auto = ".$mData['sr_auto']; // $result = query_db( $sql ) or die ('ERROR COM.MEM.201' ); //set validated flag // $mData['validated'] = true; //} } return $mData; } require_once('members/system/shopstarti.php'); //This sets up $linkappends and other things function getproperty($propid) { $result = ''; $sql = "SELECT * FROM shopprodproperties WHERE pp_propertyid = $propid LIMIT 1"; if( ($res = query_db($sql)) && ($row = mysqli_fetch_array($res)) ) { $result = stripslashes($row["pp_text"]); } return $result; } function Resize($Dir,$Image,$NewDir,$NewImage,$MaxWidth,$MaxHeight,$Quality) { list($ImageWidth,$ImageHeight,$TypeCode)=getimagesize($Dir.$Image); $ImageType=($TypeCode==1?"gif":($TypeCode==2?"jpeg":FALSE)); $CreateFunction="imagecreatefrom".$ImageType; $OutputFunction="image".$ImageType; if ($ImageType) { $Ratio=($ImageHeight/$ImageWidth); $ImageSource=$CreateFunction($Dir.$Image); if ($ImageWidth > $MaxWidth || $ImageHeight > $MaxHeight) { if ($ImageWidth > $MaxWidth) { $ResizedWidth=$MaxWidth; $ResizedHeight=$ResizedWidth*$Ratio; } else { $ResizedWidth=$ImageWidth; $ResizedHeight=$ImageHeight; } if ($ResizedHeight > $MaxHeight) { $ResizedHeight=$MaxHeight; $ResizedWidth=$ResizedHeight/$Ratio; } $ResizedImage=imagecreatetruecolor($ResizedWidth,$ResizedHeight); imagecopyresampled($ResizedImage,$ImageSource,0,0,0,0,$ResizedWidth, $ResizedHeight,$ImageWidth,$ImageHeight); } else { $ResizedWidth=$ImageWidth; $ResizedHeight=$ImageHeight; $ResizedImage=$ImageSource; } if($OutputFunction($ResizedImage,$NewDir.$NewImage,$Quality)) { return true; } else { return false; } } else return false; } function topcat( $anycat ) { $found = false; if(($anycat==1764) || ($anycat==2779) || ($anycat==1677) || ($anycat==5) || ($anycat==1638)) { $found = true; } $parcat = $anycat; $looplim = 15; while (($parcat>0) && ($found==false) && ($looplim>0)) { $looplim--; $sql = "SELECT * FROM shopcats WHERE sc_catref=$anycat"; $res = query_db($sql); $row = mysqli_fetch_array($res); if(($anycat==1764) || ($anycat==2779) || ($anycat==1677) || ($anycat==5) || ($anycat==1638)) { $found = true; } $parcat = $row["sc_parentcat"]; if($parcat>0) { $anycat = $parcat; } } return $found; } $newcoupmsg2 = ''; // get from cookie if(( !isset( $_SESSION['order']['vid'] ) ) || ($myvid < 1)) { if(isset($_COOKIE)) { if(isset($_COOKIE["vid"])) { $cookievid = $_COOKIE["vid"]; if($cookievid>0) // otherwise, could get stuck in loop loading this page! { // check this is a good value - maybe I deleted this record! if(checkvid($cookievid)) { $myvid = $cookievid; $_SESSION['order']['vid'] = $myvid; $usevid = usevid($myvid); // now - check for discount code on url if(isset($_GET["dcod"])) { $dcode = addslashes(strip_tags(stripslashes($_GET["dcod"]))); // Is there already a discount code? $sqldc = "SELECT * FROM shopcheckoutcoupon WHERE cou_vid=$usevid"; $resdc = query_db($sqldc); if(mysqli_num_rows($resdc)>0) { // replace with new $sqldc = "UPDATE shopcheckoutcoupon SET cou_coupcode='$dcode' WHERE cou_vid=$usevid"; if($resdc = query_db($sqldc)) { $newcoupmsg2 = 'Coupon code replaced'; } else { $newcoupmsg2 = 'Coupon code replace failed'; } } else { $sqldc = "INSERT INTO shopcheckoutcoupon (cou_vid, cou_coupcode) VALUES ($usevid, '$dcode')"; if ($resdc = query_db($sqldc)) { $newcoupmsg2 = 'New Coupon code added'; } else { $newcoupmsg2 = 'Failed to add coup code'; } } } // Reload page $pself = 'https://www.saddler.co.uk'; header ("Location: ".$pself.$linkappends); exit; } } } } } $newcoupmsg = ''; if($myvid == 0) { $myrand = rand(1,32000) * rand(1,32000); $numuse = str_pad($myrand, 10, "0", STR_PAD_LEFT); $sqlvid = "INSERT INTO shopcartvisitor (ca_started, ca_unique, ca_lastupdate, ca_status) VALUES (NOW(), $myrand, NOW(), 'BROWSE')"; if($resvid = query_db($sqlvid)) { $usevid = mysqli_insert_id($sys_dbconnection); $myvid = $usevid.$numuse; $_SESSION['order']['vid'] = $myvid; setcookie("vid", $myvid, time()+(90*86400), '/'); // 90 days cookie (set if possible) // now - check for discount code on url if(isset($_GET["dcod"])) { $dcode = addslashes(strip_tags(stripslashes($_GET["dcod"]))); // brand new vid - so simply insert! $sqldc = "INSERT INTO shopcheckoutcoupon (cou_vid, cou_coupcode) VALUES ($usevid, '$dcode')"; if($resdc = query_db($sqldc)) { $newcoupmsg = 'You have a new coupon code'; } else { $newcoupmsg = 'New coupon failed'; } } } } if(isset($_POST["closeorder"])) { Session_Unset(); Session_Destroy(); //setcookie("vid", FALSE, mktime()-3000, '/'); header('location: https://www.saddler.co.uk'); exit; } if(isset($_POST) && isset($_POST["fsubcoup"])) { $trycoup = stripslashes(strip_tags($_POST["fcoupcode"])); // is this valid? if(strlen($trycoup) <11) { //echo '

Trying update of ['.$trycoup.'] against '.$usevid.'

'; $dbcoup = addslashes($trycoup); $sqlcc = "SELECT * FROM ecoupon WHERE ec_code='$dbcoup'"; $rescc = query_db($sqlcc); if($rowcc = mysqli_fetch_array($rescc)) { //echo '

Got coupon

'; // check it is a valid current coupon $coup_from = $rowcc["ec_datefrom"]; $coup_to = $rowcc["ec_dateto"]; $cfrom = strtotime($coup_from); $cto = strtotime($coup_to); $show_cfrom = date("d/m/Y", $cfrom); $show_cto = date("d/m/Y", $cto); $toda = date("Y-m-d"); if(($toda>=$coup_from) && ($toda<=$coup_to)) { //echo '

In date

'; $defcoup = $trycoup; // We have a current coupon. Post or update to use it. $sqlcc = "SELECT * FROM shopcheckoutcoupon WHERE cou_vid=$usevid"; if(!($rescc = query_db($sqlcc))) { $rescc = db_query($sqlcc, 'Error checking for current coupon'); } if($rowcc = mysqli_fetch_array($rescc)) { // update it $sqlcc = "UPDATE shopcheckoutcoupon SET cou_coupcode='$dbcoup' WHERE cou_vid=$usevid LIMIT 1"; if(!($rescc = query_db($sqlcc))) { $rescc = db_query($sqlcc, 'Error updating current coupon'); } } else { // insert it $sqlcc = "INSERT INTO shopcheckoutcoupon (cou_vid, cou_coupcode) VALUES ($usevid, '$dbcoup')"; if(!($rescc = query_db($sqlcc))) { $rescc = db_query($sqlcc, 'Error inserting current coupon'); } } } else { echo '

Coupon '.$trycoup.' is not in date.

'; //echo '

Coupon not in date toda ['.$toda.'] coup from '.$coup_from.' coup from ['.$coup_to.']

'; } } else { echo '

Could not find that coupon.

'; } } } if((isset($_POST["fbuy"])) || (isset($_POST["fbuy2"]))) { $bprodid = $_POST["fprodid"]; $bqty = $_POST["fqty"]; $busevid = usevid($myvid); // upddate status to "cart" $sqlsts = "UPDATE shopcartvisitor SET ca_lastupdate=NOW(), ca_status='CART' WHERE ca_visit=$busevid"; $ressts = query_db($sqlsts); // Limit cart lines to 20 (10 till tested) after something added 8,825 scarf lines on 15/9/17 $sqlcheckmax = "SELECT * FROM shopcartlines WHERE scl_visit=$busevid"; $rescheckmax = query_db($sqlcheckmax); $noofcartlines = mysqli_num_rows($rescheckmax); if ($noofcartlines < 20) { // upddate status to "cart" $sqlsts = "UPDATE shopcartvisitor SET ca_lastupdate=NOW(), ca_status='CART' WHERE ca_visit=$busevid"; $ressts = query_db($sqlsts); $sqlbuy = "INSERT INTO shopcartlines (scl_visit, scl_prodid, scl_qty)"; $sqlbuy .= " VALUES ($busevid, $bprodid, $bqty)"; if(isset($_POST["frelprod"])) { // add related extra products $rela = $_POST["frelprod"]; for($x=0; $x<=count($rela); $x++) { $xprod = $rela[$x]; $sqlbuyrel = "INSERT INTO shopcartlines (scl_visit, scl_prodid, scl_qty)"; $sqlbuyrel .= " VALUES ($busevid, $xprod, $bqty)"; $resbuyrel = query_db($sqlbuyrel); } } // Reload page $pself = 'https://www.saddler.co.uk'; if($resbuy = query_db($sqlbuy)) { $lineref = mysqli_insert_id($sys_dbconnection); $ptypea = $_POST["propertytype"]; $pvaluea = $_POST["propertyvalue"]; for($x=0; $x0) { $speclink = $linkappends.'&pad=y'; } else { $speclink = '?pad=y'; } header ("Location: ".$pself.$speclink); exit; } else { if(strlen($linkappends)>0) { $speclink = $linkappends.'&pad=n'; } else { $speclink = '?pad=n'; } header ("Location: ".$pself.$speclink); exit; } } else { if(strlen($linkappends)>0) { $speclink = $linkappends.'&pad=n'; } else { $speclink = '?pad=n'; } header ("Location: ".$pself.$speclink); exit; } } ?> 0) { // if hidden then redirect away. $sqlmet = "SELECT * FROM shopprods WHERE pr_prodref=$inprodref"; $resmet = query_db($sqlmet); $rowmet = mysqli_fetch_array($resmet); $myavail = $rowmet["pr_available"]; // Y/N/H if($myavail == 'H') { // redirect away as hidden // try going to category page if ok, or loop up looking for a home, or home page. if($parcat>0) { // is the category live? $trycat = $parcat; $loop = 0; // worse case scenario infinite loop if badly set up, so count searches $sqlc = "SELECT * FROM shopcats WHERE sc_catref=$parcat LIMIT 1"; $resc = query_db($sqlc); $clive = 'N'; while(($clive == 'N') && ($loop<15) && ($trycat>0)) { $loop++; if($rowc = mysqli_fetch_array($resc)) { $clive = $rowc["sc_catlive"]; $parentcat = $rowc["sc_parentcat"]; if($clive == 'N') { $trycat = $parentcat; if($trycat>0) { // get one higher $sqlc = "SELECT * FROM shopcats WHERE sc_catref=$trycat LIMIT 1"; $resc = query_db($sqlc); } } } } // out of loop if(($trycat>0) && ($loop<=15) && ($clive=='Y')) { header( "HTTP/1.1 301 Moved Permanently" ); header('location: https://www.saddler.co.uk/?cr='.$trycat); exit; } else { header( "HTTP/1.1 301 Moved Permanently" ); header('location: https://www.saddler.co.uk'); exit; } } else { header( "HTTP/1.1 301 Moved Permanently" ); header('location: https://www.saddler.co.uk'); exit; } } $sqlmet = "SELECT * FROM shopprods WHERE pr_prodref=$inprodref"; $resmet = query_db($sqlmet); $rowmet = mysqli_fetch_array($resmet); $mytitle = stripslashes($rowmet["pr_name"]); if(stripos("xx".$mytitle,'cox the saddler')<1) { $mytitle .= ' at Cox the Saddler'; } $mydesc = stripslashes($rowmet["pr_shortdesc"]); $mykeys = stripslashes($rowmet["pr_keywords"]); echo ''.$mytitle.''."\n"; echo ''."\n"; //echo ''."\n"; } else { if($parcat>0) { if($parcat==999999) { // redirect!!!!! we do not want to show sale any more header( "HTTP/1.1 301 Moved Permanently" ); header('location: https://www.saddler.co.uk'); exit; echo 'Special offers, Sale items and promotions at Cox the Saddler'."\n"; echo ''."\n"; //echo ''."\n"; } else { $sqlmet = "SELECT * FROM shopcats WHERE sc_catref=$parcat"; $resmet = query_db($sqlmet); $rowmet = mysqli_fetch_array($resmet); $mytitle = stripslashes($rowmet["sc_name"]); if(stripos("xx".$mytitle,'cox the saddler')<1) { $mytitle .= ' at Cox the Saddler'; } $mydesc = stripslashes($rowmet["sc_catdesc"]); if(strlen($mydesc)<1) { $mydesc = $mytitle; } $mykeys = stripslashes($rowmet["sc_keywords"]); echo ''.$mytitle.''."\n"; echo ''."\n"; //echo ''."\n"; } } else { echo 'Cox the Saddler Shop'."\n"; echo ''."\n"; //echo ''."\n"; } } echo ''; echo ''; ?> '; // top section echo '
'; if(!($parcat==999999)) // Note: NOT 999999....we no longer have a sale section { echo '
'; breadcrumbshop2( $parcat, $inprodref, $myvid ); echo '
'; } echo '
'; // show categories, if we are not showing a product if($inprodref == 0) { $sql = "SELECT * FROM shopcats WHERE sc_parentcat = $parcat AND sc_catlive='Y' ORDER BY sc_catseq"; $result = query_db($sql); $col = 0; $maxcols = 3; $colperc = round(1/$maxcols*100); while($row = mysqli_fetch_array($result)) { $col++; if ($col<$maxcols) { $useperc = ' width="'.$colperc.'%"'; } else { $useperc = ''; } //if($col == 1) { echo ''; } else { echo ''; } echo '
'; $catref = $row["sc_catref"]; $catname = stripslashes($row["sc_name"]); $linkcat = jemurl($catname); $catdesc = nl2br(stripslashes($row["sc_catdesc"])); // possible image for cat $sqlcati = "SELECT * FROM shopcatimages WHERE ci_catref = $catref"; $rescati = query_db($sqlcati); $cati = ''; if($rowcati = mysqli_fetch_array($rescati)) { $ciname = $rowcati["ci_imagename"]; $cialt = $rowcati["ci_alt"]; $catitemp = 'catpics/ready/'.$ciname; $catitemp2 = 'catpics/thumb/'.$ciname; if(!(file_exists($catitemp2))) { $dir = 'catpics/ready/'; $img = $ciname; $newdir = 'catpics/thumb/'; $newimage = $ciname; $maxwidth=90; $maxheight = 90; $quality = 75; if(Resize($dir,$img,$newdir,$newimage,$maxwidth,$maxheight,$quality)) { $cati = ''.$cialt.''; } } else { $cati = ''.$cialt.''; } if($cati == '') { list($ImageWidth,$ImageHeight,$TypeCode)=getimagesize($catitemp); $ratio = $ImageWidth / $ImageHeight; $maxw = 90; $maxh = 90; if($ImageWidth>$maxw) { $resizedwidth = $maxw; $resizedheight = $resizedwidth / $ratio; } else { $resizedwidth = $ImageWidth; $resizedheight = $ImageHeight; } if($resizedheight>$maxh) { $resizedheight = $maxh; $resizedwidth = $resizedheight * $ratio; } $cati = ''.$cialt.''; } } echo '

'.$catname.'

'; // possible shout out about Barbour if(stripos('x'.$catname, 'Barbour')>0) { echo '

SALE

'; } echo ''.$cati.'
'; //echo $catdesc; //if($col == $maxcols) { echo ''; $col=0; } else { echo ''; } echo '
'; } //echo ''; // now show any products at this level $goodprods = " AND pr_available<>'H'"; // must not be an "extra" from any other products perspective $sqlnex = " AND NOT EXISTS (SELECT * FROM shopprodprods WHERE spp_prodid2=pc_prodref AND spp_relationship='EXTRA')"; // Must not exist a higher seq diff cat $sqlnex2 = " AND NOT EXISTS (SELECT *, MAX(pc_seq) AS maxseq FROM shopprodcats WHERE pc_prodref=pr_prodref HAVING maxseq>pc_seq"; $sqlp = "SELECT * FROM shopprodcats, shopprods WHERE pc_prodref = pr_prodref AND pc_catref = $parcat".$goodprods.$sqlnex.' ORDER BY pc_seq'; $resp = query_db($sqlp); if (mysqli_num_rows($resp)>0) { //echo ''; $col = 0; $maxcols = 3; $colperc = round(1/$maxcols*100); while($rowp = mysqli_fetch_array($resp)) { $col++; if ($col<$maxcols) { $useperc = ' width="'.$colperc.'%"'; } else { $useperc = ''; } //if($col == 1) { echo ''; $col = 0; } else { echo ''; } echo ''; } //echo '
'; } else { echo ''; } echo '
'; $prodid = $rowp["pr_prodref"]; $supplierid = $rowp["pr_supplier"]; $supplierref = stripslashes($rowp["pr_supref"]); $prodname = $rowp["pr_name"]; $endofline = trim(stripslashes($rowp["pr_endofline"])); // Y or N - promote as LAST CHANCE? $linkprod = jemurl($prodname); $price = $rowp["pr_price"]; $vat = $rowp["pr_vat"]; // need to look up vat rate now. $shortdesc = $rowp["pr_shortdesc"]; $prodavail = $rowp["pr_available"]; $over18 = $rowp["pr_over18"]; $toda = date("Y-m-d"); $onsale = $rowp["pr_onsale"]; // Y/N/D $salestart = $rowp["pr_salestart"]; $saleend = $rowp["pr_saleend"]; $saleprice = $rowp["pr_saleprice"]; if(($onsale=='Y') || (($onsale=='D') && (((strlen($salestart)<1) || ($salestart<=$toda) ) && ((strlen($saleend)<10) || ($saleend>=$toda))))) //if($onsale=='Y') { $newprice = $saleprice; } else { $newprice = 0; } // is there an image? $prodi = ''; $sqlpi = "SELECT * FROM shopprodimages WHERE pi_prodref = $prodid ORDER BY pi_seq LIMIT 1"; $respi = query_db($sqlpi); if($rowpi = mysqli_fetch_array($respi)) { $pi = $rowpi["pi_imagename"]; $subfolder = substr($pi,0,1).'/'; $pialt = $rowpi["pi_alt"]; $newline = chr(13).chr(10); if($prodavail == 'Y') { $imtitle = 'In Stock:'.$newline.showavailability($prodid, $newline); } else { $imtitle = 'Sorry, no longer available'; } $prodi = ''.$pialt.''; } if(strlen($supplierref)>0) { $supex = '
Code '.$supplierref.''; } else { $supex = ''; } echo '

'.$prodname.'

'; if(strlen($supplierref)>0) { echo '

Code '.$supplierref.'

'; } if($prodavail == 'N') { echo '

Sorry, no longer available.

'; } echo ''.$prodi.''; //echo $shortdesc.'

'; if($over18=='Y') { //echo '
'; echo 'You must be at least 18 years old to purchase this product.
'; echo 'You must be at least 18 years old to purchase this product

'; //echo '
'; } if($endofline == 'Y') { echo 'Last chance to buy,  only a few remain.'; echo '

We have:

'; // What do we have? $newline = '
'; echo showavailability($prodid, $newline); } else { //echo '

We have:

'; //echo showavailability($prodid); } showpricevardiscprod($usevid, $supplierid, $price, $vat, 1, $newprice, $prodid); // see if we are on a spare part? $spare = checksparepart($prodid); if(!$spare) { //showpricevardisc($avisitor, $supplierid, $price, $vat, 1, $newprice); } //echo '

Buy'; //echo '   More Details'; //if($col == $maxcols) { echo '
'; } //showrelatedcats($parcat); } else { // zoom in on a particular product $sqlp = "SELECT * FROM shopprods WHERE pr_prodref = $inprodref"; $resp = query_db($sqlp); if($rowp = mysqli_fetch_array($resp)) { $prodid = $rowp["pr_prodref"]; $endofline = trim(stripslashes($rowp["pr_endofline"])); // Y or N - promote as LAST CHANCE? $supplierref = trim(stripslashes($rowp["pr_supref"])); // is the product still available? $available = $rowp["pr_available"]; // Y / N / H //if Y, check it exists in an non-hidden category if($available=='Y') { $sqlhid = "SELECT * FROM shopprodcats, shopcats WHERE pc_catref=sc_catref AND pc_prodref=$prodid AND sc_catlive='Y'"; $reshid = query_db($sqlhid); $livecats = mysqli_num_rows($reshid); if($livecats == 0) { $available = 'N'; } } productseen($usevid, $prodid); $prodname = stripslashes($rowp["pr_name"]); $price = $rowp["pr_price"]; $toda = date("Y-m-d"); $onsale = $rowp["pr_onsale"]; // Y/N/D $salestart = $rowp["pr_salestart"]; $saleend = $rowp["pr_saleend"]; $saleprice = $rowp["pr_saleprice"]; $shoponly = stripslashes($rowp["pr_shoponly"]); $supplierid = $rowp["pr_supplier"]; if(($onsale=='Y') || (($onsale=='D') && (((strlen($salestart)<1) || ($salestart<=$toda) ) && ((strlen($saleend)<10) || ($saleend>=$toda))))) //if($onsale=='Y') { $newprice = $saleprice; } else { $newprice = 0; } $vat = $rowp["pr_vat"]; // need to look up vat rate now. $prodpers = $rowp["pr_personalisation"]; // Y,N $prodcpl = $rowp["pr_pers_charsperline"]; // characters per line $prodmaxl = $rowp["pr_pers_maxlines"]; // max lines $shortdesc = stripslashes($rowp["pr_shortdesc"]); $over18 = $rowp["pr_over18"]; $linkprod = jemurl($shortdesc); $longdesc = nl2br(stripslashes($rowp["pr_longdesc"])); // try no wordwrap // is there an image? $prodi = ''; $sqlpi = "SELECT * FROM shopprodimages WHERE pi_prodref = $prodid ORDER BY pi_seq"; $respi = query_db($sqlpi); $noofimages = mysqli_num_rows($respi); $simage = 0; if(isset($_GET["simage"])) { $te = $_GET["simage"]; if(is_numeric($te)) { $simage = $te; } } $imco = 0; $showcol = 0; $showbig = ''; $showthumbs = ''; $maxwide=5; $gotwide = 0; while($rowpi = mysqli_fetch_array($respi)) { if($gotwide<$maxwide) { $gotwide++; } $showcol ++; $imco++; $pi = $rowpi["pi_imagename"]; $subfolder = substr($pi,0,1).'/'; $piaut = $rowpi["pi_auto"]; $pialt = stripslashes($rowpi["pi_alt"]); $pitext = stripslashes($rowpi["pi_text"]); if(strlen($pitext) > 0) { $pitext = '

'.$pitext.'

'; } $prodi = ''.$pialt.''; if(($simage == $piaut) || (($simage==0) && ($imco==1))) { $showbig = ''.$pialt.''; $bigtext = $pitext; $pinteresturl = urlencode('https://www.saddler.co.uk/prodpics/ready/'.$subfolder.$pi.'_large.jpg&description='.$bigtext); } if($showcol>$maxwide) { $showthumbs .= ''; $showcol = 1; } $showthumbs .= ''.$pitext.'
'; $showthumbs .= $prodi; // thumbnails $showthumbs .= ''; } $showthumbsx = ''; $showthumbsx .= ''; $showthumbsx .= ''.$showthumbs.''; $showthumbsx .= '
Click on thumbnail to enlarged picture
'; echo '

'.$bigtext.'
'; $ageok = 'Y'; if($over18=='Y') { $ageok = 'N'; echo '
'; echo 'You must be at least 18 years old to purchase this product.'; echo 'You must be at least 18 years old to purchase this product.'; if(isset($_SESSION['user']['validated'])) { $username = stripslashes($_SESSION['user']['sr_firstname']); $userageok = $_SESSION['user']['sr_over18']; echo '
You are logged in as '.$username.''; if($userageok=='Y') { $ageok = 'Y'; echo ' and have provided evidence of your age being over 18 years, so you may purchase this product now.

'; echo ''.$username.' is Age Verified
'; echo 'Thanks for your patience in helping us to comply with the law.'; } else { echo ' but you have not yet provided us with proof of your age, which is a legal requirement.
'; echo ' We will therefore require a copy of either your birth certificate, driving licence or passport showing evidence of your age, which we will keep securely.'; echo ' You will then be fully registered to buy any age restricted product from this site at any time in the future.

'; echo ' Please post your proof of age documentation marked confidential to:
'; echo 'Sara Clark, Cox the Saddler, 23 High Street, Chesham, Buckinghamshire, HP5 1BG


'; echo 'If you have any questions about this, please call us on 01494 775577'; } } else { echo '
Please sign in so that we can verify your age. If you have not yet registered, please do so.
'; echo ' We will then also require a copy of either your birth certificate, driving licence or passport showing evidence of your age, which we will keep securely.
'; echo ' You will then be fully registered to buy any age restricted product from this site at any time in the future.

'; echo ' Please post your proof of age documentation marked confidential to:
'; echo 'Sara Clark, Cox the Saddler, 23 High Street, Chesham, Buckinghamshire, HP5 1BG


'; echo 'If you have any questions about this, please call us on 01494 775577'; } echo '
'; } // For pinterest // ============== echo ''; echo ' data-pin-do="buttonPin" data-pin-config="none">'; echo ''; echo $showbig; // large echo '

'; if(strlen($supplierref)>0) { echo '

Product Code: '.$supplierref.'

'; } echo $longdesc; showpricevardiscprod($usevid, $supplierid, $price, $vat, 0, $newprice, $prodid); // see if we are on a spare part? $spare = checksparepart($prodid); // build form to purchase - make sure not hidden first! if(($available == 'Y') && ($ageok == 'Y') && ($shoponly=='N')) { // add microdata for condition, name, price if($newprice>0.0) { $mdprice = $newprice; } else { $mdprice = $price; } $mdvatrate = vatrate($vat); $mdaddvat = $mdprice * $mdvatrate; $mdnewprice = $mdprice + $mdaddvat; echo '
'; echo ' '; echo '
'; echo ''; echo ''; echo ' '; echo '
'; echo '
'; if($endofline == 'Y') { echo '

Tip: LAST CHANCE to buy! Only a few remain.

'; } // if size and/or colour variants, show table for availability $sqlvar = "SELECT * FROM shopprodvariant WHERE pv_prodref = $prodid ORDER BY pv_colour, pv_variantid"; $resvar = query_db($sqlvar); $noofvar = mysqli_num_rows($resvar); $rowvar = mysqli_fetch_array($resvar); $sizeid = $rowvar["pv_size"]; $colourid = $rowvar["pv_colour"]; $colour = getproperty($colourid); $oldcolour = 'xxx'; $resvar = query_db($sqlvar); // back to start $tick = 'in stock'; $cross = 'out of stock'; $management = manageripcheck(); if((strlen($management)>0) || ($regseestock == 'y')) { $showqty = true; } else { $showqty = false; } if(($sizeid>0) && ($colourid>0)) { // show size & colour availability chart echo ''; echo ''; $lineout = ''; while($rowvar = mysqli_fetch_array($resvar)) { $colourid = $rowvar["pv_colour"]; $colour = getproperty($colourid); $sizeid = $rowvar["pv_size"]; $size = getproperty($sizeid); $avail = stripslashes($rowvar["pv_available"]); // y,n $qtygot = $rowvar["pv_quantity"]; if($showqty) { $showtick=''.$tick.' '.$qtygot.''; $showcross=''.$cross.' '.$qtygot.''; } else { $showtick = $tick; $showcross = $cross; } if($oldcolour == 'xxx') { // start a line with a colour $oldcolour = $colour; $lineout = ''; echo $lineout; $lineout = '

Stock Check? In stock'.$tick.' / Out of stock'.$cross.'
If you order a product which is out of stock we will place it on back order and aim to ship it within 7-10 days. We do not take money until we ship.

'.$colour.''; } else { $lineout .= ' | '; } if($colour == $oldcolour) { // just add size with availability if($avail == 'y') { $lineout .= ''.$size.''.$showtick; } else { $lineout .= ''.$size.''.$showcross; } } else { //colour changing $lineout .= '
'.$colour.''; $oldcolour = $colour; if($avail == 'y') { $lineout .= ''.$size.''.$showtick; } else { $lineout .= ''.$size.''.$showcross; } } } // now output final line echo $lineout.'
'; } elseif(($sizeid>0) || ($colourid>0)) { // show availability for whatever it is if($sizeid>0) { $mex = ' for size'; } else { $mex = ' for colour'; } echo ''; echo ''; $lineout = ''; if($sizeid>0) { $sqlvar = "SELECT * FROM shopprodvariant WHERE pv_prodref = $prodid ORDER BY pv_size, pv_variantid"; } else { $sqlvar = "SELECT * FROM shopprodvariant WHERE pv_prodref = $prodid ORDER BY pv_colour, pv_variantid"; } $resvar = query_db($sqlvar); $noofvar = mysqli_num_rows($resvar); $rowvar = mysqli_fetch_array($resvar); $sizeid = $rowvar["pv_size"]; $colourid = $rowvar["pv_colour"]; $colour = getproperty($colourid); $oldprop = 'xxx'; $resvar = query_db($sqlvar); // back to start while($rowvar = mysqli_fetch_array($resvar)) { if($sizeid>0) { $propid = $rowvar["pv_size"]; } else { $propid = $rowvar["pv_colour"]; } $proptext = getproperty($propid); $avail = stripslashes($rowvar["pv_available"]); // y,n $qtygot = $rowvar["pv_quantity"]; if($showqty) { $showtick=''.$tick.' '.$qtygot.''; $showcross=''.$cross.' '.$qtygot.''; } else { $showtick = $tick; $showcross = $cross; } $firstprop = true; if($oldprop == 'xxx') { // start a line $oldprop = $proptext; $lineout = ''; } else { $lineout .= ' | '; } if($proptext == $oldprop) { // just add property with availability if($avail == 'y') { $lineout .= ''.$proptext.''.$showtick; } else { $lineout .= ''.$proptext.''.$showcross; } } else { //property changing $oldprop = $proptext; if($avail == 'y') { $lineout .= ''.$proptext.''.$showtick; } else { $lineout .= ''.$proptext.''.$showcross; } } } // now output final line echo '

Stock Available'.$mex.'? In stock'.$tick.' / Out of stock'.$cross.'

'.$lineout.'
'; } echo '
'; // are there any size/color type options? $sqlv = "SELECT * FROM shopprodproperties where pp_prodref = $prodid AND pp_parentpropertyid = 0 ORDER BY pp_seq"; $resv = query_db($sqlv); // style while($rowv = mysqli_fetch_array($resv)) { $pptype = $rowv["pp_type"]; $ppradio = $rowv["pp_radio"]; $pppropertyid = $rowv["pp_propertyid"]; //$ppparentpropertyid = $rowv["pp_parentpropertyid"]; zero as picking up group names $pptext = stripslashes($rowv["pp_text"]); if(stripos('* '.$pptext, 'colour')>0) { $colourquestion = true; } else { $colourquestion = false; } if(stripos('* '.$pptext, 'size')>0) { $sizequestion = true; } else { $sizequestion = false; } echo ''; echo $pptext.': '; if($ppradio == 'Y') { // radio $sqlv2 = "SELECT * FROM shopprodproperties WHERE pp_parentpropertyid = $pppropertyid ORDER BY pp_seq"; $resv2 = query_db($sqlv2); while($rowv2 = mysqli_fetch_array($resv2)) { $sub_pppropertyid = $rowv2["pp_propertyid"]; $sel = ''; if(($insi>0) && ($insi == $sub_pppropertyid)) { $sel = ' checked="checked"'; } if(($inco>0) && ($inco == $sub_pppropertyid)) { $sel = ' checked="checked"'; } $sub_text = stripslashes($rowv2["pp_text"]); echo ' '.$sub_text; } } else { // drop down $sqlv2 = "SELECT * FROM shopprodproperties WHERE pp_parentpropertyid = $pppropertyid ORDER BY pp_seq"; $resv2 = query_db($sqlv2); // add word selected for default! echo ''; } echo '
'; } // personalisation, if any if ($prodpers == 'Y') { echo 'Your personalisation with max '.$prodcpl.' characters per line:
'; for($x=0; $x<$prodmaxl; $x++) { echo 'Personalisation line '.number_format($x+1).':
'; } } echo ''; echo 'Quantity:
'; // echo 'Quantity:
'; // consider related products! $sqlnothidden = " AND (NOT EXISTS (SELECT * FROM shopprods WHERE spp_prodid=pr_prodref AND (pr_available='H' OR pr_available='N')))"; $sqlnoprops = " AND (NOT EXISTS (SELECT * FROM shopprodproperties WHERE pp_prodref = spp_prodid2))"; $sqlrel = "SELECT * FROM shopprodprods WHERE spp_prodid = $inprodref AND ((spp_relationship = 'EXTRA') OR (spp_relationship = 'SUBPROD'))"; $sqlrel .= $sqlnoprops; $sqlrel .= $sqlnothidden; $resrel = query_db($sqlrel); $noofextra = mysqli_num_rows($resrel); if ($noofextra>0) { echo '

Please consider the options below before adding to your cart.

'; if($activebuying) { echo ''; } echo ''; echo ''; while ($rowrel = mysqli_fetch_array($resrel)) { $xtraid = $rowrel["spp_prodid2"]; $sqlget = "SELECT * FROM shopprods WHERE pr_prodref = $xtraid"; $resget = query_db($sqlget); if($rowget = mysqli_fetch_array($resget)) { $xtraname = stripslashes($rowget["pr_name"]); $xtraprice = $rowget["pr_price"]; $xtravat = $rowget["pr_vat"]; $xtradesc = stripslashes($rowget["pr_longdesc"]); $toda = date("Y-m-d"); $onsale = $rowget["pr_onsale"]; // Y/N/D $salestart = $rowget["pr_salestart"]; $saleend = $rowget["pr_saleend"]; $saleprice = $rowget["pr_saleprice"]; $xtrasupplierid = $rowget["pr_supplier"]; if(($onsale=='Y') || (($onsale=='D') && (((strlen($salestart)<1) || ($salestart<=$toda) ) && ((strlen($saleend)<10) || ($saleend>=$toda))))) //if($onsale=='Y') { $newprice = $saleprice; } else { $newprice = 0; } // get thumbnail, if any $sqlim = "SELECT * FROM shopprodimages WHERE pi_prodref=$xtraid ORDER BY pi_seq"; $resim = query_db($sqlim); $ixtra = ''; if($rowim = mysqli_fetch_array($resim)) { $iname = $rowim["pi_imagename"]; $subfolder = substr($iname,0,1).'/'; $ialt = stripslashes($rowim["pi_alt"]); $ixtra = ''.$ialt.''; } echo ''; } } echo '
Optional ExtraAdditonal price
'.$ixtra.$xtradesc.'Add '.$xtraname.'

Price: '; showpricevardiscprod($usevid, $xtrasupplierid, $xtraprice, $xtravat, 1, $newprice, $xtraid); echo '

Add it '; echo '
'; } if($activebuying) { echo '

'; } echo '
'; } else { if(!($available=='Y')) { echo '

SORRY, PRODUCT NO LONGER AVAILABLE

'; echo '

Please select an alternative product from the menu

'; } else { if($shoponly=='Y') { echo '

ONLY AVAILABLE TO PURCHASE IN STORE

'; echo '

Please come and visit us in Chesham, Buckinghamshire.

'; } else { echo '

AGE RESTRICTED PRODUCT

'; echo '

Purchase possible by fully registered customers only.

'; } } } if($noofimages>1) { echo $showthumbsx; } // now show any supplementary information, if there is any. $sqlsup = "SELECT * FROM shopprodextras, shopextrainfo WHERE spe_extraid=xi_auto AND spe_prodid=$inprodref"; $ressup = query_db($sqlsup); while($rowsup = mysqli_fetch_array($ressup)) { $thisxinfo = stripslashes($rowsup["xi_fullcode"]); echo $thisxinfo; } // now show related products with options, and peers // consider related products! $sqlnothidden = " AND (NOT EXISTS (SELECT * FROM shopprods WHERE pr_prodref=spp_prodid2 AND (pr_available='H' OR pr_available='N')))"; $sqlprops = " AND (EXISTS (SELECT * FROM shopprodproperties WHERE pp_prodref = spp_prodid2))"; $sqlrel = "SELECT * FROM shopprodprods WHERE spp_prodid = $inprodref AND ((((spp_relationship = 'EXTRA') OR (spp_relationship = 'SUBPROD'))".$sqlprops.") OR (spp_relationship = 'PEER'))"; $sqlrel .= $sqlnothidden; $resrel = query_db($sqlrel); $noofextra = mysqli_num_rows($resrel); if ($noofextra>0) { echo ''; echo ''; while ($rowrel = mysqli_fetch_array($resrel)) { $xtraid = $rowrel["spp_prodid2"]; $sqlget = "SELECT * FROM shopprods WHERE pr_prodref = $xtraid"; $resget = query_db($sqlget); if($rowget = mysqli_fetch_array($resget)) { $xtraname = stripslashes($rowget["pr_name"]); $xtrasupref = stripslashes($rowget["pr_supref"]); $xtraprice = $rowget["pr_price"]; $xtravat = $rowget["pr_vat"]; $toda = date("Y-m-d"); $onsale = $rowget["pr_onsale"]; // Y/N/D $salestart = $rowget["pr_salestart"]; $saleend = $rowget["pr_saleend"]; $saleprice = $rowget["pr_saleprice"]; if(($onsale=='Y') || (($onsale=='D') && (((strlen($salestart)<1) || ($salestart<=$toda) ) && ((strlen($saleend)<10) || ($saleend>=$toda))))) //if($onsale=='Y') { $newprice = $saleprice; } else { $newprice = 0; } $xtraprodpers = $rowget["pr_personalisation"]; $xtraprodcpl = $rowget["pr_pers_charsperline"]; $xtraprodmaxl = $rowget["pr_pers_maxlines"]; $xtradesc = stripslashes($rowget["pr_longdesc"]); $xtrasupplierid = $rowget["pr_supplier"]; // get thumbnail, if any $sqlim = "SELECT * FROM shopprodimages WHERE pi_prodref=$xtraid ORDER BY pi_seq"; $resim = query_db($sqlim); $ixtra = ''; if($rowim = mysqli_fetch_array($resim)) { $iname = $rowim["pi_imagename"]; $subfolder = substr($iname,0,1).'/'; $ialt = stripslashes($rowim["pi_alt"]); $ixtra = ''.$ialt.''; } echo ''; } } echo '

You may also consider

'.$xtraname.'
'.$ixtra.$xtradesc.'
'.$xtrasupref.'


Price: '; showpricevardiscprod($usevid, $xtrasupplierid, $xtraprice, $xtravat, 1, $newprice, $xtraid); echo '

'; // build form to purchase echo '
'; // are there any size/color type options? $sqlv = "SELECT * FROM shopprodproperties where pp_prodref = $xtraid AND pp_parentpropertyid = 0 ORDER BY pp_seq"; $resv = query_db($sqlv); // style while($rowv = mysqli_fetch_array($resv)) { $pptype = $rowv["pp_type"]; $ppradio = $rowv["pp_radio"]; $pppropertyid = $rowv["pp_propertyid"]; //$ppparentpropertyid = $rowv["pp_parentpropertyid"]; zero as picking up group names $pptext = stripslashes($rowv["pp_text"]); echo ''; echo $pptext.': '; if($ppradio == 'Y') { // radio $sqlv2 = "SELECT * FROM shopprodproperties WHERE pp_parentpropertyid = $pppropertyid ORDER BY pp_seq"; $resv2 = query_db($sqlv2); while($rowv2 = mysqli_fetch_array($resv2)) { $sub_pppropertyid = $rowv2["pp_propertyid"]; $sub_text = stripslashes($rowv2["pp_text"]); echo ' '.$sub_text; } } else { // drop down $sqlv2 = "SELECT * FROM shopprodproperties WHERE pp_parentpropertyid = $pppropertyid ORDER BY pp_seq"; $resv2 = query_db($sqlv2); echo ''; } echo '
'; } // personalisation, if any if ($xtraprodpers == 'Y') { echo 'Your personalisation with max '.$xtraprodcpl.' characters per line:
'; for($x=0; $x<$xtraprodmaxl; $x++) { echo 'Personalisation line '.number_format($x+1).':
'; } } echo ''; //echo 'Quantity:
'; echo 'Quantity:
'; if($activebuying) { echo ''; } echo '
'; echo '
'; } showprodtelephone( $supplierid); //showgeorestrictions ($supplierid); } } echo '
'; echo '
'; echo '
'; $myurl = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; echo ''; echo '
'; echo '
'; //$myurl = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; //echo ''; ?>
'; echo '
'; echo '

23 High St, Chesham, Buckinghamshire, HP5 1BG, England

'; if(workingnow()) { echo '

Telephone 01494 775577

'; echo '

Email help@saddler.co.uk

'; } else { echo '

Email help@saddler.co.uk

'; echo '

Telephone 01494 775577 during working hours.

'; } echo '

Search

'; echo '

About us

'; echo '

Repairs

'; echo '

Sitemap

'; echo '
'; echo '
'; echo '

23 High St, Chesham, Buckinghamshire, HP5 1BG, England

'; if(workingnow()) { echo '

T: 01494 775577

'; echo '

E: help@saddler.co.uk

'; } else { echo '

E: help@saddler.co.uk

'; echo '

T: 01494 775577 during working hours.

'; } echo '

Search

'; echo '

About us

'; echo '

Sitemap

'; echo '

Repairs

'; echo '
'; echo '
'; echo '

23 High St, Chesham, Buckinghamshire, HP5 1BG, England

'; if(workingnow()) { echo '

Telephone 01494 775577 or email help@saddler.co.uk

'; } else { echo '

Email help@saddler.co.uk or telephone 01494 775577 during working hours.

'; } echo '

Search | '; echo 'About us & COVID19 latest | '; echo 'Repairs | '; echo 'Sitemap

'; echo '
'; if(somecart($usevid)>0) { echo '

Checkout | '; echo 'View Cart

'; } //echo '

Our survey

'; //showprodseen($usevid, 10); // enable!! //recentsearches(5, $usevid); // On search page //nonsale_promo2(3, $myvid); // max to promote, chosen randomly //showpromos(3, $myvid); // if($bought==0) { showcomments(10); } else { showcomments(5); } // have a testimonial view ?>

© Cox the Saddler .         All rights reserved

'.date("h:i:sa").' | '.$myip.' Current PHP version: ' . phpversion().'

'; // test grab an acute accent from MYSQL //$sql = "SELECT * FROM aatest WHERE aaauto=1"; //if(!($res = query_db($sql))) { $res = db_query($sql, 'bad one'); } //$row = mysqli_fetch_array($res); //$showchars = stripslashes($row["aadata"]); //echo '

Accented chars: in HTML [écouter] and from MySQL ['.$showchars.']

'; ?>