<?php
/*
Couffin - A PHP/HTML based super simple shopping bag.
Copyright 2005 by Georges Auberger
http://www.auberger.com/couffin
Couffin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Couffin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, you can find it here:
http://www.gnu.org/copyleft/gpl.html
*/
include_once "config/settings.php";
include_once "class/product.inc";
include_once "class/cart.inc";
include_once "config/products.php";
session_start();
// If no session exists, create one
if (!session_is_registered('cart')) {
$_SESSION['cart'] = new cart;
}
$cart = $_SESSION['cart'];
$title = "Catalog";
include "header.php";
?>
<div id="navmenu">
<ul>
<li class="first">
<a href="cart.php">View Cart (<?
if ($cart->getTotalItems() >= 2) {
echo $cart->getTotalItems() . " items";
} else {
echo $cart->getTotalItems() . " item";
}
?>)</a>
</li>
<?
if (!$cart->isEmpty()) {
?>
<li class="last">
<a href="invoice.php">Check Out</a>
</li>
<?
}
?>
</ul>
</div>
<div id="catalog">
<h2>Catalog</h2>
<?php
foreach ($products as $id => $product) {
?>
<div class="product">
<h3><a href="<?= $settings->siteUrl . $product->url?>?id=<?=$id?>"><?=$product->name?></a></h3>
<a href="<?= $settings->siteUrl . $product->url?>?id=<?=$id?>">
<img src="<?= $settings->siteUrl . $product->img?>" alt="<?=$product->name?>" />
</a>
<p>
<?=$product->description?>
<span class="product-price">$ <?=$product->price?></span>
</p>
<form action="cart.php" method="post">
<input type="hidden" name="action" value="add" />
<input type="hidden" name="qty" value="1" />
<input type="hidden" name="id" value="<?=$id?>" />
<button type="submit" class="button">Add</button>
</form>
</div>
<? } ?>
<hr />
</div>
<?
include "footer.php";
?>