[英]How to add image field in dynamic input group for magento admin configuration setting?
I have created a module which add dynamic input group to magento admin configuration. 我创建了一个模块,该模块将动态输入组添加到magento管理员配置中。
I have added image field but it can't save in database. 我已经添加了图像字段,但是无法保存在数据库中。 Means if I select image than only image store in database in core_config_data — the encrypted value of row (just image field value) 意味着如果我选择的不是图像,而是仅选择数据库中存储在core_config_data中的图像-行的加密值(仅图像字段值)
If I remove image field than the data saved properly in database along with other inputs. 如果我删除图像字段,那么数据将与其他输入一起正确保存在数据库中。
So here I can't save image type data with other data of dynamic input. 因此,在这里我无法将图像类型数据与其他动态输入数据保存在一起。
I've found reason + solution, maybe this is helpful for someone. 我已经找到了理由+解决方案,也许这对某人很有帮助。 Magento is using the wrong backend model. Magento使用了错误的后端模型。 For saving images the backend model must be system_config_backend_image . 为了保存图像,后端模型必须是system_config_backend_image 。 But as you've added the fields dynamically (and not inside the system.xml) the fields have no assigned backend model, so magento will use the default for text values etc.. 但是随着您动态添加字段(而不是在system.xml内部),这些字段没有分配后端模型,因此magento将使用默认值作为文本值等。
The solution is, to use the clone_fields functionality. 解决方案是使用clone_fields功能。 Please find my explanation how to use it on my blog post http://www.mellority-report.com/magento-dynamic-config-fields-with-custom-backend-models/ 请在我的博客文章http://www.mellority-report.com/magento-dynamic-config-fields-with-custom-backend-models/上找到我的使用说明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.