help with this

Status
Not open for further replies.

louie

New Member
trying to compare 2 arrays and based on that increment the qty in the shopping cart or add a new product.

the first one is sc_pid which is equal to the productid querystring

the second one is sc_pdid = to productdetailsid if the product has attributes as color, size, etc.

It adds to the cart (based on session array), but i can not get it to incremetn the qty once is already in the cart.
 

9barJoe

New Member
well, thats what its all about.

sorry pal, I would have liked to have had a look, but you know its murder looking into someone elses head , & pretty well snowed under at the mo' too.

rock on.
 

louie

New Member
9barJoe said:
well, thats what its all about.

sorry pal, I would have liked to have had a look, but you know its murder looking into someone elses head , & pretty well snowed under at the mo' too.

rock on.

If i had to do that in ASP, i could have it done in 30 min, but being new to PHP, it took me 24 hours after reading and more reading and Google, and php forums and lots of cigarettes + coffee, and ....

I managed in the end which is the joy of the job anyway. I love challenge.
 

louie

New Member
evilhomer said:
So are you going to share the solution with us Louie ?? :)

the solution was to create the

function add_item_to_cart($id,$pdid,$quantity) {
$cart_id = $id.$pdid; //this the line that got me mixed up - was looking into the wrong direction
//echo $cart_id;
//die();
// set cookie and store value in session
setstp();
session_regenerate_id(TRUE);
$_SESSION["cart"][$cart_id][0] = $id; //$item["productid"];
$_SESSION["cart"][$cart_id][1] = $quantity;//$quantity
$_SESSION["cart"][$cart_id][2] = $pdid; //$productdetailid
header ("location:viewcart.php");//redirect after product added to cart
//}
}
 
Status
Not open for further replies.
Top