I am working on an ecommerce site with promo features. I would like to offer a promo like Buy 2 for $8. I already have this code but I don’t know how to integrate the promo future into the cart.
[php]
<?php session_start(); require_once "includes/dbconnect.php"; if (isset($_GET['id'])) $id = $_GET['id']; else $id = 1; if (isset($_GET['action'])) $action = $_GET['action']; else $action = "empty"; switch($action) { case "add"; if (isset($_SESSION['cart'][$id])) $_SESSION['cart'][$id]++; else $_SESSION['cart'][$id]=1; break; case "remove"; if (isset($_SESSION['cart'][$id])) { $_SESSION['cart'][$id]--; if ($_SESSION['cart'][$id]==0) unset($_SESSION['cart'][$id]); } break; case "empty"; unset($_SESSION['cart']); break; } //display if (isset($_SESSION['cart'])) { $total_cost=0; $no_promo = 0; $items = count($_SESSION['cart']); } else { echo "No Items In Cart"; } echo ""; ?>
[/php]
Hope someone would be able to shed some light.
Thanks,
Oliver