Cakephp, an elegant solution to quantities?
Posted
by Smickie
on Stack Overflow
See other posts from Stack Overflow
or by Smickie
Published on 2010-05-26T08:02:34Z
Indexed on
2010/05/26
11:11 UTC
Read the original article
Hit count: 234
Hi,
I have a shopping cart system in Cakephp, this table has all your usual maguffins: user_ids, product_ids, option_lists ect. It also has quantity.
I currently have some awful nested loops to check if the record is the same as any in there, if so add one to the quantity. If not add a new cart item.
This loop has to check associated list items and product options, so it goes quite deep.
What I'm wondering is if there is a more elegant way of checking to see if two cart items in a database are similar (everything except for quantity).
Cheers!
© Stack Overflow or respective owner