public function actionEditgoodsinfo() { $ID = Yii::app()->request->getParam('ID'); //获取该商品的ID $model = PapGoods::model()->findByPk($ID); //商品品类表‘Code’ 等于经销商商品表 'StandCode' $rool = JPDGcategory::model()->find("Code=:Code", array(':Code' => $model['StandCode'])); $data = $model->attributes; $data['StandCode'] = $rool['Name']; //把商品品类表Name值给data echo json_encode($data); }
public static function idgetgcategory($ID) { $model = JPDGcategory::model()->findBypk($ID); return $model; }
/** * 获取大类 */ public static function getMainCategorys() { // 缓存时间 $queryCachingDuration = F::sg('cache', 'categoryCachingDuration'); // 查询数据库 $cri = new CDbCriteria(array('select' => 'ID,Name,Pinyin,Code,ParentID,Level,SortOrder,IsShow', 'condition' => 'ParentID = 0 or ParentID <=> NULL', 'order' => 'SortOrder asc')); $categorys = JPDGcategory::model()->cache($queryCachingDuration)->findAll($cri); return $categorys; }