September 19, 2007

Shopping cart and attributes

Filed under: ZenMagick — DerManoMann @ 10:47 pm

The new Ajax features required adding some new methods like addProduct(..), removeProduct(..) and updateProduct(..) to the shopping cart class.

One thing I haven’t mentioned yet is the new attribute support. This is only relevant if using product attributes in which case there is base product (without any attributes) and product variations (same base product with different sets of attributes).

Base product could be a T-Shirt and product variations the same T-Shirt in different colours.

The new methods do now support adding default attributes if a product has attributes configured, but none are passed into addProduct(..).

The function doing all the work is zm_sanitize_attributes(..). It will build a set of default attributes and then merge the given attributes into those. The effect is that adding a product without attributes will result in a cart items that has all default attributes assigned (uploads are currently not supported at all).

This piece of functionality can be disabled with the new boolean setting ‘isSanitizeAttributes’.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.