I know that, product_count is the counter_cache, but only for the subcategories the ones that have a parent_id from the categories, is a threaded model, and when i select the main categories i want to know the count of the products in all the subcategories :). That's my dilemma.
Thx. On Thu, 2009-05-14 at 13:47 -0700, majna wrote: > there is "counter cache" counter_cache property. check manual. > > On May 14, 4:41 pm, "Bogdan I. Bursuc" <bogdanbursu...@gmail.com> > wrote: > > I have the following model: > > categories: > > - id, > > - parent_id, > > - name, > > - product_count > > So, the model is threaded: exists main categories and subcategories > > that's it, but only subcategories contain products so only for > > subcategories product_count will be incremented. > > My question: > > Is there a way in cake so that when i do a find on the main > > categories > > to obtain the number of products in all it's subcategories. > > > > Thx. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---