如何在magento自定义注册表单中添加新字段和使用现有地址字段

时间:2014-05-20 09:12:41

标签: magento

嗨,我是magento的新手..我需要一些帮助..

  1. 我可以在我的视图(phtml文件)中添加表单中的地址字段,但字段数据不是

    已保存。我怎么能够保存这些字段? phtml文件中地址字段的代码

    <div class="form-group margin_top">
    <label for="street_1" class="required col-md-4 control-label"><?php echo $this->__('Adresse') ?><em>* :</em></label>
    <div class="col-md-6">
        <div class="row">
            <div class="col-md-3 nopaddingright">
                <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
                <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text form-control <?php echo $_streetValidationClass ?>" />
            </div>
            <div class="col-md-9 address_block">
                <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
                    <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
                        <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i)) ?>"    title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="form-control input-text <?php echo $_streetValidationClass ?>" />
                    <?php endfor; ?>
            </div>
            <div class="col-md-9 nopaddingright">
                <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="form-control input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
            </div>
            <div class="col-md-3 address_block">
                <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text form-control validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
            </div>
            <div class="col-md-12">
                <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text form-control <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" />
            </div>
        </div>
    </div>
    

  2. 2。我还需要将移动(单元)字段添加到我的表单中,如何添加并存入我的

    数据库。  我需要创建自定义模块吗?请建议我帮助我

    谢谢

0 个答案:

没有答案