Here are some edits I have been trying if you need a laugh.
/**
* Adds item to the cart
*
* @access public
* @param int, int,int
* @return null
*/
public function add($id, $num = 1, $pronum = 30)
{
// setup or retrieve cart
$cart = array();
if (isset($_SESSION['cart']))
{
$cart = $_SESSION['cart'];
}
// check to see if item is already in cart
if (isset($cart[$id]))
{
// if item is in cart
$cart[$id] = $cart[$id] + $num ;
}
else
{
// if item is not in cart
$cart[$id] = $num && $pronum;
}
$_SESSION['cart'] = $cart;
}
/**
* Update the quantity of a specific item in the cart
*
* @access public
* @param int, int, int
* @return NULL
*/
public function update($id, $num, $pronum)
{
if ($num == 0)
{
unset($_SESSION['cart'][$id]);
}
else
{
$_SESSION['cart'][$id] = $num;
}
if ($pronum == 0)
{
unset($_SESSION['cart'][$id]);
}
else
{
$_SESSION['cart'][$id] = $pronum;
}
}