I need to add a specific value of items in my array that have the same itemid. If a customer adds two of the same item to the array I want to change the quantity of the item to 2 and list it in the array once instead of having the same item in the array twice. I tried doing some stuff with array_search, but with no luck. Any help is greatly appreciate.
Thank You
Here is what I have for variable:
if ($_REQUEST["thisitemid"]!="") {
$key=md5(time());
$cartitems[$key]["itemid"]=$_REQUEST["thisitemid"];
$cartitems[$key]["inv_amount"]=$_REQUEST["inv_amount"];
$cartitems[$key]["key"]=$key;
$cartitems[$key]["qty"]=$_REQUEST["qty"];
$_SESSION["cartitems"]=$cartitems;
}
$items=$_SESSION["cartitems"];
foreach ($items as $thisitem) {
$key=$thisitem["key"];
$itemid=$thisitem["itemid"];
$inv_amount=$thisitem["inv_amount"];
}