Hi, thanks for reply, but i get error message: Unknown column
'Parent.name' in 'field list'


On Mar 18, 9:55 pm, Jorge Arauz <[email protected]> wrote:
> try with this:
>
> $categories = $this->Category->find('list', array(
>            'conditions' => array(
>                'Category.id <>' => 1),
>            'fields' => array(
>                'Category.id',
>                'Category.name',
>                'Parent.name'),
>            'recursive' => 1));
>        $this->set('categories', $categories);
>
> On Feb 17, 4:37 pm, kicaj <[email protected]> wrote:
>
> > I created this:
>
> > $categories = $this->Category->find('list', array(
> >            'conditions' => array(
> >                'Category.id <>' => 1),
> >            'fields' => array(
> >                'Category.id',
> >                'Category.name',
> >                'Category.parent_id'),
> >            'recursive' => 1));
> >        $this->set('categories', $categories);
>
> > The result is:
> > 1 // parent_id=1
> > Cat1 // id=1
> > Cat2 // id=2
> > Cat3 // id=3
> > 2 // parent_id=2
> > SubCat11 // id=4
> > SubCat12 // id=5
> > SubCat21 // id=6
>
> > But I want like this:
> > <select>
> > <optgroup>Cat1</optgroup>
> > <option>SubCat11</option>
> > <option>SubCat12</option>
> > <optgroup>Cat2</optgroup>
> > <option>SubCat21</option>
> > <!- ... -->
> > </select>
>
> > How?
>
> > On 17 Lut, 14:49, kicaj <[email protected]> wrote:
>
> > > Hi
>
> > > I use Tree Behavior and I have some tree:
> > > Main
> > >   Category1
> > >     SubCat11
> > >     SubCat12
> > >   Category2
> > >     SubCat21
> > >     SubCat22
> > >     SubCat23
> > >     SubCat24
> > >   Category3
> > >     SubCat31
> > >     SubCat32
> > >   Category4
> > >     ...
>
> > > Category1, Category2, ... are mainly categories
> > > SubCats are group of products
>
> > > I want create input() for adding subcattegories and products.
> > > But I can't build input() where Category1, Category2... will be like
> > > as optgroup, and subcategories will be options
>
> > > Anyone know how?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to