E
E
enchikiben2011-12-27 09:20:23
Yii
enchikiben, 2011-12-27 09:20:23

How to select products by category in yii?

Good afternoon!
I searched on the forum and did not find it ... Tell me how in the view (and where can this view be changed?) of the category to display the product that belongs to this category of the category (preferably in the form as I set the view of the product)?

public function relations(){<br/>
return array(<br/>
'goods' =&gt; array(self::MANY_MANY, 'Goods', 'tbl_goods_to_categories(id_categori,id_product)') <br/>
);<br/>
}<br/>

then I think that it is necessary to somehow register in the controller, but I have no idea what and where ... probably somewhere here in the view category
&lt;?php $this-&gt;widget('zii.widgets.CDetailView', array(<br/>
 'data'=&gt;$model,<br/>
 'attributes'=&gt;array(<br/>
 'id',<br/>
 'name_categori',<br/>
 'description',<br/>
 <br/>
 ),<br/>
)); ?&gt;<br/>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question