Modification of product classification

Modification of product categories

The principle of modifying product categories is the same as that of members.

CateController.class.php

public function edit(){ $cate=D('cate'); if (IS_POST) { if($cate->create()){ if ($cate->save()!== false) { $this->success('修改商品分类成功',U('index')); }else{ $this->error('修改商品分类失败!'); } }else{ $this->error($cate->getError()); } return; } $cates=$cate->find(I('id')); $cateres=$cate->catetree(); $this->assign('cateres',$cateres); $this->assign('cates',$cates); $this->display(); }

After accepting the parameters, perform verification.

$cates=$cate->find(I('id')); $cateres=$cate->catetree(); $this->assign('cateres',$cateres);

Get the sent id and then generate a classification tree.QQ截图20170624105405.png

Assign data to template

   PHP中文网              
修改商品分类

* 必填


QQ截图20170624142740.png

QQ截图20170624142752.png

QQ截图20170624142759.png

The editing interface is completed

Continuing Learning
||
public function edit(){ $cate=D('cate'); if (IS_POST) { if($cate->create()){ if ($cate->save()!== false) { $this->success('修改商品分类成功',U('Cate/index')); }else{ $this->error('修改商品分类失败!'); } }else{ $this->error($cate->getError()); } return; } $cates=$cate->find(I('id')); $cateres=$cate->catetree(); $this->assign('cateres',$cateres); $this->assign('cates',$cates); $this->display(); }
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!