Re: how to display users' country from country table in product list
Thanks Dan. Everyday we learn. On Wed, Oct 15, 2008 at 4:08 PM, Dan Bair <[EMAIL PROTECTED]> wrote: > > Hi Gabriel, > > You'll have to set the recursive property of the Product model to > fetch the associated countries. You should also make sure that the > correct relations are set in your three models ( Product, User, > Country). > > Here's a quick overview of how recursion works with CakePHP's models: > http://book.cakephp.org/view/439/recursive > > You could also leverage the handy containable behavior built-in with > CakePHP 1.2: > http://book.cakephp.org/view/474/Containable > > On Oct 15, 7:15 am, gabriel <[EMAIL PROTECTED]> wrote: >> Hi, I have no idea where to start with this so I would appreciate it >> if someone can point me in the right direction: >> >> I have a products (controller, model, view) >> In it I display a list of products, in the products table there is a >> user_id, in the user table there is a country_id. >> >> Question: how do I display the country of a user on a view, which >> comes from the products controller? >> >> so far here is the controller code for my view. >> >>function view() { >>$products = $this->Product->recursive = 0; >>$this->set('products',$products); >>$this->set('products',$this->paginate()); >> >> } >> >> pfew! > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to display users' country from country table in product list
Hi Gabriel, You'll have to set the recursive property of the Product model to fetch the associated countries. You should also make sure that the correct relations are set in your three models ( Product, User, Country). Here's a quick overview of how recursion works with CakePHP's models: http://book.cakephp.org/view/439/recursive You could also leverage the handy containable behavior built-in with CakePHP 1.2: http://book.cakephp.org/view/474/Containable On Oct 15, 7:15 am, gabriel <[EMAIL PROTECTED]> wrote: > Hi, I have no idea where to start with this so I would appreciate it > if someone can point me in the right direction: > > I have a products (controller, model, view) > In it I display a list of products, in the products table there is a > user_id, in the user table there is a country_id. > > Question: how do I display the country of a user on a view, which > comes from the products controller? > > so far here is the controller code for my view. > >function view() { >$products = $this->Product->recursive = 0; >$this->set('products',$products); >$this->set('products',$this->paginate()); > > } > > pfew! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
how to display users' country from country table in product list
Hi, I have no idea where to start with this so I would appreciate it if someone can point me in the right direction: I have a products (controller, model, view) In it I display a list of products, in the products table there is a user_id, in the user table there is a country_id. Question: how do I display the country of a user on a view, which comes from the products controller? so far here is the controller code for my view. function view() { $products = $this->Product->recursive = 0; $this->set('products',$products); $this->set('products',$this->paginate()); } pfew! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---