Write re-usable query methods in the appropriate models. If you're
dealing with product id's then use the products controller and any tax
calculations etc can be handled in a model or if need be component.
Im not sure why you would need a 'cart controller' if you don't have
cart records.
If you really need a table for this functionality look up temporary
mysql tables, but i wouldn't recommend using $this->query instead i'd
write efficent querys and index my tables
My 2 cents...
Sent from my iPhone
On 28 Feb 2012, at 21:06, Christian <[email protected]> wrote:
Hi,
I'm currently trying to create a shopping cart solution with cake 1.3.
In the current design, only the product id of a chosen product will be
saved in the session, each time the customer lists the cart items, all
information needs to be read out of the database.
My idea was to create a seperated model (no relation to any table)
where all cart calculations can happen in, which can then be used in
several controllers. However, this would mean that this cart class
would need to use several other product related models (product
details, taxes, countrydetails, etc.), which is not easily supported
by cake, since it breaks the MVC model.
The workaround would be to implement the logic in a controller where I
can easily access all models, however, this breaks two other basics,
once the "fat model skinny controller" rule and on the other hand the
code is not easily reusable for other purposes.
My question is now how where to implement the cart functionality (e.g.
summary price, discount, taxes calculation, etc.) without breaking MVC
but with sticking to "fat model skinny controller" and the re-
usability of my code.
Thanks,
Christian
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and
help others with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this
group at http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php