91 lines
3.2 KiB
PHP
91 lines
3.2 KiB
PHP
<?php
|
|
$fileName = basename(__FILE__, ".php"); //grabs the file name and drops the extension
|
|
$fileName = ucwords($fileName); //capitalizes the first letter of every word
|
|
include("templates/header.php");
|
|
|
|
$products = array();
|
|
$products['D2400'] = array('name' => 'Dimension 2400', 'cost' => '149.50');
|
|
$products['AG3'] = array('name' => 'Macintosh G3', 'cost' => '199.50');
|
|
$products['DE510'] = array('name' => 'Dimension E510', 'cost' => '299.50');
|
|
?>
|
|
<div class="row-fluid" id="itemRow">
|
|
<div class="span4">
|
|
<img src="images/g3.jpg" height="150px" width="125px" title="Macintosh Power PC G3"/>
|
|
<ul id="iteminfo">
|
|
<li>9 gigabyte hard disk drive</li>
|
|
<li>330 MHz processor</li>
|
|
<li>Mac OS 9 compatible</li>
|
|
</ul>
|
|
</div>
|
|
<div class="span4">
|
|
<img src="images/2400.jpg" height="150px" width="125px" title="Dell Dimension 2400" />
|
|
<ul id="iteminfo">
|
|
<li>50 gigabyte hard disk drive</li>
|
|
<li>3.0 GHz processor</li>
|
|
<li>Windows XP compatible</li>
|
|
</ul>
|
|
</div>
|
|
<div class="span4">
|
|
<img src="images/computers.jpg" height="200px" width="250px" />
|
|
</div>
|
|
</div><!-- end first row -->
|
|
<div class="row-fluid" id="itemRow">
|
|
<div class="span4">
|
|
<img src="images/computers.jpg" height="200px" width="250px" />
|
|
</div>
|
|
<div class="span4">
|
|
<img src="images/computers.jpg" height="200px" width="250px" />
|
|
</div>
|
|
<?php if(isset($_SESSION['user_name'])) : ?><!-- begin add item cart -->
|
|
<div class="shopping-cart span4">
|
|
<h1>Add Item</h1>
|
|
<form action="shopping-cart-index.php?action=add" method="post">
|
|
<input type="hidden" name="action" value="add"/>
|
|
|
|
<label>Name:</label>
|
|
<select name="productkey">
|
|
<?php foreach($products as $key => $product) :
|
|
$cost = number_format($product['cost'], 2);
|
|
$name = $product['name'];
|
|
$item = $name . ' ($' . $cost . ')';
|
|
?>
|
|
<option value="<?php echo $key; ?>">
|
|
<?php echo $item; ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select><br />
|
|
|
|
<label>Quantity:</label>
|
|
<select name="itemqty">
|
|
<?php for($i = 1; $i <= 10; $i++) : ?>
|
|
<option value="<?php echo $i; ?>">
|
|
<?php echo $i; ?>
|
|
</option>
|
|
<?php endfor; ?>
|
|
</select><br />
|
|
|
|
<label> </label>
|
|
<input type="submit" value="Add Item"/>
|
|
</form>
|
|
<p><a href="shopping-cart-index.php?action=show_cart">View Cart</a></p>
|
|
</div>
|
|
<?php else : ?>
|
|
<div class="shopping-cart span4">Sign in to view your items.</div>
|
|
<?php endif; ?><!-- end add item cart -->
|
|
</div><!-- end second row -->
|
|
<div class="row-fluid" id="itemRow">
|
|
<div class="span4">
|
|
<img src="images/computers.jpg" height="200px" width="250px" />
|
|
</div>
|
|
<div class="span4">
|
|
<img src="images/computers.jpg" height="200px" width="250px" />
|
|
</div>
|
|
<div class="span4">
|
|
<img src="images/computers.jpg" height="200px" width="250px" />
|
|
</div>
|
|
</div><!-- end third row -->
|
|
</body>
|
|
<footer>
|
|
<h5>© 2013-2014 Computers R Us Inc.</h5>
|
|
</footer>
|
|
</html>
|