Magento在一页结账发货和账单地址中添加自定义字段


Magento add custom field in One-Page checkout shipping and billing address

我是马根托的新手。我想在一页结账账单和发货地址中添加更多字段。

我已经关注了这个链接

http://excellencemagentoblog.com/magento-adding-custom-field-to-customer-address

但它对我不起作用。

如果您使用的是高于1.6版本的magento,那么您可以将"billing.phtml"从"app''design''fronend''base''default''template''persistant''checkout''onepage"复制到"app''ddesign''fronend''default''your_theme''template''persistant ''checkout'' onepage"。然后您必须在其中添加自定义文件。

在billing.html中找到<?php if ($this->canShip()): ?>这一行,并在上面添加代码。例如:

<li class="fields">
    <div class="field">
    <label for="billing:suburb" class="required"><em>*</em><?php echo $this->__('Suburb/Postcode') ?></label>
    <div class="input-box">
        <input type="text" id="suburbs" name="custom" value="<?php echo $this->htmlEscape($this->getQuote()->getSuburb()) ?>" title="<?php echo $this->__('Suburb') ?>" class="input-text required-entry" id="billing:suburb" />
       <button type="button" id="driver" title="<?php echo $this->__('Click me!') ?>" class="button" ><span><span><?php echo $this->__('Click me!') ?></span></span></button>
    </div>
</div>    

我添加了一个文本字段和一个按钮。你可以在前端看到它。

现在,要在发货信息中添加自定义字段,上述过程几乎相同,只需在"app''design''frontend''base''default''template''checkout''onepage''"中找到shipping.phtml,并在yuour主题文件夹中创建相同的文件夹结构并将其粘贴到那里。在那里添加字段。

希望这会有所帮助。