This results (for my test run) in a session variable containing the following:
For this example I selected one item twice. In my shopping cart I only show two items because this is expensive artwork, and multiple copies are not available. This is working OK. However, my message which shows how many items are in the cart says 3, I guess because I am just getting a count of the string from the session variable.
So I tried this new code to get rid of duplicate variables:
I have been walking around this problem for hours. I “knew” that I had to use array_unique; but I could never, in two lifetimes have come up with such a terrific solution. Most of my tries were at least 10 or so lines long.