Magento在一页结帐送货和账单地址中添加自定义字段 [英] Magento add custom field in One-Page checkout shipping and billing address
问题描述
我是Magento的新手.我想在一页结帐单和送货地址中添加更多字段.
I am new in Magento. I want to add more fields in onepage checkout billing and shipping address.
我已经关注了此链接
http://excellencemagentoblog.com/magento-adding-custom-字段到客户地址
但是它对我不起作用.
推荐答案
如果使用的是magento 1.6以上版本,则可以从"app \ design \ frontend \ base \ default \ template \ persistant \"中复制"billing.phtml" checkout \ onepage"到"app \ design \ frontend \ default \ your_theme \ template \ persistant \ checkout \ onepage".然后,您必须在其中添加自定义文件.
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.
在billing.phtml中找到<?php if ($this->canShip()): ?>
此行,并在其上方添加代码.例如:
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.
现在,在运输信息中添加自定义字段的所有上述过程几乎相同,只需在"app \ design \ frontend \ base \ default \ template \ checkout \ onepage \"中找到运输.phtml并在其中创建相同的文件夹结构yuour theme文件夹并将其粘贴到那里.在此处添加您的字段.
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.
希望这会有所帮助.
这篇关于Magento在一页结帐送货和账单地址中添加自定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!