Hi everyone.
I have a CGridView :
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'ordered-product-grid',
'dataProvider'=>$orderedProducts,
'cssFile'=>Yii::app()->baseUrl.'/css/admin/cgridview.css',
'nullDisplay'=>'N/A',
'columns'=>array(
array('name'=>'pc_name',
'type'=>'html',
'header'=>'Category',
'value'=> 'CHtml::link(ProductCategory::model()->FindByPk($data->pc_id)->pc_name,array(\'productCategory/view\',\'id\'=>$data->pc_id))',
),
array('name'=>'item_name',
'type'=>'html',
'header'=>'Category',
'value'=> 'CHtml::link(Coupon::model()->findByPk($data->item_id)->coupon_name,array(\'coupon/view\',\'id\'=>$data->item_id))',
),
array('name'=>'merchant_name',
'type'=>'html',
'header'=>'Category',
'value'=> 'CHtml::link(Merchant::model()->FindByPk($data->merchant_id)->merchant_name,array(\'merchant/view\',\'id\'=>$data->merchant_id))',
),
'qty_ordered',
array(
'class'=>'CButtonColumn',
'header' => 'Action',
),
),
)); ?>
So, from the above code, I retrieve the Coupon::model()->findByPk()… What I want to do is to validate the product category first (pc_id). If the pc_id == 1, then retrieve from Coupon, if 2, then retrieve from Merchandise. Can I do this using CGridView ? Thanks