magento 添加会员注册字段

来源:互联网 发布:鼎捷软件股份有限公司 编辑:程序博客网 时间:2024/04/30 02:55

以magento1.9.3作为例子
添加以下代码到magento根目录,运行.
这里写图片描述

<?phpdefine('MAGENTO', realpath(dirname(__FILE__)));ini_set('memory_limit', '32M');set_time_limit (0);require_once MAGENTO . '/app/Mage.php';Mage::app();$setup = new Mage_Eav_Model_Entity_Setup('core_setup');$setup->startSetup();$entityTypeId     = $setup->getEntityTypeId('customer');$attributeSetId   = $setup->getDefaultAttributeSetId($entityTypeId);$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);$setup->addAttribute('customer', 'mobile', array(    'input'         => 'text',    'type'          => 'text',    'label'         => 'Mobile',    'visible'       => 1,    'required'      => 1,    'user_defined'  => 1,));$setup->addAttributeToGroup( $entityTypeId, $attributeSetId, $attributeGroupId, 'mobile', '999'  //sort_order);$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'mobile');$oAttribute->setData('used_in_forms', array('adminhtml_customer'));$oAttribute->save();$re = $setup->endSetup();var_dump($re);
0 0
原创粉丝点击