From cd199f3827b44562877c983b9784c9397c4f23e8 Mon Sep 17 00:00:00 2001
From: Nicolai Prebensen <p.prebensen.14@ucl.ac.uk>
Date: Tue, 6 Mar 2018 16:40:06 +0000
Subject: [PATCH 1/2] Commit with search bar in user browsing working and about
 to focus on filtering

---
 .../.idea/auctionSiteDemo.iml                 |   0
 {auctionSiteDemo => Buyer}/.idea/modules.xml  |   0
 .../.idea/workspace.xml                       |   0
 .../Browse}/Images/1.jpg                      | Bin
 .../Browse}/Images/10.jpg                     | Bin
 .../Browse}/Images/2.jpg                      | Bin
 .../Browse}/Images/3.jpg                      | Bin
 .../Browse}/Images/4.jpg                      | Bin
 .../Browse}/Images/5.jpg                      | Bin
 .../Browse}/Images/6.jpg                      | Bin
 .../Browse}/Images/7.jpg                      | Bin
 .../Browse}/Images/8.jpg                      | Bin
 .../Browse}/Images/9.jpg                      | Bin
 .../Browse}/Images/pic_antique.jpg            | Bin
 .../Browse}/Images/pic_electronics.jpg        | Bin
 .../Browse}/Images/pic_fashion.jpg            | Bin
 .../Browse}/Images/pic_homeGarden.jpg         | Bin
 .../Browse}/Images/pic_jAndW.jpg              | Bin
 .../Browse}/Images/pic_other.jpg              | Bin
 .../Browse}/Images/pic_sport.jpg              | Bin
 .../Browse}/Images/pic_toysAndGames.jpg       | Bin
 .../Browse}/Images/pic_vehicles.jpg           | Bin
 .../Browse}/categoryGallery.php               |  35 ++++--
 {auctionSiteDemo => Buyer/Browse}/config.php  |   0
 Buyer/Browse/dynamicProductList.php           | 115 ++++++++++++++++++
 {auctionSiteDemo => Buyer/Browse}/process.php |   0
 .../Browse}/searchBarHeader.php               |  28 +++--
 {auctionSiteDemo => Buyer/Browse}/style.css   |   0
 auctionSiteDemo/dynamicProductList.php        |  54 --------
 29 files changed, 156 insertions(+), 76 deletions(-)
 rename {auctionSiteDemo => Buyer}/.idea/auctionSiteDemo.iml (100%)
 rename {auctionSiteDemo => Buyer}/.idea/modules.xml (100%)
 rename {auctionSiteDemo => Buyer}/.idea/workspace.xml (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/1.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/10.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/2.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/3.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/4.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/5.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/6.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/7.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/8.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/9.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_antique.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_electronics.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_fashion.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_homeGarden.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_jAndW.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_other.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_sport.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_toysAndGames.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/Images/pic_vehicles.jpg (100%)
 rename {auctionSiteDemo => Buyer/Browse}/categoryGallery.php (72%)
 rename {auctionSiteDemo => Buyer/Browse}/config.php (100%)
 create mode 100644 Buyer/Browse/dynamicProductList.php
 rename {auctionSiteDemo => Buyer/Browse}/process.php (100%)
 rename {auctionSiteDemo => Buyer/Browse}/searchBarHeader.php (56%)
 rename {auctionSiteDemo => Buyer/Browse}/style.css (100%)
 delete mode 100644 auctionSiteDemo/dynamicProductList.php

diff --git a/auctionSiteDemo/.idea/auctionSiteDemo.iml b/Buyer/.idea/auctionSiteDemo.iml
similarity index 100%
rename from auctionSiteDemo/.idea/auctionSiteDemo.iml
rename to Buyer/.idea/auctionSiteDemo.iml
diff --git a/auctionSiteDemo/.idea/modules.xml b/Buyer/.idea/modules.xml
similarity index 100%
rename from auctionSiteDemo/.idea/modules.xml
rename to Buyer/.idea/modules.xml
diff --git a/auctionSiteDemo/.idea/workspace.xml b/Buyer/.idea/workspace.xml
similarity index 100%
rename from auctionSiteDemo/.idea/workspace.xml
rename to Buyer/.idea/workspace.xml
diff --git a/auctionSiteDemo/Images/1.jpg b/Buyer/Browse/Images/1.jpg
similarity index 100%
rename from auctionSiteDemo/Images/1.jpg
rename to Buyer/Browse/Images/1.jpg
diff --git a/auctionSiteDemo/Images/10.jpg b/Buyer/Browse/Images/10.jpg
similarity index 100%
rename from auctionSiteDemo/Images/10.jpg
rename to Buyer/Browse/Images/10.jpg
diff --git a/auctionSiteDemo/Images/2.jpg b/Buyer/Browse/Images/2.jpg
similarity index 100%
rename from auctionSiteDemo/Images/2.jpg
rename to Buyer/Browse/Images/2.jpg
diff --git a/auctionSiteDemo/Images/3.jpg b/Buyer/Browse/Images/3.jpg
similarity index 100%
rename from auctionSiteDemo/Images/3.jpg
rename to Buyer/Browse/Images/3.jpg
diff --git a/auctionSiteDemo/Images/4.jpg b/Buyer/Browse/Images/4.jpg
similarity index 100%
rename from auctionSiteDemo/Images/4.jpg
rename to Buyer/Browse/Images/4.jpg
diff --git a/auctionSiteDemo/Images/5.jpg b/Buyer/Browse/Images/5.jpg
similarity index 100%
rename from auctionSiteDemo/Images/5.jpg
rename to Buyer/Browse/Images/5.jpg
diff --git a/auctionSiteDemo/Images/6.jpg b/Buyer/Browse/Images/6.jpg
similarity index 100%
rename from auctionSiteDemo/Images/6.jpg
rename to Buyer/Browse/Images/6.jpg
diff --git a/auctionSiteDemo/Images/7.jpg b/Buyer/Browse/Images/7.jpg
similarity index 100%
rename from auctionSiteDemo/Images/7.jpg
rename to Buyer/Browse/Images/7.jpg
diff --git a/auctionSiteDemo/Images/8.jpg b/Buyer/Browse/Images/8.jpg
similarity index 100%
rename from auctionSiteDemo/Images/8.jpg
rename to Buyer/Browse/Images/8.jpg
diff --git a/auctionSiteDemo/Images/9.jpg b/Buyer/Browse/Images/9.jpg
similarity index 100%
rename from auctionSiteDemo/Images/9.jpg
rename to Buyer/Browse/Images/9.jpg
diff --git a/auctionSiteDemo/Images/pic_antique.jpg b/Buyer/Browse/Images/pic_antique.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_antique.jpg
rename to Buyer/Browse/Images/pic_antique.jpg
diff --git a/auctionSiteDemo/Images/pic_electronics.jpg b/Buyer/Browse/Images/pic_electronics.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_electronics.jpg
rename to Buyer/Browse/Images/pic_electronics.jpg
diff --git a/auctionSiteDemo/Images/pic_fashion.jpg b/Buyer/Browse/Images/pic_fashion.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_fashion.jpg
rename to Buyer/Browse/Images/pic_fashion.jpg
diff --git a/auctionSiteDemo/Images/pic_homeGarden.jpg b/Buyer/Browse/Images/pic_homeGarden.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_homeGarden.jpg
rename to Buyer/Browse/Images/pic_homeGarden.jpg
diff --git a/auctionSiteDemo/Images/pic_jAndW.jpg b/Buyer/Browse/Images/pic_jAndW.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_jAndW.jpg
rename to Buyer/Browse/Images/pic_jAndW.jpg
diff --git a/auctionSiteDemo/Images/pic_other.jpg b/Buyer/Browse/Images/pic_other.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_other.jpg
rename to Buyer/Browse/Images/pic_other.jpg
diff --git a/auctionSiteDemo/Images/pic_sport.jpg b/Buyer/Browse/Images/pic_sport.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_sport.jpg
rename to Buyer/Browse/Images/pic_sport.jpg
diff --git a/auctionSiteDemo/Images/pic_toysAndGames.jpg b/Buyer/Browse/Images/pic_toysAndGames.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_toysAndGames.jpg
rename to Buyer/Browse/Images/pic_toysAndGames.jpg
diff --git a/auctionSiteDemo/Images/pic_vehicles.jpg b/Buyer/Browse/Images/pic_vehicles.jpg
similarity index 100%
rename from auctionSiteDemo/Images/pic_vehicles.jpg
rename to Buyer/Browse/Images/pic_vehicles.jpg
diff --git a/auctionSiteDemo/categoryGallery.php b/Buyer/Browse/categoryGallery.php
similarity index 72%
rename from auctionSiteDemo/categoryGallery.php
rename to Buyer/Browse/categoryGallery.php
index 5099ff6..cfb9d7a 100644
--- a/auctionSiteDemo/categoryGallery.php
+++ b/Buyer/Browse/categoryGallery.php
@@ -1,11 +1,20 @@
 <?php include 'config.php'; ?>
-<?php include 'searchBarHeader.php'; ?>
+<?php include 'searchBarHeader.php';?>
 <?php 
   $query = "SELECT * FROM messages ORDER BY id DESC";
   $messages = mysqli_query($connection, $query);
 ?>
-<!doctype html>
-<html>
+
+
+
+
+
+<!--<!doctype html>-->
+<!--<html>-->
+
+
+
+
 
 
 
@@ -13,63 +22,63 @@
 
     <div class="gallery">
         <a href="dynamicProductList.php?category=Collectables and antiques">
-            <img src="Images/pic_antique.jpg" alt="Collectables and antiques" width="300" height="200">
+            <img src="../Images/pic_antique.jpg" alt="Collectables and antiques" width="300" height="200">
         </a>
         <div class="desc">Collectables and antiques</div>
     </div>
 
         <div class="gallery">
-            <ahref="dynamicProductList.php?category=Home and Garden">
-                <img src="Images/pic_homeGarden.jpg" alt="Home and Garden" width="300" height="200">
+            <a href="dynamicProductList.php?category=Home and Garden">
+                <img src="../Images/pic_homeGarden.jpg" alt="Home and Garden" width="300" height="200">
             </a>
             <div class="desc">Home & Garden</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Sporting Goods">
-                <img src="Images/pic_sport.jpg" alt="Sporting Goods" width="300" height="200">
+                <img src="../Images/pic_sport.jpg" alt="Sporting Goods" width="300" height="200">
             </a>
             <div class="desc">Sporting Goods</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Electronics">
-                <img src="Images/pic_electronics.jpg" alt="Electronics" width="300" height="200">
+                <img src="../Images/pic_electronics.jpg" alt="Electronics" width="300" height="200">
             </a>
             <div class="desc">Electronics</div>
         </div>
 
        <div class="gallery">
             <a href="dynamicProductList.php?category=Jewellery and Watches">
-                <img src="Images/pic_jAndW.jpg" alt="Jewellery and Watches" width="300" height="200">
+                <img src="../Images/pic_jAndW.jpg" alt="Jewellery and Watches" width="300" height="200">
             </a>
             <div class="desc">Jewellery and Watches</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Toys and Games">
-                <img src="Images/pic_toysAndGames.jpg" alt="Toys and Games" width="300" height="200">
+                <img src="../Images/pic_toysAndGames.jpg" alt="Toys and Games" width="300" height="200">
             </a>
             <div class="desc">Toys and Games</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Fashion">
-                <img src="Images/pic_fashion.jpg" alt="Fashion" width="300" height="200">
+                <img src="../Images/pic_fashion.jpg" alt="Fashion" width="300" height="200">
             </a>
             <div class="desc">Fashion</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Motors">
-                <img src="Images/pic_vehicles.jpg" alt="Motors" width="300" height="200">
+                <img src="../Images/pic_vehicles.jpg" alt="Motors" width="300" height="200">
             </a>
             <div class="desc">Motors</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Other">
-                <img src="Images/pic_other.jpg" alt="Other" width="300" height="200">
+                <img src="../Images/pic_other.jpg" alt="Other" width="300" height="200">
             </a>
             <div class="desc">Other</div>
         </div>
diff --git a/auctionSiteDemo/config.php b/Buyer/Browse/config.php
similarity index 100%
rename from auctionSiteDemo/config.php
rename to Buyer/Browse/config.php
diff --git a/Buyer/Browse/dynamicProductList.php b/Buyer/Browse/dynamicProductList.php
new file mode 100644
index 0000000..1a6cf11
--- /dev/null
+++ b/Buyer/Browse/dynamicProductList.php
@@ -0,0 +1,115 @@
+<?php include 'config.php'; ?>
+<?php include 'searchBarHeader.php'; ?>
+
+<div id="container2">
+
+
+
+    <?php
+    $productSearch = $_POST["search"];
+    $category = $_POST["searchCategories"];
+    $dateNow = date("Y-m-d H:i:s");
+    ?>
+
+    <br>
+    <br>
+
+</div>
+
+<!--<div id="container">-->
+<!--    <header>-->
+<!--        <h1>Filter results</h1>-->
+<!--    </header>-->
+<!--    <div id="searchBar">-->
+<!---->
+<!--        <ul>-->
+<!--            <form action="dynamicProductList.php" method ="post">-->
+<!--                <input type="text" id="search" name="search" placeholder="Search for an item"/>-->
+<!---->
+<!---->
+<!--                <select name="searchCategories">-->
+<!--                    <option value="*">All Categories</option>-->
+<!--                    <option value="Collectables and antiques">Antiques</option>-->
+<!--                    <option value="Home and Garden">Home & Garden</option>-->
+<!--                    <option value="Sporting Goods">Sports & Active Goods</option>-->
+<!--                    <option value="Electronics">Electronics</option>-->
+<!--                    <option value="Jewellery and Watches">Jewellery & Watches</option>-->
+<!--                    <option value="Toys and Games">Toys & Games</option>-->
+<!--                    <option value="Fashion">Fashion</option>-->
+<!--                    <option value="Motors">Fashion</option>-->
+<!--                    <option value="Other">Other</option>-->
+<!--                </select>-->
+<!---->
+<!--                <input id="show-btn" type="submit" name="submit" value="Search">-->
+<!--            </form>-->
+<!--        </ul>-->
+<!---->
+<!--    </div>-->
+<!---->
+<!---->
+<!---->
+<!--</div>-->
+
+<div id="container2">
+
+<?php
+if(isset($_GET["category"])) {
+    $category = $_GET["category"];
+    $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture FROM product WHERE prod_category = '$category' AND '$dateNow' <= prod_end_date";
+}
+
+
+// run search for all categories
+else if ($category == "*") {
+        $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture FROM product WHERE prod_name LIKE '%$productSearch%' AND '$dateNow' <= prod_end_date";
+    }
+
+// run search within a category
+else {
+
+        $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture FROM product WHERE (prod_name LIKE '%$productSearch%') AND (prod_category = '$category')  AND '$dateNow' <= prod_end_date";
+    }
+
+
+
+
+
+$result = mysqli_query($db, $sql);
+
+
+if (mysqli_num_rows($result) > 0) {
+    // output data of each row
+    ?>
+    <div id="container2">
+        <?php
+    while($row = mysqli_fetch_assoc($result)) {
+        echo "Name: " . $row["prod_name"]. "<br>" .
+            "Category: " . $row["prod_category"]. "<br>" .
+            "Description: " . $row["prod_description"]. "<br>" .
+            "Start Price: " . $row["prod_start_price"]. "<br>" .
+            "Reserve Price: " . $row["prod_reserve_price"]. "<br>" .
+            "End date: " . $row["prod_end_date"]. "<br>" .
+            "Condition: " . $row["prod_condition"]. "<br>" .
+            "Picture File: " . $row["prod_picture"]. "<br>";
+            $picture1 = $row["prod_picture"];
+//            below needs changing when put on server
+            $picture2 = "Images/" . $picture1;
+
+
+?>
+        <img src= "<?php echo $picture2?>" alt="Image picture" width="300" height="200">
+        <br>
+ <?php   }
+    ?>
+    </div>
+    <?php
+} else {
+    echo "0 results";
+}
+
+mysqli_close($db);
+?>
+
+</div>
+
+
diff --git a/auctionSiteDemo/process.php b/Buyer/Browse/process.php
similarity index 100%
rename from auctionSiteDemo/process.php
rename to Buyer/Browse/process.php
diff --git a/auctionSiteDemo/searchBarHeader.php b/Buyer/Browse/searchBarHeader.php
similarity index 56%
rename from auctionSiteDemo/searchBarHeader.php
rename to Buyer/Browse/searchBarHeader.php
index 747ced8..6d20dc4 100644
--- a/auctionSiteDemo/searchBarHeader.php
+++ b/Buyer/Browse/searchBarHeader.php
@@ -20,21 +20,31 @@
       <div id="searchBar">
 
         <ul>
+            <form action="dynamicProductList.php" method ="post">
             <input type="text" id="search" name="search" placeholder="Search for an item"/>
-            <select name="categories">
-                <option value="All Categories">All Categories</option>
-                <option value="Antiques">Antiques</option>
-                <option value="Home & Garden">Home & Garden</option>
-                <option value="Sports & Active Goods">Sports & Active Goods</option>
+
+
+            <select name="searchCategories">
+                <option value="*">All Categories</option>
+                <option value="Collectables and antiques">Antiques</option>
+                <option value="Home and Garden">Home & Garden</option>
+                <option value="Sporting Goods">Sports & Active Goods</option>
                 <option value="Electronics">Electronics</option>
-                <option value="Jewellery & Watches">Jewellery & Watches</option>
-                <option value="Toys & Games">Toys & Games</option>
-                <option value="Fashion">Fashion</option>
+                <option value="Jewellery and Watches">Jewellery & Watches</option>
+                <option value="Toys and Games">Toys & Games</option>
                 <option value="Fashion">Fashion</option>
+                <option value="Motors">Fashion</option>
                 <option value="Other">Other</option>
             </select>
-            <input id="show-btn" type="submit" name="submit" value="Search"/>
+
+            <input id="show-btn" type="submit" name="submit" value="Search">
+            </form>
         </ul>
 
       </div>
+
+
+
     </div>
+
+
diff --git a/auctionSiteDemo/style.css b/Buyer/Browse/style.css
similarity index 100%
rename from auctionSiteDemo/style.css
rename to Buyer/Browse/style.css
diff --git a/auctionSiteDemo/dynamicProductList.php b/auctionSiteDemo/dynamicProductList.php
deleted file mode 100644
index 6b5b132..0000000
--- a/auctionSiteDemo/dynamicProductList.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php include 'config.php'; ?>
-<?php include 'searchBarHeader.php'; ?>
-
-<div id="container2">
-
-<?php
-echo $_GET["category"];
-?>
-
-</div>
-
-<div id="container2">
-
-<?php
-$category = $_GET["category"];
-$sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture FROM product WHERE prod_category = '$category'";
-$result = mysqli_query($db, $sql);
-
-if (mysqli_num_rows($result) > 0) {
-    // output data of each row
-    ?>
-    <div id="container2">
-        <?php
-    while($row = mysqli_fetch_assoc($result)) {
-        echo "Name: " . $row["prod_name"]. "<br>" .
-            "Category: " . $row["prod_category"]. "<br>" .
-            "Description: " . $row["prod_description"]. "<br>" .
-            "Start Price: " . $row["prod_start_price"]. "<br>" .
-            "Reserve Price: " . $row["prod_reserve_price"]. "<br>" .
-            "End date: " . $row["prod_end_date"]. "<br>" .
-            "Condition: " . $row["prod_condition"]. "<br>" .
-            "Picture File: " . $row["prod_picture"]. "<br>";
-            $picture1 = $row["prod_picture"];
-//            below needs changing when put on server
-            $picture2 = "Images/" . $picture1;
-
-
-?>
-        <img src= "<?php echo $picture2?>" alt="Image picture" width="300" height="200">
-        <br>
- <?php   }
-    ?>
-    </div>
-    <?php
-} else {
-    echo "0 results";
-}
-
-mysqli_close($db);
-?>
-
-</div>
-
-

From 7ebe9baf85c6b0ec2db3786140d1c0bd83836ec8 Mon Sep 17 00:00:00 2001
From: Nicolai Prebensen <p.prebensen.14@ucl.ac.uk>
Date: Wed, 7 Mar 2018 15:58:06 +0000
Subject: [PATCH 2/2] Commit with search bar in user browsing working and about
 to focus on filtering

---
 Buyer/Browse/categoryGallery.php             |  18 +-
 Buyer/Browse/dynamicProductList.php          | 158 ++++++++-----
 Buyer/Browse/dynamicProductListController.js | 231 +++++++++++++++++++
 3 files changed, 335 insertions(+), 72 deletions(-)
 create mode 100644 Buyer/Browse/dynamicProductListController.js

diff --git a/Buyer/Browse/categoryGallery.php b/Buyer/Browse/categoryGallery.php
index cfb9d7a..1b9aa25 100644
--- a/Buyer/Browse/categoryGallery.php
+++ b/Buyer/Browse/categoryGallery.php
@@ -22,63 +22,63 @@
 
     <div class="gallery">
         <a href="dynamicProductList.php?category=Collectables and antiques">
-            <img src="../Images/pic_antique.jpg" alt="Collectables and antiques" width="300" height="200">
+            <img src="Images/pic_antique.jpg" alt="Collectables and antiques" width="300" height="200">
         </a>
         <div class="desc">Collectables and antiques</div>
     </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Home and Garden">
-                <img src="../Images/pic_homeGarden.jpg" alt="Home and Garden" width="300" height="200">
+                <img src="Images/pic_homeGarden.jpg" alt="Home and Garden" width="300" height="200">
             </a>
             <div class="desc">Home & Garden</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Sporting Goods">
-                <img src="../Images/pic_sport.jpg" alt="Sporting Goods" width="300" height="200">
+                <img src="Images/pic_sport.jpg" alt="Sporting Goods" width="300" height="200">
             </a>
             <div class="desc">Sporting Goods</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Electronics">
-                <img src="../Images/pic_electronics.jpg" alt="Electronics" width="300" height="200">
+                <img src="Images/pic_electronics.jpg" alt="Electronics" width="300" height="200">
             </a>
             <div class="desc">Electronics</div>
         </div>
 
        <div class="gallery">
             <a href="dynamicProductList.php?category=Jewellery and Watches">
-                <img src="../Images/pic_jAndW.jpg" alt="Jewellery and Watches" width="300" height="200">
+                <img src="Images/pic_jAndW.jpg" alt="Jewellery and Watches" width="300" height="200">
             </a>
             <div class="desc">Jewellery and Watches</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Toys and Games">
-                <img src="../Images/pic_toysAndGames.jpg" alt="Toys and Games" width="300" height="200">
+                <img src="Images/pic_toysAndGames.jpg" alt="Toys and Games" width="300" height="200">
             </a>
             <div class="desc">Toys and Games</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Fashion">
-                <img src="../Images/pic_fashion.jpg" alt="Fashion" width="300" height="200">
+                <img src="Images/pic_fashion.jpg" alt="Fashion" width="300" height="200">
             </a>
             <div class="desc">Fashion</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Motors">
-                <img src="../Images/pic_vehicles.jpg" alt="Motors" width="300" height="200">
+                <img src="Images/pic_vehicles.jpg" alt="Motors" width="300" height="200">
             </a>
             <div class="desc">Motors</div>
         </div>
 
         <div class="gallery">
             <a href="dynamicProductList.php?category=Other">
-                <img src="../Images/pic_other.jpg" alt="Other" width="300" height="200">
+                <img src="Images/pic_other.jpg" alt="Other" width="300" height="200">
             </a>
             <div class="desc">Other</div>
         </div>
diff --git a/Buyer/Browse/dynamicProductList.php b/Buyer/Browse/dynamicProductList.php
index 1a6cf11..5796b69 100644
--- a/Buyer/Browse/dynamicProductList.php
+++ b/Buyer/Browse/dynamicProductList.php
@@ -1,73 +1,91 @@
 <?php include 'config.php'; ?>
 <?php include 'searchBarHeader.php'; ?>
+<script type="text/javascript"
+        src="dynamicProductListController.js">
+</script>
 
-<div id="container2">
 
+<?php
 
+$productSearch =  $_POST["search"];
+
+$category2 = $_POST["searchCategories"];
+
+$category1 = $_GET["category"];
+
+$dateNow = date("Y-m-d H:i:s");
+
+echo $productSearch;
+echo $category2;
+echo $category1;
+?>
+
+<div id="container">
+
+    <select name="Name Alphabetical" id="nameAlphabetical"  onclick="sortName()">
+        <option value="" disabled selected>Name</option>
+        <option value="Name Alphabetical">Name Alphabetical</option>
+    </select>
+
+    <select name="Ending soon" id="endingSoon"  onclick="endingSoon(value)">
+        <option value="" disabled selected>Sort by End Date</option>
+        <option value="End soon first">End soon first</option>
+        <option value="End soon last">End soon last</option>
+    </select>
+
+    <select name="Condition Filter" id="condition"  onclick="filterCategory()">
+        <option value="" disabled selected>Condition</option>
+        <option value="e">New or Used</option>
+        <option value="New">New</option>
+        <option value="Used">Used</option>
+    </select>
+
+    <select name="Reserve price" id="reservePrice"  onclick="sortReservePrice(value)">
+        <option value="" disabled selected>Sort Reserve Price</option>
+        <option value="High to Low">High to Low</option>
+        <option value="Low to High">Low to High</option>
+    </select>
+
+    <select name="Highest bid" id="highestBid"  onclick="sortHighestBid(value)">
+        <option value="" disabled selected>Sort Highest Bid</option>
+        <option value="High to Low">High to Low</option>
+        <option value="Low to High">Low to High</option>
+    </select>
 
-    <?php
-    $productSearch = $_POST["search"];
-    $category = $_POST["searchCategories"];
-    $dateNow = date("Y-m-d H:i:s");
-    ?>
 
-    <br>
-    <br>
 
 </div>
 
-<!--<div id="container">-->
-<!--    <header>-->
-<!--        <h1>Filter results</h1>-->
-<!--    </header>-->
-<!--    <div id="searchBar">-->
-<!---->
-<!--        <ul>-->
-<!--            <form action="dynamicProductList.php" method ="post">-->
-<!--                <input type="text" id="search" name="search" placeholder="Search for an item"/>-->
-<!---->
-<!---->
-<!--                <select name="searchCategories">-->
-<!--                    <option value="*">All Categories</option>-->
-<!--                    <option value="Collectables and antiques">Antiques</option>-->
-<!--                    <option value="Home and Garden">Home & Garden</option>-->
-<!--                    <option value="Sporting Goods">Sports & Active Goods</option>-->
-<!--                    <option value="Electronics">Electronics</option>-->
-<!--                    <option value="Jewellery and Watches">Jewellery & Watches</option>-->
-<!--                    <option value="Toys and Games">Toys & Games</option>-->
-<!--                    <option value="Fashion">Fashion</option>-->
-<!--                    <option value="Motors">Fashion</option>-->
-<!--                    <option value="Other">Other</option>-->
-<!--                </select>-->
-<!---->
-<!--                <input id="show-btn" type="submit" name="submit" value="Search">-->
-<!--            </form>-->
-<!--        </ul>-->
-<!---->
-<!--    </div>-->
-<!---->
-<!---->
-<!---->
-<!--</div>-->
 
 <div id="container2">
 
+
+
+
+
+
+
+
+
 <?php
-if(isset($_GET["category"])) {
-    $category = $_GET["category"];
-    $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture FROM product WHERE prod_category = '$category' AND '$dateNow' <= prod_end_date";
+if(isset($category1)) {
+
+    $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture, prod_highest_price FROM product WHERE prod_category = '$category1' AND '$dateNow' <= prod_end_date";
+    echo "first loop";
 }
 
 
 // run search for all categories
-else if ($category == "*") {
-        $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture FROM product WHERE prod_name LIKE '%$productSearch%' AND '$dateNow' <= prod_end_date";
+else if ($category2 == "*") {
+        $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture, prod_highest_price FROM product WHERE prod_name LIKE '%$productSearch%' AND '$dateNow' <= prod_end_date";
+    echo "second loop";
     }
 
 // run search within a category
 else {
 
-        $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture FROM product WHERE (prod_name LIKE '%$productSearch%') AND (prod_category = '$category')  AND '$dateNow' <= prod_end_date";
+        $sql = "SELECT prod_name, prod_category, prod_description, prod_start_price, prod_reserve_price, prod_end_date, prod_condition, prod_picture, prod_highest_price FROM product WHERE (prod_name LIKE '%$productSearch%') AND (prod_category = '$category2')  AND '$dateNow' <= prod_end_date";
+        echo "third loop";
     }
 
 
@@ -80,28 +98,41 @@
 if (mysqli_num_rows($result) > 0) {
     // output data of each row
     ?>
-    <div id="container2">
+    <table id="myTable">
+        <tr>
+            <th></th>
+            <th>Name</th>
+            <th>Category</th>
+            <th>End date</th>
+            <th>Condition</th>
+            <th>Reserve Price</th>
+            <th>Current Bid</th>
+        </tr>
+
         <?php
-    while($row = mysqli_fetch_assoc($result)) {
-        echo "Name: " . $row["prod_name"]. "<br>" .
-            "Category: " . $row["prod_category"]. "<br>" .
-            "Description: " . $row["prod_description"]. "<br>" .
-            "Start Price: " . $row["prod_start_price"]. "<br>" .
-            "Reserve Price: " . $row["prod_reserve_price"]. "<br>" .
-            "End date: " . $row["prod_end_date"]. "<br>" .
-            "Condition: " . $row["prod_condition"]. "<br>" .
-            "Picture File: " . $row["prod_picture"]. "<br>";
-            $picture1 = $row["prod_picture"];
-//            below needs changing when put on server
-            $picture2 = "Images/" . $picture1;
+    while($row = mysqli_fetch_assoc($result)) { ?>
+        <tr>
+            <td> <?php $picture1 = $row["prod_picture"];
+            //            below needs changing when put on server
+                $picture2 = "Images/" . $picture1;
+                ?>
+                <img src= "<?php echo $picture2?>" alt="Image picture" width="300" height="200"> </td>
+            <td><?php echo    $row["prod_name"]; ?> </td>
+            <td><?php echo $row["prod_category"]; ?> </td>
+            <td><?php echo $row["prod_end_date"]; ?> </td>
+            <td><?php echo $row["prod_condition"]; ?> </td>
+            <td><?php echo  $row["prod_reserve_price"]; ?> </td>
+            <td><?php echo  $row["prod_highest_price"]; ?> </td>
 
 
-?>
-        <img src= "<?php echo $picture2?>" alt="Image picture" width="300" height="200">
+
+
+
+        </tr>
         <br>
  <?php   }
     ?>
-    </div>
+
     <?php
 } else {
     echo "0 results";
@@ -113,3 +144,4 @@
 </div>
 
 
+
diff --git a/Buyer/Browse/dynamicProductListController.js b/Buyer/Browse/dynamicProductListController.js
new file mode 100644
index 0000000..87d1693
--- /dev/null
+++ b/Buyer/Browse/dynamicProductListController.js
@@ -0,0 +1,231 @@
+function sortName() {
+    var table, rows, switching, i, x, y, shouldSwitch;
+    table = document.getElementById("myTable");
+    switching = true;
+    // Make a loop that will continue until
+    // no switching has been done
+    while (switching) {
+        // Start by saying that no switching is done
+        switching = false;
+        rows = table.getElementsByTagName("TR");
+        // Loop through table rows
+        for (i = 1; i < (rows.length - 1); i++) {
+            // Start by saying there should be no switching
+            shouldSwitch = false;
+            // get two rows and compare
+            x = rows[i].getElementsByTagName("TD")[1];
+            y = rows[i + 1].getElementsByTagName("TD")[1];
+            // Check if the two rows should switch places
+            if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
+                // If so, mark as a switch and break the loop:
+                shouldSwitch= true;
+                break;
+            }
+        }
+        if (shouldSwitch) {
+            // If switch was marked then do it and break
+            rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
+            switching = true;
+        }
+    }
+}
+
+function filterCategory() {
+var input, filter, table, tr, td, i;
+input = document.getElementById("condition");
+filter = input.value.toUpperCase();
+table = document.getElementById("myTable");
+tr = table.getElementsByTagName("TR");
+
+// loop through the table rows and eliminate
+// the ones that don't match the condition
+
+    for (i = 0; i < tr.length; i++) {
+        td = tr[i].getElementsByTagName("TD")[4];
+        if (td) {
+            if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
+                tr[i].style.display = "";
+            } else {
+                tr[i].style.display = "none";
+            }
+        }
+    }
+
+}
+
+function sortReservePrice(value) {
+    var table, rows, switching, i, x, y, shouldSwitch, x1, x2;
+    table = document.getElementById("myTable");
+    switching = true;
+
+    if (value == "High to Low") {
+        while (switching) {
+            // Start by saying that no switching is done
+            switching = false;
+            rows = table.getElementsByTagName("TR");
+            // Loop through table rows
+            for (i = 1; i < (rows.length - 1); i++) {
+                // Start by saying there should be no switching
+                shouldSwitch = false;
+                // get two rows and compare
+                x = rows[i].getElementsByTagName("TD")[5];
+                y = rows[i + 1].getElementsByTagName("TD")[5];
+                // Check if the two rows should switch places
+                if (Number(x.innerHTML) < Number(y.innerHTML)) {
+                    // If so, mark as a switch and break the loop:
+                    shouldSwitch= true;
+                    break;
+                }
+            }
+            if (shouldSwitch) {
+                // If switch was marked then do it and break
+                rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
+                switching = true;
+            }
+        }
+    } else if (value == "Low to High") {
+        while (switching) {
+            // Start by saying that no switching is done
+            switching = false;
+            rows = table.getElementsByTagName("TR");
+            // Loop through table rows
+            for (i = 1; i < (rows.length - 1); i++) {
+                // Start by saying there should be no switching
+                shouldSwitch = false;
+                // get two rows and compare
+                x = rows[i].getElementsByTagName("TD")[5];
+                y = rows[i + 1].getElementsByTagName("TD")[5];
+                // Check if the two rows should switch places
+                if (Number(x.innerHTML) > Number(y.innerHTML)) {
+                    // If so, mark as a switch and break the loop:
+                    shouldSwitch= true;
+                    break;
+                }
+            }
+            if (shouldSwitch) {
+                // If switch was marked then do it and break
+                rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
+                switching = true;
+            }
+        }
+    }
+
+}
+
+function sortHighestBid(value) {
+    var table, rows, switching, i, x, y, shouldSwitch;
+    table = document.getElementById("myTable");
+    switching = true;
+
+    if (value == "High to Low") {
+        while (switching) {
+            // Start by saying that no switching is done
+            switching = false;
+            rows = table.getElementsByTagName("TR");
+            // Loop through table rows
+            for (i = 1; i < (rows.length - 1); i++) {
+                // Start by saying there should be no switching
+                shouldSwitch = false;
+                // get two rows and compare
+                x = rows[i].getElementsByTagName("TD")[6];
+                y = rows[i + 1].getElementsByTagName("TD")[6];
+                // Check if the two rows should switch places
+                if (Number(x.innerHTML) < Number(y.innerHTML)) {
+                    // If so, mark as a switch and break the loop:
+                    shouldSwitch= true;
+                    break;
+                }
+            }
+            if (shouldSwitch) {
+                // If switch was marked then do it and break
+                rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
+                switching = true;
+            }
+        }
+    } else if (value == "Low to High") {
+        while (switching) {
+            // Start by saying that no switching is done
+            switching = false;
+            rows = table.getElementsByTagName("TR");
+            // Loop through table rows
+            for (i = 1; i < (rows.length - 1); i++) {
+                // Start by saying there should be no switching
+                shouldSwitch = false;
+                // get two rows and compare
+                x = rows[i].getElementsByTagName("TD")[6];
+                y = rows[i + 1].getElementsByTagName("TD")[6];
+                // Check if the two rows should switch places
+                if (Number(x.innerHTML) > Number(y.innerHTML)) {
+                    // If so, mark as a switch and break the loop:
+                    shouldSwitch= true;
+                    break;
+                }
+            }
+            if (shouldSwitch) {
+                // If switch was marked then do it and break
+                rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
+                switching = true;
+            }
+        }
+    }
+
+}
+
+function endingSoon(value) {
+    var table, rows, switching, i, x, y, shouldSwitch;
+    table = document.getElementById("myTable");
+    switching = true;
+
+    if (value == "End soon first") {
+        while (switching) {
+            // Start by saying that no switching is done
+            switching = false;
+            rows = table.getElementsByTagName("TR");
+            // Loop through table rows
+            for (i = 1; i < (rows.length - 1); i++) {
+                // Start by saying there should be no switching
+                shouldSwitch = false;
+                // get two rows and compare
+                x = rows[i].getElementsByTagName("TD")[3];
+                y = rows[i + 1].getElementsByTagName("TD")[3];
+                // Check if the two rows should switch places
+                if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
+                    // If so, mark as a switch and break the loop:
+                    shouldSwitch= true;
+                    break;
+                }
+            }
+            if (shouldSwitch) {
+                // If switch was marked then do it and break
+                rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
+                switching = true;
+            }
+        }
+    } else if (value == "End soon last") {
+        while (switching) {
+            // Start by saying that no switching is done
+            switching = false;
+            rows = table.getElementsByTagName("TR");
+            // Loop through table rows
+            for (i = 1; i < (rows.length - 1); i++) {
+                // Start by saying there should be no switching
+                shouldSwitch = false;
+                // get two rows and compare
+                x = rows[i].getElementsByTagName("TD")[3];
+                y = rows[i + 1].getElementsByTagName("TD")[3];
+                // Check if the two rows should switch places
+                if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
+                    // If so, mark as a switch and break the loop:
+                    shouldSwitch= true;
+                    break;
+                }
+            }
+            if (shouldSwitch) {
+                // If switch was marked then do it and break
+                rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
+                switching = true;
+            }
+        }
+    }
+
+}
\ No newline at end of file