Thank you for the advice. Indeed that's a solution. Do you think that's better than calculating the amount on the fly?
What method should I create in the order model? Where should I put the call to this method? thank you again! On Jan 6, 3:40 am, Adam Royle <[email protected]> wrote: > Just add a physical "amount" field to your orders table, and then add > a method to your Order model which calculates the order total and > updates the order. Then call that method whenever you add/modify/ > delete your OrderProducts. > > On Jan 6, 8:21 am, Yannis <[email protected]> wrote: > > > > > > > I have this kind of db structure: > > > Each Account has many Orders. > > Each Order has many OrderProducts. > > OrderProduct contains fields like product name, price, quantity. > > > I want to show at the account view a list of related orders and each > > order has a field "amount" which will be the sum of related > > orderproducts price * quantity. > > > Is this possible? Where and how should I put the relation data? > > > thank you for any help! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
