opencart中,在添加商品时,栏位是固定的,有时栏位不够用,我们想新增几个栏位,应该怎么做呢?
修改数据库:
1.在数据库里面的Product数据表中新增一个字段
2.类型:decimal
3.长度/值:15,2
4.预设:定义 0.00
修改代码:
1.修改文件admin\controller\catalog\product.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.修改文件admin\model\catalog\product.php
找到
"', height = '" . (float)$data['height'] .
之后插入
"', 域名= '" . (float)$data['域名'] .
找到
"', height = '" . (float)$data['height'] .
之后插入
"', 域名= '" . (float)$data['域名'] .
3.admin\view\template\catalog\product_form.tpl
<input type="text" name="height" value="<?php echo $height; ?>" size="4" />
之后插入
<input type="text" name="height" value="<?php echo $height; ?>" size="4" />
4.catalog\model\catalog\product.php
找到
'height' => $query->row['height'],
之后插入
'域名' => $query->row['域名'],
5.catalog\controller\product\product.php
找到
$this->data['height'] = $product_info['height'];
之后插入
$this->data['域名'] = $product_info['域名'];
6.catalog\view\theme\default\template\product\product.tpl
找到
<span><?php echo $text_reward; ?></span> <?php echo $reward; ?><br />
之后插入
<span><?php echo $语系文件文字; ?></span> <?php echo $域名; ?><br />
(责任编辑:最模板) |