understanding zen-cart
… is sometimes hard.
zen-cart has a function zen_get_uprid(..) that converts the productId and attributes into a unique key for the given product variation. This key is used in the shopping cart to identify items.
This is a good idea. I am just convinced there is a bug that actually stops processing attributes if there is an attribute with multiple values (ie. the value is an array). Furthermore, attributes are not sorted or anything, so the key depends on the order of the attributes array. Why is that bad? Because it means it is practically impossible to guess that order. That is required, however, in order to be able to calculate the same key in ZenMagick. Or, the other way round, building the attributes in any other way, will result in two items in the cart that are actually identically.
This is not a very likely case for normal store functionality. However, things like the Ajax cart demo might actually use a different order. In fact, there could even be two templates that arrange attributes in a different fashion.
The main reason for my current trouble, though, is a feature that will build a set of default attributes (based on the default flag on attribute values) if a product is added that should have attributes, but hasn’t. This is actually the case in the new drag&drop demo where you can drag products into the shopping cart from the category product list - sigh…
