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

时间秒杀一切 提交于 2019-12-04 21:51:04

if you are using magento versions 1.6 above than you can copy "billing.phtml" from "app\design\frontend\base\default\template\persistant\checkout\onepage" to "app\design\frontend\default\your_theme\template\persistant\checkout\onepage".Then you have to add your custom fileds in it.

Find <?php if ($this->canShip()): ?> this line in your billing.phtml and add your code above it. For eg:

<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>    

I have added a text field and a button.You can see it in frontend.

Now for adding custom fields in shipping information all the above process are almost same,just find shipping .phtml in "app\design\frontend\base\default\template\checkout\onepage\" and create a same folder structure in yuour theme folder and paste it there. Add you fields there.

Hope this will help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!