Hi!!!!

i am using two controller
    Products
    categories

in index page i want to display all information about products as well
as 'category name'.category name comes from Categories table.

Model of Products is:

<?php
  class Product extends AppModel
  {
    var $name = 'Product';
    var $belongsTo = array ('Category' => array('className' =>
'Category','conditions'=>'','order'=>'',
'foreignKey'=>'category_id'));
  }
?>


controller is:

class ProductsController extends AppController
{
  //var $scaffold;
  var $name = 'Products';
var $helpers = array('Html', 'Form', 'Tree' );
var $components = array('Upload');

function index() {
        $this->Product->recursive = 0;
        $this->set('products', $this->Product->findAll());
}



in index() i want to use

$this->set('data', $this->Category->findAllThreaded(null, null,
'parent_id'));
                $CategoryArray = $this->Category->generateList(null, 
'parent_id');
        $this->set('CategoryArray', $CategoryArray);

Please help me............
What to do for this.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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