Added:
/trunk/BookGet/search_old.php
Modified:
/trunk/BookGet/search.php
=======================================
--- /dev/null
+++ /trunk/BookGet/search_old.php Sat Dec 4 20:58:26 2010
@@ -0,0 +1,137 @@
+<?php
+require_once("Include/backend/SearchEngine.php");
+require_once("Include/header_bar.php");
+
+$db = SearchEngine::GetInstance();
+$termsIsEmpty = true;
+$debug = false;
+
+$query = explode('?', $_SERVER['QUERY_STRING']);
+$params = array();
+
+foreach( $query as $param )
+{
+ list($name, $value) = explode('=', $param);
+ $params[urldecode($name)][] = urldecode($value);
+}
+
+$query = $params["query"][0];
+$cat = $params["cat"][0];
+$school = $params["school"][0];
+
+$searchresults = array();
+
+if ($school != "") {
+ $searchresults = $db->fieldsearch("School", $school, $query);
+ if ( $cat != "") {
+ $searchresults = array_intersect($searchresults,
+ $db->fieldsearch("Department",
+ $cat, $query));
+ }
+} else {
+ if ($cat != "") {
+ $searchresults = $db->fieldsearch("Department", $cat, $query);
+ } else {
+ if ($query != "") {
+ $searchresults = $db->omnisearch($query);
+ }
+ }
+}
+
+
+?>
+<?php include("Include/mimetype.php");
+ ?>
+<head>
+ <title>BookGet.com</title>
+ <?php include "Include/basic_style.php" ?>
+ <style>
+ .book
+ {
+ width: 130px;
+ }
+ .Results {
+ text-align: center;
+ }
+ </style>
+</head>
+<body>
+ <?php if ($debug) print_r($searchresults); ?>
+ <div id="headerbar">
+ </div>
+ <?php print $header; ?>
+ <div id="pagewrapper">
+ <div id="leftcol">
+ <?php include("Include/category_bar.php"); ?>
+ </div>
+ <div id="pagecontent">
+ <div id="rightcol" >
+ <?php include("Include/minicart.php"); ?>
+ </div>
+ <div id="content">
+ <?php if (count($searchresults) >= 1) { ?>
+
+ <table id="results">
+ <tr>
+ <th scope="col" class="label">Cover</th>
+ <th scope="col" class="label">ISBN</th>
+ <th scope="col" class="label">Title</th>
+ <th scope="col" class="label">Authors</th>
+ <th scope="col" class="label">Quality</th>
+ <th scope="col" class="label">Price</th>
+ <th scope="col" class="label">Quantity</th>
+
+ </tr>
+ <?php
+ $quality_codes = array(0 => "New",
+ 1 => "Great",
+ 2 => "Good",
+ 3 => "Used"
+ );
+
+ for ($i = 0; $i < count($searchresults); $i++) {
+ $Title = $searchresults[$i]["Title"];
+ $ISBN = $searchresults[$i]["ISBN"];
+ $Author = $searchresults[$i]["Author"];
+ $Author1 = $searchresults[$i]["Author1"];
+ $Price = $searchresults[$i]["Price"];
+ $Quality =
$quality_codes[$searchresults[$i]["Quality"]];
+ $Qty = $searchresults[$i]["Qty"];
+ $id = $searchresults[$i]["BookID"];
+ $Description = $searchresults[$i]["Description"];
+
+ print "<fieldset>";
+ print "< form method=\"post\" action=\"\"
class=\"jcart\">\n";
+ print "< input type=\"hidden\" name= \"BOOK_ID\"
value= \"$id\" />\n";
+ print"<input type=\"hidden\" name=\"Title\"
value=\"$Title\" />";
+ print"<input type=\"hidden\" name=\"Price\"
value=\"$Price\" />";
+ print"<input type=\"hidden\" name=\"jcart_token\"
value=\"". $_SESSION['jcart_token']."\" />";
+ print "<tr>\n";
+ print " <td class=\"Results\">\n";
+ print " <img src='img/".$id.".gif'
class='book'/>\n";
+ print " </td>\n";
+
+ print "<td class=\"Results\"><a
href='book.php?id=".$id."' >" . $Title ."</a></td>\n";
+ print "<td class=\"Results\">" .
$Author . "<br/>$Author1</td>\n";
+
+ print "<td class=\"Results\">" .
$Quality . "</td>\n";
+ print "<td class=\"Results\">" .
$Price . "</td>\n";
+ print "<td class=\"Results\">" .
$Qty . "</td></tr>\n";
+ print <<<EOF
+ <label>Qty: <input type="text" name="my-item-qty"
value="1" size="3" /></label>
+ <input type="submit" name="my-add-button"
value="add to cart" class="button" />
+ </fieldset>
+ </form>
+EOF;
+ }
+ ?>
+ </table>
+ <?php } else { ?>
+ <h1 class="label">Found no results</h1>
+ <?php } ?>
+ </div>
+ <?php include("Include/footer_bar.php"); ?>
+ </div>
+ </div>
+</body>
+</html>
=======================================
--- /trunk/BookGet/search.php Fri Dec 3 19:06:02 2010
+++ /trunk/BookGet/search.php Sat Dec 4 20:58:26 2010
@@ -100,17 +100,32 @@
$id = $searchresults[$i]["BookID"];
$Description = $searchresults[$i]["Description"];
+
+
+
+ print "<fieldset>";
+ print "< form method=\"post\" action=\"\"
class=\"jcart\">\n";
+ print "< input type=\"hidden\" name= \"BOOK_ID\"
value= \"$id\" />\n";
+ print"<input type=\"hidden\" name=\"Title\"
value=\"$Title\" />";
+ print"<input type=\"hidden\" name=\"Price\"
value=\"$Price\" />";
+ print"<input type=\"hidden\" name=\"jcart_token\"
value=\"". $_SESSION['jcart_token']."\" />";
print "<tr>\n";
print " <td class=\"Results\">\n";
print " <img src='img/".$id.".gif'
class='book'/>\n";
print " </td>\n";
-
+
print "<td class=\"Results\"><a
href='book.php?id=".$id."' >" . $Title ."</a></td>\n";
print "<td class=\"Results\">" .
$Author . "<br/>$Author1</td>\n";
print "<td class=\"Results\">" .
$Quality . "</td>\n";
print "<td class=\"Results\">" .
$Price . "</td>\n";
print "<td class=\"Results\">" .
$Qty . "</td></tr>\n";
+ print <<<EOF
+ <label>Qty: <input type="text" name="my-item-qty"
value="1" size="3" /></label>
+ <input type="submit" name="my-add-button"
value="add to cart" class="button" />
+ </fieldset>
+ </form>
+EOF;
}
?>
</table>