程序笔记   发布时间:2022-05-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了magento2 添加 customer attributes大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

<table class="bash"><tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

. 创建一个PacktCustomerAttribute模块添加customer的属性
appcodePacktCustomerAttributeetc@H_557_75@module.xml的内容:
?xml =?
config xmlns:=http://www.w3.org/2001/XMLscheR_828_11845@a-instance"xsi:namespacescheR_828_11845@aLOCATIOn=ule/etc/module.xsd"
        @H_557_75@module name= =
                sequence
                        @H_557_75@module name=
                sequence
        @H_557_75@module
config
、在 appcodePacktCustomerAttribute下,创建文件 registration.@R_674_11161@:
?@R_674_11161@
    \Magento\Framework\Component\ComponentRegistrar::register
    \Magento\Framework\Component\ComponentRegistrar::MODulE,    ,    __DIR__
    ;
、创建数据安装脚本:appcodePacktCustomerAttributeSetupInstallData.@R_674_11161@ 
?@R_674_11161@
namespace Packt\CustomerAttribute\Setup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContexTinterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface

        private ;
    
        public   __construct\Magento\Customer\Setup\CustomerSetupFactory  
        
                -customerSetupFactory = ;
        
    
        public  @H_557_75@moduleDataSetupInterface ,ModuleContexTinterface 
        
                 var CustomerSetup  
         = -customerSetupFactory-create= ;
        -startSetup;
        -addAttribute,,
                 = ,                 = ,                input' = ,                required' = ,                 = ,                position' = ,        ;
         = -getEavConfig-getAttribute,;
                -setData,adminHTML_customer';
        -save;
        -endSetup;
    

、添加属性到后台,我们要创建一个ui_component XML文件appcodePacktCustomerAttributevIEwbaseui_componentcustomer_form.xml
?xml = Coding=?
form xmlns:=http://www.w3.org/2001/XMLscheR_828_11845@a-instance" xsi:namespacescheR_828_11845@aLOCATIOn=ule:Magento_Ui:etc/ui_configuration.xsd"
    fIEldset name=
        fIEld name=
                argument name= xsi:=
                        item name=fig" xsi:=
                                item name= xsi:=textitem
                                item name=xsi:=inputitem
                                item name=xsi:=customeritem
                        item
                argument
        fIEld
    fIEldset
form
. 最后执行命令 @R_674_11161@ bin@H_557_75@magento setup:upgrade:table>

大佬总结

以上是大佬教程为你收集整理的magento2 添加 customer attributes全部内容,希望文章能够帮你解决magento2 添加 customer attributes所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。