问题描述
如何在制造商的编辑页面中创建其他字段(下拉列表).我需要添加制造商国家/地区.我在网上搜索了很多,但没有找到任何信息或文档.
How do you create an additional field (dropdown) in the manufacturer's edit page. I need it to add a manufacturer country. I searched the web a lot, but I didn't find any information or documentation.
推荐答案
这是一个漫长的过程,我只能解释这些步骤,因为您知道Opencart基于MVC,因此您必须仔细阅读每一部分.
It's a long procedure i can only explain the steps, as you know Opencart is MVC based so you have to go through each portion.
以admin catalog/manufacturer.php的语言添加新的必需变量以显示标签.
In Language of admin catalog/manufacturer.phpadd new required variable to display label.
管理员catalog/manufacturer.php的控制器
Controller of Admin catalog/manufacturer.php
getForm() //update regarding view variables according to tpl.
查看管理目录/manufacturer_form.tpl的文件添加您的下拉字段和从getForm()传递的变量.
View file of admin catalog/manufacturer_form.tpladd your dropdown field and variables passed from getForm().
管理员catalog/manufacturer.php的控制器
Controller of Admin catalog/manufacturer.php
validate() //check if you need validation on passed values from tpl file.
现在alter table制造商在数据库上添加了额外的字段.
Now alter table manufacturer add extra field on database.
管理目录的模型/manufacturer.php
Model of Admin catalog/manufacturer.php
addManufacturer() //edit query to add your extra to insert in database
editManufacturer() //edit query to update your extra added field
这篇关于Opencart制造国的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!