Forms Magento-额外地址字段(注册期间)

Forms Magento-额外地址字段(注册期间),forms,magento,registration,Forms,Magento,Registration,客户注册时: $address->setData('firstname', $this->getRequest()->getPost('billing_firstname')); $address->setData('lastname', $this->getRequest()->getPost('billing_lastname')); $address->setData('fax', $this->getRequest()->getPos

客户注册时:

$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));
默认情况下,Magento使用提供的客户名称自动填充默认发货/账单信息。我们是B2B,需要在注册时单独收集这些信息。此外,我们需要得到地址传真号码

$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));
这些属性不是自定义属性(已经创建了一系列这些属性,并将它们集成到一个大大扩展的注册表中),而是与客户地址相关联的标准名、姓和传真字段

$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));
我尝试过:

        <span class="msg">Default shipping and billing information.</span>
        <ul class="form-list">
            <li class="fields">
                <div class="field billing_name">
                    <label for="billing_firstname" class="required"><em>*</em><?php echo $this->__('First Name') ?></label>
                    <div class="input-box">
                        <input type="text" name="billing_firstname" id="billing_firstname" value="<?php echo $this->htmlEscape($this->getFormData()->getFirstName()) ?>" title="<?php echo $this->__('First Name') ?>" class="input-text required-entry" />
                    </div>
                </div>
                <div class="field billing_name">
                    <label for="billing_lastname" class=""><em>*</em><?php echo $this->__('Last Name') ?></label>
                    <div class="input-box">
                        <input type="text" name="billing_lastname" id="billing_lastname" value="<?php echo $this->htmlEscape($this->getFormData()->getLastName()) ?>" title="<?php echo $this->__('Last Name') ?>" class="input-text required-entry" />
                    </div>
                </div>
            </li>
$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));
当我注销时:

2012-12-18T01:51:10+00:00 DEBUG (7): createPostAction, after var jam: Mage_Customer_Model_Address Object
(
    [_customer:protected] => 
    [_eventPrefix:protected] => customer_address
    [_eventObject:protected] => customer_address
    [_resourceName:protected] => customer/address
    [_resource:protected] => 
    [_resourceCollectionName:protected] => customer/address_collection
    [_cacheTag:protected] => 
    [_dataSaveAllowed:protected] => 1
    [_isObjectNew:protected] => 
    [_data:protected] => Array
        (
            [entity_type_id] => 2
            [entity_id] => 
            [is_default_billing] => 1
            [is_default_shipping] => 1
            [firstname] => Chirp  // customer firstname
            [lastname] => Anaplex // customer lastname
            [company] => some agency
            [street] => 2345 somewhere dr
            [city] => somecity
            [country_id] => US
            [region] => 
            [region_id] => 44
            [postcode] => 84151
            [telephone] => 123-123-1233
        )

    [_hasDataChanges:protected] => 1
    [_origData:protected] => 
    [_idFieldName:protected] => entity_id
    [_isDeleted:protected] => 
    [_oldFieldsMap:protected] => Array
        (
        )

    [_syncFieldsMap:protected] => Array
        (
        )

)
$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));
表单变量已成功传递(我在日志中看到),但我似乎无法以这种方式将它们插入address对象。我收到以下通知:

2012-12-18T16:39:39+00:00 ERR (3): Notice: Indirect modification of overloaded element of Mage_Customer_Model_Address has no effect  in /root/namespace/module/controllers/AccountController.php on line 79
$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));
如果这是“间接的”-“直接”方法是什么

$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));

有人吗。这很有效

$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));
还有人需要这个吗

$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));
将表单字段添加到
您的/theme/template/persistent/forms/register.phtml

覆盖
Mage\u Customer\u AccountController

yourmodule/customer/controller/accountController.php::createPostAction()

$address->setData('firstname', $this->getRequest()->getPost('billing_firstname'));
$address->setData('lastname', $this->getRequest()->getPost('billing_lastname'));
$address->setData('fax', $this->getRequest()->getPost('billing_fax'));