It is my product Model

class product extends AppModel
{
 var $name = 'Product';
 var $primaryKey = 'productId';
 var $validate = array(
       'productName'  => VALID_NOT_EMPTY,
   );

 var $belongsTo = array(
        'Category' => array(
            'className'  => 'category',
            'foreignKey' => 'categoryId',
        )
    );

}

and it is my category model:

class category extends AppModel
{
 var $name = 'Category';
 var $primaryKey = 'categoryId';
 var $validate = array(
       'categoryName'  => VALID_NOT_EMPTY,
   );

}

It is my product controller:

$categories = $this->Product->Category->find('all',
array( 'conditions' => array('isActive' => 'Y'), 'fields' =>
array('categoryId', 'categoryName'), 'order' => 'categoryId DESC'));
        $this->set(compact('categories'));

It is corresponding view for category dropdown in product add form:

<?php echo $form->select('Product/categoryId',$options = $categories)?
>

But it is giving wrong result. Please help me to solve this prob.
--~--~---------~--~----~------------~-------~--~----~
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