I successfully created simple web app with cart.
Now i need to implement some special offers.
Example 1: if customer added 2 pieces of some product - second piece should cost 30% less.
Example 2: if customer add product_1 and product_2 - then I have to add product 3 for free.
There is no problem with implementing bussiness logic itself.
The problem is, that I have no product detailed information in Codeigniter Cart.
There are id
, name
, qty
, price
, subtotal
and options
fields in item object/array.
To recalculate prices without querying database on every cart change I need some additional fields, something like group/category, which tell me what special offer applies to that product.
Additionally - i need to store base price somewhere, because when customer remove some product from cart - i will need to put old prices there.
Where I should put that additional informations?
options
field is already used...
I don't want to query database on every cart update (i want my web application to be very fast and I want minimum server load).
Shall i expect some problems with these rowid
's, when i change price of some cart item?
Im asking about this, because cart unique 'rowid' is an md5 checksum of item id
and options
array. My application will use diffrent prices for same product with same options (one piece normal price, another 70% price for example).