OK. I understand what you are saying. I have had this conversation both on the forum and off the forum about what the correct behaviour actually is.
But...
Do what you said and then navigate to the product in a way other than coming from the cart. The amount shown in the 'quantity in cart' is 0. This seems pretty buggy to me ( but one person's buggy is another person's feature ). Imagine I sell bracelets and they are engraved. I put three bracelets in the cart with the names of my children on them. Then I go and look at some other stuff and then I go back to buy another bracelet with my wife's name on it. The store will tell me I don't have any in the cart. That seems wrong to me.
Also, even if I do return to the product_info page by the link in the shopping cart, the 'quantity in cart' is dependent on those attributes . Most probably once back on the page I am going to select different attributes before adding another product. ( If not I would probably just update in the cart ) At which point having a 'quantity in cart' that is dependent on the link that I have clicked to get to the page is quite strange. In fact that last sentence sum up why I think that this behaviour is wrong. Having a 'quantity in cart' that is dependent on the link that I have clicked to get to the page is quite strange.
If the code in post #16 is used then it will tell me that I have three in the cart. That seems correct to me.
But, you know, I was just reporting something that seemed strange to me rather than complaining. If this is just the way that Zen works then that is fine. I understand the logic.
Secondly, and again this is something that I have discussed with others and think is moot, if there is a stock of one bracelet and I put the first one in the cart it will show as in stock. That, of course is fine. I then put the second bracelet in the cart and suddenly both are out of stock (with the alterations that you have suggested to the code above ). That seems wrong because it is misleading.
Again I can see the logic but having mulled it over I think that a stock check that is dependent on where in the cart the product is makes more sense. Others seem to agree. I don't expect that when I add a product to the cart it changes the other products already in the cart.
As I say. These are not complaints or demands for changes. And I suspect I am just as old as you :-)