0

我的客户帐户注册中有一个额外的字段,客户可以从我们的数据库中选择他们所属的美国学校。我们希望在创建客户帐户时将学校地址填充到客户数据中。

我已通过 local.xml 中的以下 xml 在客户帐户创建中打开地址字段。我暂时在 register.phtml 模板中注释掉了这些字段。我打算以这种方式发布地址,但是如果我想将多个地址添加到客户帐户中,我将如何在注册发布期间添加更多地址?

<customer_account_create>
        <reference name="customer_form_register">
            <action method="setShowAddressFields"><value>true</value></action>
        </reference>
</customer_account_create>

将进行 ajax 调用以获取学校地址,然后在以下隐藏字段中附加适用的值。同样,我经常需要发布多个地址。

<?php if($this->getShowAddressFields()): ?>
        <input type="hidden" name="create_address" value="1" />
        <input type="hidden" name="company" id="company" value="" title="<?php echo $this->__('Company') ?>" />
        <input type="hidden" name="telephone" id="telephone" value="" title="<?php echo $this->__('Telephone') ?>" />
        <input type="hidden" name="street[]" value="" title="<?php echo $this->__('Street Address') ?>" id="street_1" />
        <input type="hidden" name="street[]" value="" title="<?php echo $this->__('Street Address 2') ?>" id="street_2" />
        <input type="hidden" name="city" value="" title="<?php echo $this->__('City') ?>" id="city" />
        <input type="hidden" id="region_customer_id" name="region_cait_id" title="<?php echo $this->__('State/Province') ?>">
        <input type="hidden" id="region" name="region" value="" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
        <input type="hidden" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
        <input type="hidden" name="default_billing" value="1" />
        <input type="hidden" name="default_shipping" value="1" />
    <?php endif; ?>

如果我需要创建一个模块:我应该加入什么事件?如何将地址保存到客户数据中?我需要在客户帐户创建表格上发布的值。

4

1 回答 1

0

退出事件

customer_register_success event

在 SITE 中创建事件

于 2013-09-27T07:30:38.410 回答