-3
I am creating a shopping cart and save the product id’s in the session as follows:
array(
636 => 1,
637 => 2
);
Where the 636 and 637 refer to the product ID and the value would be the quantity of the same. So far all right.
The question is when I need to update the amount of one of them. For example the client wants to add +1 of code 636 and 1 of code 638.
How do I update this array by adding the amount of 636 and adding the 638 in this same array.
The same should remain so:
array(
636 => 2,
637 => 2,
638 => 1
);
I saw some solutions here but none that would work on this issue.
Thanks in advance.
It depends on how you receive the request.. This part is not clear, how you receive the action to add or update the Cart.
– Daniel Omine