2022-09-16 10:17:53 - 米境通跨境电商
opencart中,在添加商品时,栏位是固定的,有时栏位不够用,我们想新增几个栏位,应该怎么做呢?
修改数据库:
1.在数据库里面的Product数据表中新增一个字段
2.类型:decimal
3.长度/值:15,2
4.预设:定义0.00
修改代码:
1.修改文件admincontrollercatalogproduct.php
找到
if(isset($this->request->post['height'])){
$this->data['height']=$this->request->post['height'];
}elseif(!empty($product_info)){
$this->data['height']=$product_info['height'];
}else{
$this->data['height']='';
}
之后插入
if(isset($this->request->post['域名'])){
$this->data['域名']=$this->request->post['域名'];
}elseif(!empty($product_info)){
$this->data['域名']=$product_info['域名'];
}else{
$this->data['域名']='';
}
2.修改文件adminmodelcatalogproduct.php
找到
"',height='".(float)$data['height'].
之后插入
"',域名='".(float)$data['域名'].
找到
"',height='".(float)$data['height'].
之后插入
"',域名='".(float)$data['域名'].
3.adminview emplatecatalogproduct_form.tpl
"size="4"/>
之后插入
"size="4"/>
4.catalogmodelcatalogproduct.php
找到
'height'=>$query->row['height'],
之后插入
'域名'=>$query->row['域名'],
5.catalogcontrollerproductproduct.php
找到
$this->data['height']=$product_info['height'];
之后插入
$this->data['域名']=$product_info['域名'];
6.catalogview hemedefault emplateproductproduct.tpl
找到
之后插入