Hello
I was searching on the forum solution to add extra fields on checkout step 4 and make them required but did not find clear answer. There are several paid addons. But the solution was not so difficult. (so it is worth saving some $). I did not have time to make it as addon. but for my purposes it works perfect.
So lets first add extra fields in the cscart_orders table. Let us name them: max_delivery and delivery time.
Now we need to change
in controllers/customer/checkout.php
after the following lines ```php
if (!empty($_REQUEST[‘customer_notes’])) {
$cart[‘notes’] = $_REQUEST[‘customer_notes’];
}
<br />
add these<br />
```php
<br />
<br />
if (!empty($_REQUEST['max_delivery'])) {<br />
$cart['max_delivery'] = $_REQUEST['max_delivery'];<br />
}<br />
<br />
if (!empty($_REQUEST['delivery_time'])) {<br />
$cart['delivery_time'] = $_REQUEST['delivery_time'];<br />
}<br />
```<br />
<br />
in controllers/admin/order_management.php<br />
<br />
after<br />
```php
<br />
$cart['notes'] = !empty($_REQUEST['customer_notes']) ? $_REQUEST['customer_notes'] : '';<br />
```<br />
<br />
add as follows:<br />
```php
<br />
$cart['max_delivery'] = !empty($_REQUEST['max_delivery']) ? $_REQUEST['max_delivery'] : '';<br />
$cart['delivery_time'] = !empty($_REQUEST['delivery_time']) ? $_REQUEST['delivery_time'] : '';<br />
```<br />
<br />
<br />
now in controllers/customer/orders.php<br />
<br />
after<br />
<br />
```php
<br />
if (!empty($_REQUEST['customer_notes'])) {<br />
$update_order['notes'] = (!empty($order_info['notes']) ? $order_info['notes'] . "\n" : '') . $_REQUEST['customer_notes'];<br />
}<br />
```<br />
<br />
add as follows:<br />
<br />
```php
<br />
if (!empty($_REQUEST['max_delivery'])) {<br />
$update_order['max_delivery'] = (!empty($order_info['max_delivery']) ? $order_info['max_delivery'] . "" : '') . $_REQUEST['max_delivery'];<br />
}<br />
if (!empty($_REQUEST['delivery_time'])) {<br />
$update_order['delivery_time'] = (!empty($order_info['delivery_time']) ? $order_info['delivery_time'] . "" : '') . $_REQUEST['delivery_time'];<br />
}<br />
```<br />
<br />
<br />
now in skins/basic/admin/views/orders/details.tpl<br />
<br />
after ```php
<br />
<div id="content_addons"><br />
{hook name="orders:customer_info"}<br />
{/hook}<br />
<!--content_addons--></div><br />
```<br />
<br />
<br />
add ```php
<br />
<div>{$lang.max_date} {$order_info.max_delivery} </div><br />
<div>{$lang.delivery_time} {$order_info.delivery_time} </div><br />
```<br />
<br />
<br />
now in skins/basic/customer/views/orders/details.tpl<br />
<br />
after ```php
<br />
<tr><br />
<td valign="top"><strong>{$lang.customer_notes}: </strong></td><br />
<td><div class="scroll-x">{$order_info.notes|replace:"\n":"<br />"|default:"-"}</div></td><br />
</tr><br />
```<br />
<br />
<br />
add as follows:<br />
<br />
```php
<br />
<tr><br />
<td valign="top"><strong>{$lang.max_date} </strong></td><br />
<td><div>{$order_info.max_delivery}</div></td><br />
</tr> <br />
<tr><br />
<td valign="top"><strong>{$lang.delivery_time} </strong></td><br />
<td><div>{$order_info.delivery_time}</div></td><br />
</tr><br />
```<br />
<br />
<br />
now in skins/basic/mail/orders/invoice.tpl<br />
<br />
after ```php
<br />
{if $order_info.notes}<br />
<table cellpadding="0" cellspacing="0" border="0" width="100%"><br />
<tr valign="top"><br />
<td style="font-size: 12px; font-family: Arial;"><strong>{$lang.notes}:</strong></td><br />
<td width="100%"><div style="padding-left: 7px; padding-bottom: 15px; overflow-x: auto; clear: both; width: 464px; height: 100%; padding-bottom: 20px; overflow-y: hidden; font-size: 12px; font-family: Arial;">{$order_info.notes|wordwrap:85:"\n":false|nl2br}</div></td><br />
</tr><br />
</table><br />
{/if}<br />
```<br />
<br />
add as follows: ```php
<br />
{if $order_info.max_delivery}<br />
<table cellpadding="0" cellspacing="0" border="0" width="100%"><br />
<tr valign="top"><br />
<td width="20%" style="font-size: 12px; font-family: Arial;"><strong>{$lang.max_date}</strong></td><br />
<td width="50%"><div style="padding-left: 7px; padding-bottom: 15px; overflow-x: auto; clear: both; width: 100px; height: 100%; padding-bottom: 10px; overflow-y: hidden; font-size: 12px; font-family: Arial; font-weight:bold">{$order_info.max_delivery}</div></td><br />
</tr><br />
<tr valign="top"><br />
<td width="20%" style="font-size: 12px; font-family: Arial;"><strong>{$lang.delivery_time}</strong></td><br />
<td width="50%"><div style="padding-left: 7px; padding-bottom: 15px; overflow-x: auto; clear: both; width: 150px; height: 100%; padding-bottom: 20px; overflow-y: hidden; font-size: 12px; font-family: Arial; font-weight:bold">{$order_info.delivery_time}</div></td><br />
</tr><br />
<br />
</table><br />
{/if}<br />
```<br />
<br />
<br />
Now make a copy of calendar.tpl located in skins/basic/customer/common_templates/<br />
and name it calendar1.tpl<br />
<br />
in the new file<br />
<br />
replace<br />
<br />
```php
<br />
<input type="text" id="{$date_id}" name="{$date_name}" class="input-text-medium{if $date_meta} {$date_meta}{/if} cm-calendar" value="{if $date_val}{$date_val|date_format:"`$date_format`"}{/if}" {$extra} size="10" /> <img src="{$images_dir}/icons/calendar.gif" class="cm-external-focus calendar-but valign" rev="{$date_id}" title="{$lang.calendar}" alt="{$lang.calendar}" /><br />
```<br />
<br />
<br />
with this code<br />
<br />
```php
<br />
<div class="form-field"><br />
<label for="{$date_id}" class="cm-required cm-calendar">{$lang.max_date}</label><br />
<input type="text" id="{$date_id}" name="{$date_name}" class="input-text-medium{if $date_meta} {$date_meta}{/if} cm-calendar" value="{if $date_val}{$date_val|date_format:"`$date_format`"}{/if}" {$extra} size="10" /> <img src="{$images_dir}/icons/calendar.gif" class="cm-external-focus calendar-but valign" rev="{$date_id}" title="{$lang.calendar}" alt="{$lang.calendar}" /><br />
</div><br />
```<br />
<br />
<br />
Now create new file in skins/basic/customer/views/checkout/components<br />
and name it customer_delivery_time.tpl<br />
<br />
copy this code into this file<br />
<br />
```php
<br />
{* $Id$ *}<br />
<div class="form-field"><br />
<label for="delivery_time" class="cm-required cm-delivery-time">{$lang.delivery_time}:</label><br />
<select id="delivery_time" name="delivery_time" class="cm-delivery-time"><br />
<option value="">Choose desired time</option><br />
<option value="{$lang.hora1}">{$lang.hora1}</option><br />
<option value="{$lang.hora2}">{$lang.hora2}</option><br />
<option value="{$lang.hora3}">{$lang.hora3}</option><br />
</select><br />
</div><br />
```<br />
<br />
<br />
Now final step is to modify step_four.tpl located in skins/basic/customer/views/checkout/components/steps/<br />
<br />
after ```php
<br />
{if !$iframe_mode}<br />
{include file="views/checkout/components/customer_notes.tpl"}<br />
{/if}<br />
```<br />
<br />
<br />
add as follows:<br />
<br />
```php
<br />
{include file="common_templates/calendar1.tpl" date_id="date_holder_to" date_name="max_delivery" date_val=$value start_year="current_year" end_year="0"}<br />
{include file="views/checkout/components/customer_delivery_time.tpl"}<br />
```<br />
<br />
<br />
<br />
You will need to add language variables. But it is not a problem....<br />
<br />
Now you have delivery required date calendar field and select box for time on checkout step 4 page. Both fields are required and also shown on invoice, order details for customer and admin.<br />
<br />
<br />
I hope it will help somebody. All improvements are welcome.