1

我想在客户注册表中添加字段手机号码、昵称、职业。我有一个教程,通过它我可以从客户那里获取地址和传真并将它们取回,但是如果我尝试手机号码和昵称,数据没有保存在数据库中,我现在该怎么办? 请在这里帮助我。

4

2 回答 2

1

将移动设备添加到客户注册、客户编辑页面等。从 magento 根目录运行以下设置脚本。

define('MAGENTO', realpath(dirname(__FILE__)));

require_once MAGENTO . '/app/Mage.php';

Mage::app();



$installer = new Mage_Customer_Model_Entity_Setup('core_setup');

$installer->startSetup();

$vCustomerEntityType = $installer->getEntityTypeId('customer');
$vCustAttributeSetId = $installer->getDefaultAttributeSetId($vCustomerEntityType);
$vCustAttributeGroupId = $installer->getDefaultAttributeGroupId($vCustomerEntityType, $vCustAttributeSetId);

$installer->addAttribute('customer', 'mobile', array(
        'label' => 'Customer Mobile',
        'input' => 'text',
        'type'  => 'varchar',
        'forms' => array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'),
        'required' => 0,
        'user_defined' => 1,
));

$installer->addAttributeToGroup($vCustomerEntityType, $vCustAttributeSetId, $vCustAttributeGroupId, 'mobile', 0);

$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'mobile');
$oAttribute->setData('used_in_forms', array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'));
$oAttribute->save();

$installer->endSetup();
于 2013-05-16T09:38:06.353 回答
0

您必须覆盖客户模块的帐户控制器。您将按照此链接在 magento 中覆盖控制器。http://inhoo.net/tools-frameworks/how-to-extend-magento-core-controller/

于 2013-04-08T11:07:27.640 回答