Jump to content

help with my php cart script


svgmx5

Recommended Posts

I've been trying to develop a custom php cart, however i keep getting stuck at the part were i add items to the cart.

 

what i want to do is add items to the cart and store the productID, price, quantity and size. IF there is already a product with the the same id, and size then just increment the quantity..

 

i posted this a while back, however i got no responses, probably because i didn't make any sense, so i'm trying again. I've been at this for days and can't get it to work.

 

I hope someone here can give me some hints on what i should do...thanks

 

<?php

if(isset($_POST['add'])){
	$pID=$_POST['pID'];
	$psize=$_POST['size'];
	$pTitle=$_POST['pTitle'];

	if(isset($_SESSION['cart'][$pID][$psize])){

		$_SESSION['cart'][$pID][$psize]['quantity']++;

	}else{

		$_SESSION['cart']=array(
			'quantity' => 1,
			'pid' => $pID,
			'psize' => $psize,
			'pTitle' => $pTitle
		);

	}
}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/194735-help-with-my-php-cart-script/
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.