I'm currently working on a custom shipping method for Magento 1.9.
Right now, I have to add a custom field in the checkout page and fill it with the timeslots available for delivery (I plan to add a select field).
I followed this tutorial : http://excellencemagentoblog.com/blog/2015/08/20/checkout-add-extra-address-field/#disqus_thread to create a custom field and save it in the database when the customer make an order.
It's working but I don't know how to change the field position from billing/shipping address block to shipping method block. I want to place my field after the shipping methods.
I tried to do something like this :
layout file (app/design/frontend/base/default/layout/address.xml) :
<?xml version="1.0"?>
<layout version="0.1.0">
<checkout_onepage_index>
<reference name='checkout.onepage.shipping_method.available'>
<block type='checkout/onepage_shipping_method_available' name='form.additional.info' template='checkout/onepage/shipping_method/timeslots_field.phtml'></block>
<!-- <block type='checkout/onepage_shipping_method' name='form.additional.info' template='address/checkout/onepage/billing_field.phtml'></block> -->
</reference>
</checkout_onepage_index>
</layout>
template file (app/design/frontend/base/default/template/checkout/onepage/shipping_method/timeslots_field.phtml) :
<div class="field">
<label for="available:delivery_instruction" class="required">
<?php echo $this->__('Delivery Instructions') ?>
</label>
<div class="input-box">
<input type="text" name="available[delivery_instruction]" id="available:delivery_instruction" value="<?php echo $this->escapeHtml($this->getAddress()->getDeliveryInstruction()) ?>" title="<?php echo $this->__('Delivery Instructions') ?>" class="input-text required-entry" />
</div>
</div>
template file (app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml)
// lot of stuff
<?php echo $this->getChildHtml('form.additional.info'); ?>
Does someone can help me ?
Thanks.
Edit : edited code with newest version, I can't manage to make it work.
Best Answer
Don't change base files; create copy of
To
Now add line
At last in phtml.