gpt4 book ai didi

Magento-在默认注册表单上添加字段

转载 作者:行者123 更新时间:2023-12-02 00:19:45 25 4
gpt4 key购买 nike

我正在使用 Magento v1.7.0.2 并尝试在注册表单上添加移动字段。我修改了代码(参见下面的代码)。但是,注册表单上仍然没有显示“移动”字段。

有谁可以帮助我吗?提前致谢!

app\etc\modules\Mydons_Customer.xml

<config>
<modules>
<Mydons_Customer>
<codePool>local</codePool>
<active>true</active>
</Mydons_Customer>
</modules>
</config>

app\code\local\Mydons\Customer\etc\config.xml

<?xml version="1.0"?>
<config>
<modules>
<Mydons_Customer>
<version>1.7.0.0</version>
</Mydons_Customer>
</modules>
<global>
<fieldsets>
<customer_account>
<mobile><create>1</create><update>1</update></mobile>
</customer_account>
</fieldsets>
<models>
<Mydons_Customer>
<class>Mydons_Customer_Model</class>
</Mydons_Customer>
</models>
<helpers>
<Mydons_Customer>
<class>Mydons_Customer_Helper</class>
</Mydons_Customer>
</helpers>
<resources>
<customerattribute_setup>
<setup>
<module>Mydons_Customer</module>
<class>Mydons_Customer_Model_Entity_Setup</class>
</setup>
</customerattribute_setup>
</resources>
</global>
</config>

app\code\local\Mydons\Customer\Model\Entity\Setup.php

class Mydons_Customer_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup
{
public function getDefaultEntities(){

return array(

'mobile'=>array(
'type'=> 'static',
'label'=> 'Mobile',
'visiable' => true,
'required' => true,
'sort_order' => 80,
)
);
}
}

app\code\local\Mydons\Customer\sql\customerattribute_setup\mysql4-install-0.1.0.php

   $installer = $this;

$installer->startSetup();


$installer->addAttribute('customer', 'mobile', array(
'label' => 'Mobile',
'visible' => 1,
'required' => 1,
'position' => 1,
'sort_order' => 80,
));


$installer->endSetup();

$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'mobile');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();

最佳答案

您需要修改相应的模板,在注册表单中添加您想要的字段。
在本例中,customer/form/register.phtmlpersistent/customer/form/register.phtml

关于Magento-在默认注册表单上添加字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11501020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com