Hi,
I am putting together my own Cart component, that will work with ZF and
provide the back end for the shopping cart. The cart is made up of
various objects including the Cart, Items, Delivery Services, and Taxes
etc. Now, although when a customer selects which delivery service they
want it gets added to the basket, somewhere I need to store the three
separate delivery service objects so that one can be chosen from in the
first place. The same applies to the various tax zones and rates (which
is a whole other problem); these objects are global to the whole shop.
So my question is where would you store this data? Obviously the objects
are initially generated from data retrieved from the database (although
some of it is hard coded), but I want to be able to have and use them as
objects because, well, that's the whole point of this OO approach. Up
until now I have been storing them in the session data, but this means
that they are duplicated for every user, when actually they should be
global for all of the users (or should they?).
Apologies if the ZF mailing list isn't the right place to ask this, but
this is directly built on ZF, and given the 100% OO nature of ZF there's
got to be some real OO experts on this list. Whenever I've asked OO
questions elsewhere I mostly just get people who don't really understand
OO, or don't know how to implement it in PHP.
Any guidance on how other people have implemented OO based carts/shops
would be incredibly helpful. This is my third rewrite of this component
now, and I just cant get my head around some aspects of it, e.g. the
fact that an item object has a tax object, but the tax is only
applicable in certain countries, but without making the users country
setting a global, the tax object cant calculate the tax amount
correctly, argh! Thanks in advance,
--
Jack