Wednesday, September 3, 2014

trouble in association and paging

  HI, i am associating 4 models.
1)Menu->category->subcategory->Products
its a one to many realtion as you go form left to right.

i am trying to post a menu id and get all the products related to that menu id in paginated form.
but i am stuck with error.
any help???
*i have mentioned the code below.

thnaks in advance..     


      $conditions=array();

        if ($this->request->is('post')) {
           
            $menu_id = $this->request->data["Filter"]["menu_id"];
            $conditions=$this->Product->Subcategory->Category->Menu->find("all", array('conditions' => array('Menu.id' => $menu_id),'recursive' => 3));
            var_dump($conditions);
        }



        $this->Product->recursive=3;
        $this->paginate = array(
            'limit' => 8,
            'conditions' => $conditions,
           
        );
        $this->set('products', $this->paginate());

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: