Post by nickjdunn » Thu Mar 30, 2017 5:21 am

Hi Everyone,
I have opencart version 1.5.5.1 with the standard checkout and all I want to do is add a radio button to choose between business or residential when typing in a shipping address and also have what they chose show up in the order confirmation email. I have searched for a module to do this and only come across the UPS module that decides when they fill out the form but a simple radio button is more the way we want to go.
Any help on this would be greatly appreciated.

Newbie

Posts

Joined
Fri Dec 18, 2015 1:54 am

Post by litextension » Thu Mar 30, 2017 4:47 pm

Hi nickjdunn,

You can consider given guide. I see it via Stackoverflow.

/*** TIME SLOT OPENCART CODING ***/

C:\wamp\www\OC\catalog\controller\checkout\shipping_method.php

1)
Find :-
$this->session->data['comment'] = strip_tags($this->request->post['comment']);

After that copy and paste :-
$this->session->data['shipping_timeslot'] = $this->request->post['shipping_timeslot'];
-------------------------------------------------------------------------------------------------------------
2)
Find :-
$this->data['text_shipping_method'] = $this->language->get('text_shipping_method');

After that copy and paste :-
$this->data['text_shipping_timeslot'] = $this->language->get('text_shipping_timeslot');
$this->data['ship_slot_one'] = $this->language->get('ship_slot_one');
$this->data['ship_slot_two'] = $this->language->get('ship_slot_two');
$this->data['ship_slot_three'] = $this->language->get('ship_slot_three');
$this->data['ship_slot_four'] = $this->language->get('ship_slot_four');
-------------------------------------------------------------------------------------------------------------
3)
Find :-
if (isset($this->session->data['comment'])) {
$this->data['comment'] = $this->session->data['comment'];
} else {
$this->data['comment'] = '';
}

After that copy and paste :-
if (isset($this->session->data['shipping_timeslot'])) {
$this->data['shipping_timeslot'] = $this->session->data['shipping_timeslot'];
} else {
$this->data['shipping_timeslot'] = '';
}
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

C:\wamp\www\OC\catalog\model\checkout\order.php

1)
Find :-
commission = '" . (float)$data['commission'] . "'

After that copy and paste :-
shipping_time_slot = '" . $this->db->escape($data['shipping_timeslot']) . "',

-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

C:\wamp\www\OC\catalog\language\english\checkout\checkout.php

1)
Find :-
$_['text_length']

After that copy and paste :-
$_['text_shipping_timeslot'] = 'Please select the preferred shipping time slot.';
$_['ship_slot_one'] = 'Morning';
$_['ship_slot_two'] = 'Afternoon';
$_['ship_slot_three'] = 'Evening';
$_['ship_slot_four'] = 'Night';

-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

C:\wamp\www\OC\catalog\view\theme\vitalia\template\checkout\shipping_method.tpl

1)
Find :-
<p><?php echo $text_shipping_method; ?></p>

Above that copy and paste :-
<p><?php echo $text_shipping_timeslot; ?></p>
<table class="radio">

<tr>
<td colspan="3"><b><?php echo "Delivery time slot"; ?></b></td>
</tr>
<tr class="highlight">
<td>
<input type="radio" name="shipping_timeslot" value="<?php echo $ship_slot_one; ?>" id="morning" checked="checked"/><?php echo $ship_slot_one; ?></br>
<input type="radio" name="shipping_timeslot" value="<?php echo $ship_slot_two; ?>" id="afternoon"/><?php echo $ship_slot_two; ?></br>
<input type="radio" name="shipping_timeslot" value="<?php echo $ship_slot_three; ?>" id="evening"/><?php echo $ship_slot_three; ?></br>
<input type="radio" name="shipping_timeslot" value="<?php echo $ship_slot_four; ?>" id="night"/><?php echo $ship_slot_four; ?></br>
</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</table>

-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

C:\wamp\www\OC\admin\controller\sale\order.php

1)
Find :-
$this->data['store_url'] = $order_info['store_url'];

Above that copy and paste :-
$this->data['shipping_time_slot'] = $order_info['shipping_time_slot'];
-------------------------------------------------------------------------------------------------------------

2)
Find :- May be line no. 1580
$this->data['comment'] = nl2br($order_info['comment']);

Below that copy and paste :-
$this->data['shipping_time_slot'] = $order_info['shipping_time_slot'];

-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

C:\wamp\www\OC\catalog\controller\checkout\confirm.php

1)
Find :-
$data['comment'] = $this->session->data['comment'];

Below that copy and paste :-
$data['shipping_timeslot'] = $this->session->data['shipping_timeslot'];

-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

C:\wamp\www\OC\admin\language\english\sale\order.php

1)
Find :-
$_['text_store_name'] = 'Store Name:';

Below that copy and paste :-
$_['text_time_slot'] = 'Time Slot:';

-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

C:\wamp\www\OC\admin\view\template\sale\order_info.tpl

1)
Find :-
<tr>
<td><?php echo $text_store_name; ?></td>
<td><?php echo $store_name; ?></td>
</tr>

Below that copy and paste :-

<tr>
<td><?php echo $text_time_slot; ?></td>
<td><?php echo $shipping_time_slot ?></td>
</tr>

-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

C:\wamp\www\OC\admin\model\sale\order.php

1)
Find :-
'date_modified' => $order_query->row['date_modified']

Below that copy and paste :-
,
'shipping_time_slot' => $order_query->row['shipping_time_slot']

-------------------------------------------------------------------------------------------------------------
THATS IT
-------------------------------------------------------------------------------------------------------------

LitExtension - Shopping Cart Migration Expert
Visit us at: https://litextension.com


User avatar
New member

Posts

Joined
Wed Aug 03, 2016 4:22 pm
Who is online

Users browsing this forum: No registered users and 140 guests