Jump to content

shopping carts


lional

Recommended Posts

Hi All

I am trying to create an e-commerce site where we have a specials page and if a product is purchases from the specials page there will be a discount, but if the same product is purchased from another page, then the discount does not apply. I am not sure how I would do this, any suggestions will be appreciated.

Here is my code so far:

$qty1 = 1;
// This page adds products to the shopping cart
	if (is_numeric ($_GET['pid'])) { // check for a print id
	$pid = $_GET['pid'];
	$spec = $_SESSION['special'];
	// check to see if the cart already contains one of these products
	if (isset ($_session['cart'][$pid])) {
	$qty_out = $_SESSION['cart'][$pid] + $qty1;
	} else {
	$qty = $qty1;
	}
	// add to the cart session variable
	$_SESSION['cart'][$pid] = $qty;

	// Display a message

 

Thanks

 

Lional

Link to comment
https://forums.phpfreaks.com/topic/72732-shopping-carts/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.