Magento在单页结帐运费和帐单邮寄地址中添加自定义字段

时间:2014-04-12 12:44:49

标签: php magento magento-1.7

我是Magento的新人。我想在一个页面结帐帐单和送货地址中添加更多字段。

我已关注此链接

  

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

但它不适合我。

1 个答案:

答案 0 :(得分:1)

如果您使用的是上面的magento版本,则可以复制" billing.phtml"来自" app \ design \ frontend \ base \ default \ template \ persistant \ checkout \ onepage"到" app \ design \ frontend \ default \ your_theme \ template \ persistant \ checkout \ onepage"。然后你必须在里面添加自定义文件。

在billing.phtml中找到<?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>    

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

现在,为了在发货信息中添加自定义字段,以上所有过程几乎相同,只需在&#34; app \ design \ frontend \ base \ default \ template \ checkout \ onepage \&#34;中找到发货.phtml;并在yuour主题文件夹中创建相同的文件夹结构并将其粘贴到那里。在那里添加字段。

希望这会有所帮助。

相关问题