Exemple #1
0
<header>
	<div class="header">
	   <a href="#" id="Logo">Company Name</a>
		<form class="Search">
            <div>
			<select id="searchBox" title="Search" type="text" name="search">
                <option>T-Shirt</option>
                <option>Pants</option>
                <option>Jacket</option>
            </select>
                <select id="colorSearch" name="colorSearch">
                    <?php 
//                    Engine::available_color();
//                     public static function available_color()
//                        {
$colors = ItemSize::get_all_colors();
while ($row = mysqli_fetch_array($colors)) {
    print "<option value=\"" . $row['Id'] . "\"style=\"background-color:" . $row['Name'] . ";\"></option>";
}
//                        }
?>
                </select>
                <select id="sizeSearch" name="sizeSearch">
                    <?php 
//                    Engine::available_size();
//                    public static function available_size()
//                        {
$sizes = ItemSize::get_all_size();
while ($row = mysqli_fetch_array($sizes)) {
    print "<option value=\"" . $row['Id'] . "\">" . $row['Number'] . "</option>";
}
Exemple #2
0
 private static function item_formating($all_rows)
 {
     $itemSize = new ItemSize();
     $colors = array();
     $result = $itemSize->get_all_colors();
     while ($row = mysqli_fetch_array($result)) {
         $colors[$row['Id']] = $row['Name'];
     }
     $sizes = array();
     $result = $itemSize->get_all_size();
     while ($row = mysqli_fetch_array($result)) {
         $sizes[$row['Id']] = $row['Number'];
     }
     while ($row = mysqli_fetch_array($all_rows)) {
         $quantity = 0;
         $result = $itemSize->get_element_by_id($row['Id']);
         while ($row1 = mysqli_fetch_array($result)) {
             $quantity += $row1['Quantity'];
         }
         if ($quantity > 0) {
             //echo "dude";
             $img = $row['Image'];
             echo "<div value=" . $row['Id'] . " class='item'>";
             echo "<img src='{$img}'" . "alt=" . $row['Name'] . ">";
             echo "<div class='itemInfo'>";
             echo "<table id='info'>";
             echo "<tr>";
             echo "<td>Price:<spin class='price'>" . $row['Price'] . "\$</spin></td>";
             echo "<td>Size";
             $result = $itemSize->get_element_by_id($row['Id']);
             echo "<select onchange='colorsToSize(this)'>";
             echo "<option selected disabled hidden value=''></option>";
             while ($row2 = mysqli_fetch_array($result)) {
                 if ($row2['Quantity'] != 0) {
                     print "<option value='" . $row2['SizeId'] . "'>" . $sizes[$row2['SizeId']] . "</option>";
                 }
             }
             echo "</select>";
             echo "<td>Color";
             $result = $itemSize->get_element_by_id($row['Id']);
             echo "<select class='colors'>";
             echo "<option selected disabled hidden value=''></option>";
             while ($row1 = mysqli_fetch_array($result)) {
                 if ($row1['Quantity'] != 0) {
                     print "<option display='none' class='" . $row1['SizeId'] . "'value='" . $row1['ColorId'] . "' style='background-color:" . $colors[$row1['ColorId']] . "; color:" . $colors[$row1['ColorId']] . "'>" . $colors[$row1['ColorId']] . "</option>";
                 }
             }
             echo "</select>";
             echo "</tr>";
             echo "</td>";
             echo "</table>";
             echo "<button type='submit' onclick='addRow(this)'>Add Item</button>";
             echo "</div>";
             echo "</div>";
         }
     }
 }